diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-11 20:39:17 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-11 20:39:17 +0200 |
| commit | bf11afdba8486d5b15445d55427a5e97385348fd (patch) | |
| tree | af1370219334b2126655fa59b69b8d48ae63d63d /dev/ZKA/Sources | |
| parent | 8b6cc0cbe5e19e8114a65785e24bbcf4d22e0d2f (diff) | |
REWORK: Reworking Paging API on AMD64.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ZKA/Sources')
| -rw-r--r-- | dev/ZKA/Sources/ExeMain.cxx | 166 |
1 files changed, 0 insertions, 166 deletions
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 <KernelKit/PE.hxx> -#include <ArchKit/ArchKit.hxx> -#include <CompilerKit/Detail.hxx> -#include <FirmwareKit/Handover.hxx> -#include <KernelKit/FileMgr.hxx> -#include <KernelKit/Framebuffer.hxx> -#include <KernelKit/Heap.hxx> -#include <KernelKit/PEF.hxx> -#include <KernelKit/PEFCodeMgr.hxx> -#include <KernelKit/UserProcessScheduler.hxx> -#include <NewKit/Json.hxx> -#include <NewKit/KernelCheck.hxx> -#include <NewKit/String.hxx> -#include <NewKit/Utils.hxx> -#include <KernelKit/PEFCodeMgr.hxx> -#include <KernelKit/CodeMgr.hxx> -#include <CFKit/Property.hxx> -#include <Modules/CoreCG/WindowRenderer.hxx> -#include <KernelKit/Timer.hxx> - -/***********************************************************************************/ -/* 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::NeFileSystemMgr*>(Kernel::IFilesystemMgr::GetMounted()); - } - else - { - // Mounts a NeFS from main drive. - fNeFS = Kernel::mm_new_class<Kernel::NeFileSystemMgr>(); - - 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(); -} |
