From bf11afdba8486d5b15445d55427a5e97385348fd Mon Sep 17 00:00:00 2001 From: Amlal Date: Wed, 11 Sep 2024 20:39:17 +0200 Subject: REWORK: Reworking Paging API on AMD64. Signed-off-by: Amlal --- dev/ZKA/Sources/ExeMain.cxx | 166 -------------------------------------------- 1 file changed, 166 deletions(-) delete mode 100644 dev/ZKA/Sources/ExeMain.cxx (limited to 'dev/ZKA/Sources') diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx deleted file mode 100644 index a3fdfaa0..00000000 --- a/dev/ZKA/Sources/ExeMain.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies - - File: Main.cxx - Purpose: Main entrypoint of Kernel. - -------------------------------------------- */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/***********************************************************************************/ -/* Returns Kernel's version. */ -/***********************************************************************************/ - -EXTERN Kernel::Property cKernelVersion; - -/***********************************************************************************/ -/* This is an external C symbol, to draw the mouse. */ -/***********************************************************************************/ - -STATIC CG::UI_WINDOW_STRUCT* cKernelWnd = nullptr; - -namespace Kernel::Detail -{ - /// @brief Filesystem auto formatter, additional checks are also done by the class. - class FilesystemInstaller final - { - Kernel::NeFileSystemMgr* fNeFS{nullptr}; - - public: - /// @brief wizard constructor. - explicit FilesystemInstaller() - { - if (Kernel::IFilesystemMgr::GetMounted()) - { - CG::CGDrawStringToWnd(cKernelWnd, "NeFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); - fNeFS = reinterpret_cast(Kernel::IFilesystemMgr::GetMounted()); - } - else - { - // Mounts a NeFS from main drive. - fNeFS = Kernel::mm_new_class(); - - Kernel::IFilesystemMgr::Mount(fNeFS); - - CG::CGDrawStringToWnd(cKernelWnd, "Mounted NeFS IFS (A:)", 10, 10, RGB(0, 0, 0)); - } - - const Kernel::SizeT cDirCount = 9UL; - - const Kernel::Char* cDirStr[cDirCount] = { - "\\Boot\\", "\\System\\", "\\Support\\", "\\Applications\\", - "\\Users\\", "\\Library\\", "\\Mount\\", "\\Store\\", "\\Applications\\Store\\"}; - - if (fNeFS->GetParser()) - { - for (Kernel::SizeT dirIndx = 0UL; dirIndx < cDirCount; ++dirIndx) - { - auto catalogDir = fNeFS->GetParser()->GetCatalog(cDirStr[dirIndx]); - - if (catalogDir) - { - CG::CGDrawStringToWnd(cKernelWnd, "Directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory already exists: ")), RGB(0, 0, 0)); - - delete catalogDir; - continue; - } - - catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, - kNeFSCatalogKindDir); - - CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0)); - - NFS_FORK_STRUCT theFork{ 0 }; - - rt_copy_memory(catalogDir->Name, theFork.CatalogName, rt_string_len(catalogDir->Name)); - rt_copy_memory(catalogDir->Name, theFork.ForkName, rt_string_len(catalogDir->Name)); - - theFork.DataSize = kNeFSForkDataSz; - theFork.Kind = kNeFSDataForkKind; - theFork.ResourceId = 0; - - fNeFS->GetParser()->CreateFork(catalogDir, theFork); - - auto data_len = 4096; - Char data[4096] = R"({ "FolderKind": "System", "Owner": "ZKA USER\\SUPER", "Important": true })"; - - fNeFS->GetParser()->WriteCatalog(catalogDir, false, data, data_len, theFork.ForkName); - - delete catalogDir; - } - } - } - - ~FilesystemInstaller() = default; - - ZKA_COPY_DEFAULT(FilesystemInstaller); - - /// @brief Grab the disk's NeFS reference. - /// @return NeFileSystemMgr the filesystem interface - Kernel::NeFileSystemMgr* Leak() - { - return fNeFS; - } - }; -} // namespace Kernel::Detail - -namespace Kernel -{ - EXTERN UserProcessScheduler* cProcessScheduler; -} - -/// @brief Application entrypoint. -/// @param Void -/// @return Void -EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) -{ - Kernel::cProcessScheduler = nullptr; - - CG::CGDrawBackground(); - - cKernelWnd = nullptr; - cKernelWnd = CG::CGCreateWindow(CG::cWndFlagWindow, "ZKA Operating System Kernel Log", "Window", 20, 20, CG::UIAccessibilty::The().Height() - 20, CG::UIAccessibilty::The().Width() - 20); - - cKernelWnd->w_sub_type = 0; - cKernelWnd->w_x = 10; - cKernelWnd->w_y = 10; - - cKernelWnd->w_needs_repaint = Yes; - - CG::CGDrawWindowList(&cKernelWnd, 1); - - /// Now run Kernel loop, until no process are running. - Kernel::Detail::FilesystemInstaller(); // automatic filesystem creation. - - cKernelWnd->w_sub_type = CG::cWndFlagCloseControlSelect; - cKernelWnd->w_needs_repaint = Yes; - - CG::CGDrawWindowList(&cKernelWnd, 1); - - CG::CGDrawStringToWnd(cKernelWnd, "Running: ", 10, 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, kSysProcess, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("Running: ")), RGB(0, 0, 0)); - - mp_do_user_switch(); -} -- cgit v1.2.3