diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 15:34:28 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-03 15:34:28 +0200 |
| commit | 441c1460b29f5003a5478032f17a6c5f486dd1fd (patch) | |
| tree | c74f48a17b83b62dbd9badde686e09e1bdf49f1f /dev/ZKA/Sources | |
| parent | 7fdb28714eb98d58c55324db51cc7caf97c631bf (diff) | |
[ FIX ] Almost fixed the ring-3 switch code, which currently gives an UD
error.
[ REFACTOR ] Kernel is now a EXE, instead of being a DLL.
[ FIX ] Fixed some parts of the user scheduler and kernel, cleaned it
up also.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA/Sources')
| -rw-r--r-- | dev/ZKA/Sources/CxxAbi-AMD64.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/CxxAbi-ARM64.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/DLLInterface.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/DLLMain.cxx | 38 | ||||
| -rw-r--r-- | dev/ZKA/Sources/DriveManager.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FS/NewFS.cxx | 70 | ||||
| -rw-r--r-- | dev/ZKA/Sources/IndexableProperty.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/KernelCheck.cxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/MP.cxx | 6 | ||||
| -rw-r--r-- | dev/ZKA/Sources/NewFS+FileManager.cxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/ThreadLocalStorage.cxx | 8 | ||||
| -rw-r--r-- | dev/ZKA/Sources/User.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/UserProcessScheduler.cxx | 39 |
13 files changed, 92 insertions, 89 deletions
diff --git a/dev/ZKA/Sources/CxxAbi-AMD64.cxx b/dev/ZKA/Sources/CxxAbi-AMD64.cxx index ab4f8147..0b26e9da 100644 --- a/dev/ZKA/Sources/CxxAbi-AMD64.cxx +++ b/dev/ZKA/Sources/CxxAbi-AMD64.cxx @@ -19,7 +19,7 @@ Kernel::UIntPtr __dso_handle; EXTERN_C void __cxa_pure_virtual() { - Kernel::kcout << "newoskrnl.dll: C++ placeholder method.\n"; + Kernel::kcout << "newoskrnl.exe: C++ placeholder method.\n"; } EXTERN_C void ___chkstk_ms(void) diff --git a/dev/ZKA/Sources/CxxAbi-ARM64.cxx b/dev/ZKA/Sources/CxxAbi-ARM64.cxx index 1475ae85..c11baf72 100644 --- a/dev/ZKA/Sources/CxxAbi-ARM64.cxx +++ b/dev/ZKA/Sources/CxxAbi-ARM64.cxx @@ -68,7 +68,7 @@ EXTERN_C void __cdecl _Init_thread_footer(int* const pOnce) noexcept EXTERN_C void _purecall() { - Kernel::kcout << "newoskrnl.dll: C++ placeholder method.\n"; + Kernel::kcout << "newoskrnl.exe: C++ placeholder method.\n"; } #endif // ifdef __ZKA_ARM64__ diff --git a/dev/ZKA/Sources/DLLInterface.cxx b/dev/ZKA/Sources/DLLInterface.cxx index 1c08b860..0ff6e91b 100644 --- a/dev/ZKA/Sources/DLLInterface.cxx +++ b/dev/ZKA/Sources/DLLInterface.cxx @@ -21,6 +21,6 @@ using namespace Kernel; EXTERN_C void __zka_pure_call(void) { - kcout << "newoskrnl.dll: Unimplemented entrypoint symbol!\r"; + kcout << "newoskrnl.exe: Unimplemented entrypoint symbol!\r"; UserProcessScheduler::The().CurrentProcess().Leak().Crash(); } diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx index 25be253f..8faa7a08 100644 --- a/dev/ZKA/Sources/DLLMain.cxx +++ b/dev/ZKA/Sources/DLLMain.cxx @@ -52,7 +52,7 @@ namespace Kernel::Detail { if (Kernel::FilesystemManagerInterface::GetMounted()) { - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: NewFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: NewFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); fNewFS = reinterpret_cast<Kernel::NewFilesystemManager*>(Kernel::FilesystemManagerInterface::GetMounted()); } else @@ -62,7 +62,7 @@ namespace Kernel::Detail Kernel::FilesystemManagerInterface::Mount(fNewFS); - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Mounted NewFS IFS (A:)", 10, 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Mounted NewFS IFS (A:)", 10, 10, RGB(0, 0, 0)); } const Kernel::SizeT cDirCount = 7UL; @@ -79,8 +79,8 @@ namespace Kernel::Detail if (catalogDir) { - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Catalog 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("newoskrnl.dll: Catalog directory already exists: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Catalog 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("newoskrnl.exe: Catalog directory already exists: ")), RGB(0, 0, 0)); delete catalogDir; continue; @@ -89,8 +89,8 @@ namespace Kernel::Detail catalogDir = fNewFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, kNewFSCatalogKindDir); - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Catalog 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("newoskrnl.dll: Catalog directory has been created: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Catalog 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("newoskrnl.exe: Catalog directory has been created: ")), RGB(0, 0, 0)); delete catalogDir; } @@ -102,15 +102,15 @@ namespace Kernel::Detail if (catalogDisk) { - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Catalog swap file already exists: ", 10 + (10 * (cDirCount + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, kSysPage, 10 + (10 * (cDirCount + 1)), 10 + (FONT_SIZE_X * rt_string_len("newoskrnl.dll: Catalog swap file already exists: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Catalog swap file already exists: ", 10 + (10 * (cDirCount + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, kSysPage, 10 + (10 * (cDirCount + 1)), 10 + (FONT_SIZE_X * rt_string_len("newoskrnl.exe: Catalog swap file already exists: ")), RGB(0, 0, 0)); delete catalogDisk; } else { - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Catalog swap file created: ", 10 + (10 * (cDirCount + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, kSysPage, 10 + (10 * (cDirCount + 1)), 10 + (FONT_SIZE_X * rt_string_len("newoskrnl.dll: Catalog swap file created: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Catalog swap file created: ", 10 + (10 * (cDirCount + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, kSysPage, 10 + (10 * (cDirCount + 1)), 10 + (FONT_SIZE_X * rt_string_len("newoskrnl.exe: Catalog swap file created: ")), RGB(0, 0, 0)); catalogDisk = (NFS_CATALOG_STRUCT*)this->Leak()->CreateSwapFile(kSysPage); @@ -155,6 +155,11 @@ namespace Kernel EXTERN UserProcessScheduler* cProcessScheduler; } // namespace Kernel +Kernel::Void HangCPU(Kernel::Void) +{ + while (1); +} + /// @brief Application entrypoint. /// @param Void /// @return Void @@ -181,21 +186,20 @@ EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) CG::CGDrawWindowList(&cKernelWnd, 1); - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Running System Component: ", 10, 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, kSysDrv, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("newoskrnl.dll: Running System Component: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Running System Component: ", 10, 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, kSysDrv, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("newoskrnl.exe: Running System Component: ")), RGB(0, 0, 0)); /// @note BThread doesn't parse the symbols so doesn't nullify them, .bss is though. Kernel::cProcessScheduler = nullptr; - Kernel::ProcessHelper::StartScheduling(); + Kernel::UserProcessHelper::StartScheduling(); - CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.dll: Starting ZKA System...", 20, 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "newoskrnl.exe: Starting ZKA System...", 20, 10, RGB(0, 0, 0)); - static Kernel::MainKind fn = []() -> void {while(1); }; - Kernel::sched_execute_thread(fn, "ZKA Logger"); + Kernel::sched_execute_thread(HangCPU, "HANG TEST"); while (Yes) { - Kernel::ProcessHelper::StartScheduling(); + Kernel::UserProcessHelper::StartScheduling(); } Kernel::ke_stop(RUNTIME_CHECK_BOOTSTRAP); diff --git a/dev/ZKA/Sources/DriveManager.cxx b/dev/ZKA/Sources/DriveManager.cxx index 95fbed68..84c9870f 100644 --- a/dev/ZKA/Sources/DriveManager.cxx +++ b/dev/ZKA/Sources/DriveManager.cxx @@ -139,7 +139,7 @@ namespace Kernel trait.fVerify = ke_drv_check_disk; trait.fDriveKind = io_drive_kind; - kcout << "newoskrnl.dll: Construct drive with success.\r"; + kcout << "newoskrnl.exe: Construct drive with success.\r"; return trait; } diff --git a/dev/ZKA/Sources/FS/NewFS.cxx b/dev/ZKA/Sources/FS/NewFS.cxx index 43cc22b5..bf55a56f 100644 --- a/dev/ZKA/Sources/FS/NewFS.cxx +++ b/dev/ZKA/Sources/FS/NewFS.cxx @@ -67,7 +67,7 @@ _Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* cata Lba lba = (theFork.Kind == kNewFSDataForkKind) ? catalog->DataFork : catalog->ResourceFork; - kcout << "newoskrnl.dll: fork lba: " << hex_number(lba) << endl; + kcout << "newoskrnl.exe: fork lba: " << hex_number(lba) << endl; if (lba <= kNewFSCatalogStartAddress) return nullptr; @@ -96,22 +96,22 @@ _Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* cata if (curFork.NextSibling > kBadAddress) { - kcout << "newoskrnl.dll: bad fork: " << hex_number(curFork.NextSibling) << endl; + kcout << "newoskrnl.exe: bad fork: " << hex_number(curFork.NextSibling) << endl; break; } - kcout << "newoskrnl.dll: next fork: " << hex_number(curFork.NextSibling) << endl; + kcout << "newoskrnl.exe: next fork: " << hex_number(curFork.NextSibling) << endl; if (curFork.Flags == kNewFSFlagCreated) { - kcout << "newoskrnl.dll: fork already exists.\r"; + kcout << "newoskrnl.exe: fork already exists.\r"; /// sanity check. if (StringBuilder::Equals(curFork.ForkName, theFork.ForkName) && StringBuilder::Equals(curFork.CatalogName, catalog->Name)) return nullptr; - kcout << "newoskrnl.dll: next fork: " << hex_number(curFork.NextSibling) << endl; + kcout << "newoskrnl.exe: next fork: " << hex_number(curFork.NextSibling) << endl; lbaOfPreviousFork = lba; lba = curFork.NextSibling; @@ -153,10 +153,10 @@ _Output NFS_FORK_STRUCT* NewFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* cata drv.fOutput(&drv.fPacket); /// log what we have now. - kcout << "newoskrnl.dll: Wrote fork data at: " << hex_number(theFork.DataOffset) + kcout << "newoskrnl.exe: Wrote fork data at: " << hex_number(theFork.DataOffset) << endl; - kcout << "newoskrnl.dll: Wrote fork at: " << hex_number(lba) << endl; + kcout << "newoskrnl.exe: Wrote fork at: " << hex_number(lba) << endl; return &theFork; } @@ -241,11 +241,11 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const Char* name, _Input const Int32& flags, _Input const Int32& kind) { - kcout << "newoskrnl.dll: CreateCatalog(...)\r"; + kcout << "newoskrnl.exe: CreateCatalog(...)\r"; Lba out_lba = 0UL; - kcout << "newoskrnl.dll: Checking for extension...\r"; + kcout << "newoskrnl.exe: Checking for extension...\r"; /// a directory should have a slash in the end. if (kind == kNewFSCatalogKindDir && @@ -261,7 +261,7 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const Char* name, if (catalog_copy) { - kcout << "newoskrnl.dll: Catalog already exists: " << name << ".\r"; + kcout << "newoskrnl.exe: Catalog already exists: " << name << ".\r"; ErrLocal() = kErrorFileExists; return catalog_copy; @@ -276,7 +276,7 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const Char* name, if (*parentName == 0) { - kcout << "newoskrnl.dll: Parent name is NUL.\r"; + kcout << "newoskrnl.exe: Parent name is NUL.\r"; ErrLocal() = kErrorFileNotFound; return nullptr; } @@ -308,7 +308,7 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const Char* name, if (catalog && catalog->Kind == kNewFSCatalogKindFile) { - kcout << "newoskrnl.dll: Parent name is file.\r"; + kcout << "newoskrnl.exe: Parent name is file.\r"; delete catalog; return nullptr; } @@ -433,9 +433,9 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::CreateCatalog(_Input const Char* name, drive.fOutput(&drive.fPacket); - kcout << "newoskrnl.dll: Create new catalog, status: " + kcout << "newoskrnl.exe: Create new catalog, status: " << hex_number(catalogChild->Flags) << endl; - kcout << "newoskrnl.dll: Create new catalog, name: " << catalogChild->Name + kcout << "newoskrnl.exe: Create new catalog, name: " << catalogChild->Name << endl; delete catalog; @@ -599,14 +599,14 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endL drive->fOutput(&drive->fPacket); - kcout << "newoskrnl.dll: drive kind: " << drive->fDriveKind() << endl; + kcout << "newoskrnl.exe: drive kind: " << drive->fDriveKind() << endl; - kcout << "newoskrnl.dll: partition name: " << partBlock->PartitionName << endl; - kcout << "newoskrnl.dll: start: " << hex_number(partBlock->StartCatalog) << endl; - kcout << "newoskrnl.dll: number of catalogs: " << hex_number(partBlock->CatalogCount) << endl; - kcout << "newoskrnl.dll: free catalog: " << hex_number(partBlock->FreeCatalog) << endl; - kcout << "newoskrnl.dll: free sectors: " << hex_number(partBlock->FreeSectors) << endl; - kcout << "newoskrnl.dll: sector size: " << hex_number(partBlock->SectorSize) << endl; + kcout << "newoskrnl.exe: partition name: " << partBlock->PartitionName << endl; + kcout << "newoskrnl.exe: start: " << hex_number(partBlock->StartCatalog) << endl; + kcout << "newoskrnl.exe: number of catalogs: " << hex_number(partBlock->CatalogCount) << endl; + kcout << "newoskrnl.exe: free catalog: " << hex_number(partBlock->FreeCatalog) << endl; + kcout << "newoskrnl.exe: free sectors: " << hex_number(partBlock->FreeSectors) << endl; + kcout << "newoskrnl.exe: sector size: " << hex_number(partBlock->SectorSize) << endl; // write the root catalog. this->CreateCatalog(kNewFSRoot, 0, kNewFSCatalogKindDir); @@ -614,7 +614,7 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endL return true; } - kcout << "newoskrnl.dll: partition block already exists.\r"; + kcout << "newoskrnl.exe: partition block already exists.\r"; start += partBlock->DiskSize; @@ -659,7 +659,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool { ErrLocal() = kErrorDiskIsCorrupted; - kcout << "newoskrnl.dll: Invalid fork offset.\r"; + kcout << "newoskrnl.exe: Invalid fork offset.\r"; return false; } @@ -688,7 +688,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool drive.fPacket.fPacketSize = sizeOfData; drive.fPacket.fLba = startFork + sizeof(NFS_FORK_STRUCT); - kcout << "newoskrnl.dll: data offset: " << hex_number(forkDataIn->DataOffset) << endl; + kcout << "newoskrnl.exe: data offset: " << hex_number(forkDataIn->DataOffset) << endl; drive.fOutput(&drive.fPacket); @@ -698,7 +698,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool drive.fOutput(&drive.fPacket); - kcout << "newoskrnl.dll: wrote fork at offset: " << hex_number(forkDataIn->DataOffset) << endl; + kcout << "newoskrnl.exe: wrote fork at offset: " << hex_number(forkDataIn->DataOffset) << endl; delete catalog; @@ -721,7 +721,7 @@ bool NewFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool _Output NFS_CATALOG_STRUCT* NewFSParser::FindCatalog(_Input const Char* catalogName, Lba& out_lba) { - kcout << "newoskrnl.dll: start finding catalog...\r"; + kcout << "newoskrnl.exe: start finding catalog...\r"; NFS_ROOT_PARTITION_BLOCK fs_buf{0}; auto drive = sMountpointInterface.A(); @@ -789,7 +789,7 @@ _Output NFS_CATALOG_STRUCT* NewFSParser::FindCatalog(_Input const Char* catalogN } } - kcout << "newoskrnl.dll: fetching catalog...\r"; + kcout << "newoskrnl.exe: fetching catalog...\r"; NewFSSearchThroughCatalogList: while (drive.fPacket.fPacketGood) @@ -813,8 +813,8 @@ NewFSSearchThroughCatalogList: NFS_CATALOG_STRUCT* catalogPtr = new NFS_CATALOG_STRUCT(); rt_copy_memory(catalog, catalogPtr, sizeof(NFS_CATALOG_STRUCT)); - kcout << "newoskrnl.dll: found catalog at: " << hex_number(startCatalogList) << endl; - kcout << "newoskrnl.dll: found catalog at: " << catalog->Name << endl; + kcout << "newoskrnl.exe: found catalog at: " << hex_number(startCatalogList) << endl; + kcout << "newoskrnl.exe: found catalog at: " << catalog->Name << endl; out_lba = startCatalogList; return catalogPtr; @@ -944,7 +944,7 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Lba dataForkLba = (!isRsrcFork) ? catalog->DataFork : catalog->ResourceFork; Size dataForkSize = (!isRsrcFork) ? catalog->DataForkSize : catalog->ResourceForkSize; - kcout << "newoskrnl.dll: catalog " << catalog->Name + kcout << "newoskrnl.exe: catalog " << catalog->Name << ", fork: " << hex_number(dataForkLba) << endl; NFS_FORK_STRUCT* fs_buf = new NFS_FORK_STRUCT(); @@ -965,8 +965,8 @@ VoidPtr NewFSParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, fs_fork_data = fs_buf; - kcout << "newoskrnl.dll: ForkName: " << fs_fork_data->ForkName << endl; - kcout << "newoskrnl.dll: CatalogName: " << fs_fork_data->CatalogName << endl; + kcout << "newoskrnl.exe: ForkName: " << fs_fork_data->ForkName << endl; + kcout << "newoskrnl.exe: CatalogName: " << fs_fork_data->CatalogName << endl; if (StringBuilder::Equals(forkName, fs_fork_data->ForkName) && StringBuilder::Equals(catalog->Name, fs_fork_data->CatalogName)) @@ -1028,18 +1028,18 @@ namespace Kernel::Detail /***********************************************************************************/ Boolean fs_init_newfs(Void) noexcept { - kcout << "newoskrnl.dll: Creating drives...\r"; + kcout << "newoskrnl.exe: Creating drives...\r"; sMountpointInterface.A() = io_construct_main_drive(); sMountpointInterface.B() = io_construct_drive(); sMountpointInterface.C() = io_construct_drive(); sMountpointInterface.D() = io_construct_drive(); - kcout << "newoskrnl.dll: Testing main drive...\r"; + kcout << "newoskrnl.exe: Testing main drive...\r"; sMountpointInterface.A().fVerify(&sMountpointInterface.A().fPacket); - kcout << "newoskrnl.dll: Testing main drive [ OK ]...\r"; + kcout << "newoskrnl.exe: Testing main drive [ OK ]...\r"; return true; } diff --git a/dev/ZKA/Sources/IndexableProperty.cxx b/dev/ZKA/Sources/IndexableProperty.cxx index e63a7a63..84aabc6b 100644 --- a/dev/ZKA/Sources/IndexableProperty.cxx +++ b/dev/ZKA/Sources/IndexableProperty.cxx @@ -52,7 +52,7 @@ namespace Kernel indexer.AddFlag(kIndexerClaimed); rt_copy_memory((VoidPtr)indexer.Leak().Path, (VoidPtr)filename, filenameLen); - kcout << "newoskrnl.dll: filesystem: index new file: " << filename << endl; + kcout << "newoskrnl.exe: filesystem: index new file: " << filename << endl; } } } // namespace Indexer diff --git a/dev/ZKA/Sources/KernelCheck.cxx b/dev/ZKA/Sources/KernelCheck.cxx index 4ef8a933..a05c265a 100644 --- a/dev/ZKA/Sources/KernelCheck.cxx +++ b/dev/ZKA/Sources/KernelCheck.cxx @@ -39,7 +39,7 @@ namespace Kernel auto start_y = 10; auto x = 10; - CGDrawString("newoskrnl.dll Stopped working properly so it had to stop.", start_y, x, panicTxt); + CGDrawString("newoskrnl.exe Stopped working properly so it had to stop.", start_y, x, panicTxt); start_y += 10; // simply offset from previous string and then write the website. @@ -125,7 +125,7 @@ namespace Kernel HardwareTimer timer(cMaxSeconds); timer.Wait(); - kcout << "newoskrnl.dll: Shutting down computer...\r"; + kcout << "newoskrnl.exe: Shutting down computer...\r"; PowerFactoryInterface power(nullptr); power.Shutdown(); diff --git a/dev/ZKA/Sources/MP.cxx b/dev/ZKA/Sources/MP.cxx index 5b44a119..23916a2f 100644 --- a/dev/ZKA/Sources/MP.cxx +++ b/dev/ZKA/Sources/MP.cxx @@ -103,7 +103,7 @@ namespace Kernel return mp_register_process(fStack); } - kcout << "newoskrnl: Switching now...\r"; + //! SMP is disabled here. mp_do_context_switch_pre(); return mp_do_context_switch(image, stack_ptr, fStack) != 0; @@ -123,12 +123,12 @@ namespace Kernel ///! @brief Default constructor. HardwareThreadScheduler::HardwareThreadScheduler() { - kcout << "newoskrnl.dll: initializing HardwareThreadScheduler." << endl; + kcout << "newoskrnl.exe: initializing HardwareThreadScheduler." << endl; cSMPCoreName.GetKey() += "Property\\MPClass"; cSMPCoreName.GetValue() = (PropertyId)this; - kcout << "newoskrnl.dll: initialized HardwareThreadScheduler." << endl; + kcout << "newoskrnl.exe: initialized HardwareThreadScheduler." << endl; } ///! @brief Default destructor. diff --git a/dev/ZKA/Sources/NewFS+FileManager.cxx b/dev/ZKA/Sources/NewFS+FileManager.cxx index d6d7a826..98e0e3af 100644 --- a/dev/ZKA/Sources/NewFS+FileManager.cxx +++ b/dev/ZKA/Sources/NewFS+FileManager.cxx @@ -20,12 +20,12 @@ namespace Kernel MUST_PASS(Detail::fs_init_newfs()); fImpl = new NewFSParser(); - kcout << "newoskrnl.dll: We are done here... (NewFilesystemManager).\r"; + kcout << "newoskrnl.exe: We are done here... (NewFilesystemManager).\r"; } NewFilesystemManager::~NewFilesystemManager() { - kcout << "newoskrnl.dll: Destroying it...\r"; + kcout << "newoskrnl.exe: Destroying it...\r"; if (fImpl) { diff --git a/dev/ZKA/Sources/ThreadLocalStorage.cxx b/dev/ZKA/Sources/ThreadLocalStorage.cxx index c8befa98..3a60f36c 100644 --- a/dev/ZKA/Sources/ThreadLocalStorage.cxx +++ b/dev/ZKA/Sources/ThreadLocalStorage.cxx @@ -72,7 +72,7 @@ Boolean tls_check_tib(THREAD_INFORMATION_BLOCK* the_tib) Encoder encoder; const char* tibAsBytes = encoder.AsBytes(the_tib); - kcout << "newoskrnl.dll: checking for a valid cookie inside the TIB...\r"; + kcout << "newoskrnl.exe: checking for a valid cookie inside the TIB...\r"; return tibAsBytes[0] == kCookieMag0 && tibAsBytes[1] == kCookieMag1 && tibAsBytes[2] == kCookieMag2; @@ -87,7 +87,7 @@ EXTERN_C Bool tls_check_syscall_impl(Kernel::VoidPtr tib_ptr) noexcept { if (!tib_ptr) { - kcout << "newoskrnl.dll: failing because of an invalid TIB...\r"; + kcout << "newoskrnl.exe: failing because of an invalid TIB...\r"; return false; } @@ -95,10 +95,10 @@ EXTERN_C Bool tls_check_syscall_impl(Kernel::VoidPtr tib_ptr) noexcept if (!tls_check_tib(tib_struct)) { - kcout << "newoskrnl.dll: crashing because of an invalid TIB...\r"; + kcout << "newoskrnl.exe: crashing because of an invalid TIB...\r"; return false; } - kcout << "newoskrnl.dll: Verification succeeded! staying alive...\r"; + kcout << "newoskrnl.exe: Verification succeeded! staying alive...\r"; return true; } diff --git a/dev/ZKA/Sources/User.cxx b/dev/ZKA/Sources/User.cxx index cb907387..5a4c2335 100644 --- a/dev/ZKA/Sources/User.cxx +++ b/dev/ZKA/Sources/User.cxx @@ -100,7 +100,7 @@ namespace Kernel delete[] password; password = nullptr; - kcout << "newoskrnl.dll: Saved password...\r"; + kcout << "newoskrnl.exe: Saved password...\r"; return true; } diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx index c20c6054..cd8ec150 100644 --- a/dev/ZKA/Sources/UserProcessScheduler.cxx +++ b/dev/ZKA/Sources/UserProcessScheduler.cxx @@ -48,18 +48,16 @@ namespace Kernel /// @brief crash current process. /***********************************************************************************/ - void UserProcess::Crash() + Void UserProcess::Crash() { - constexpr auto cUnknownProcess = "?"; + if (this->Name == 0) + return; - kcout << (*this->Name == 0 ? cUnknownProcess : this->Name) << ": crashed. (id = " << number(kErrorProcessFault); - kcout << ")\r"; - - this->Status = ProcessStatus::kDead; + kcout << this->Name << ": crashed. (id = " << number(kErrorProcessFault) << endl; this->Exit(kErrorProcessFault); - ProcessHelper::StartScheduling(); + UserProcessHelper::StartScheduling(); } /// @brief Gets the local last exit code. @@ -186,6 +184,8 @@ namespace Kernel */ void UserProcess::Exit(const Int32& exit_code) { + this->Status = ProcessStatus::kDead; + fLastExitCode = exit_code; cLastExitCode = exit_code; @@ -260,7 +260,7 @@ namespace Kernel if (!process.StackReserve) { process.StackReserve = (UInt8*)mm_new_ke_heap(kSchedMaxStackSz, Yes, Yes); - kcout << "newoskrnl.dll: Use fallback reserve.\r"; + kcout << "newoskrnl.exe: Use fallback reserve.\r"; } } else @@ -331,7 +331,7 @@ namespace Kernel auto& process = mTeam.AsArray()[process_index]; //! check if process needs to be scheduled. - if (ProcessHelper::CanBeScheduled(process)) + if (UserProcessHelper::CanBeScheduled(process)) { // set the current process. mTeam.AsRef() = process; @@ -341,7 +341,7 @@ namespace Kernel kcout << process.Name << ": will be runned.\r"; // tell helper to find a core to schedule on. - if (!ProcessHelper::Switch(process.Image, &process.StackReserve[process.StackSize - 1], process.StackFrame, + if (!UserProcessHelper::Switch(process.Image, &process.StackReserve[process.StackSize - 1], process.StackFrame, process.ProcessId)) { process.Crash(); @@ -379,9 +379,9 @@ namespace Kernel /// @brief Current proccess id getter. /// @return UserProcess ID integer. - PID& ProcessHelper::TheCurrentPID() + PID& UserProcessHelper::TheCurrentPID() { - kcout << "ProcessHelper::TheCurrentPID: Leaking ProcessId...\r"; + kcout << "UserProcessHelper::TheCurrentPID: Leaking ProcessId...\r"; return cProcessScheduler->CurrentProcess().Leak().ProcessId; } @@ -389,7 +389,7 @@ namespace Kernel /// @param process the process reference. /// @retval true can be schedulded. /// @retval false cannot be schedulded. - bool ProcessHelper::CanBeScheduled(UserProcess& process) + bool UserProcessHelper::CanBeScheduled(UserProcess& process) { if (process.Status == ProcessStatus::kFrozen || process.Status == ProcessStatus::kDead) @@ -401,7 +401,6 @@ namespace Kernel start) { process.Image = start; - process.StackFrame->BP = reinterpret_cast<HAL::Reg>(start); } } @@ -412,14 +411,14 @@ namespace Kernel * @brief Scheduler helper class. */ - SizeT ProcessHelper::StartScheduling() + SizeT UserProcessHelper::StartScheduling() { if (!cProcessScheduler) { cProcessScheduler = new UserProcessScheduler(); MUST_PASS(cProcessScheduler); - kcout << "newoskrnl.dll: Team capacity: " << number(cProcessScheduler->CurrentTeam().AsArray().Capacity()) << endl; + kcout << "newoskrnl.exe: Team capacity: " << number(cProcessScheduler->CurrentTeam().AsArray().Capacity()) << endl; } SizeT ret = cProcessScheduler->Run(); @@ -432,12 +431,12 @@ namespace Kernel * \param new_pid the process's PID. */ - bool ProcessHelper::Switch(VoidPtr image_ptr, UInt8* stack, HAL::StackFramePtr frame_ptr, const PID& new_pid) + bool UserProcessHelper::Switch(VoidPtr image_ptr, UInt8* stack, HAL::StackFramePtr frame_ptr, const PID& new_pid) { if (!stack || !frame_ptr || !image_ptr || new_pid < 0) return false; - kcout << "newoskrnl.dll: Finding hardware thread...\r"; + kcout << "newoskrnl.exe: Finding hardware thread...\r"; for (SizeT index = 0UL; index < HardwareThreadScheduler::The().Count(); ++index) { @@ -454,9 +453,9 @@ namespace Kernel { HardwareThreadScheduler::The()[index].Leak()->Busy(true); - ProcessHelper::TheCurrentPID() = new_pid; + UserProcessHelper::TheCurrentPID() = new_pid; - kcout << "newoskrnl.dll: Found hardware thread...\r"; + kcout << "newoskrnl.exe: Found hardware thread...\r"; bool ret = HardwareThreadScheduler::The()[index].Leak()->Switch(image_ptr, stack, frame_ptr); |
