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 | |
| 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')
36 files changed, 179 insertions, 190 deletions
diff --git a/dev/ZKA/CompilerKit/Version.hxx b/dev/ZKA/CompilerKit/Version.hxx index edff10c5..83f7f534 100644 --- a/dev/ZKA/CompilerKit/Version.hxx +++ b/dev/ZKA/CompilerKit/Version.hxx @@ -1,4 +1,5 @@ #pragma once -#define BOOTLOADER_VERSION "VERSION: v1.14.2" -#define KERNEL_VERSION "VERSION: v1.14.2" +/// <COMMIT NUMBER>.<YEAR>.<PROGRAM VERSION> +#define BOOTLOADER_VERSION "843.2024.1" +#define KERNEL_VERSION "843.2024.1" diff --git a/dev/ZKA/HALKit/AMD64/HalControlRegister.s b/dev/ZKA/HALKit/AMD64/HalControlRegister.s index 11c52ff3..76053921 100644 --- a/dev/ZKA/HALKit/AMD64/HalControlRegister.s +++ b/dev/ZKA/HALKit/AMD64/HalControlRegister.s @@ -28,7 +28,7 @@ hal_read_cr0: ret hal_read_cr2: - movq %cr3, %rax + movq %cr2, %rax ret hal_write_cr3: @@ -36,5 +36,5 @@ hal_write_cr3: ret hal_write_cr0: - movq %rcx, %cr3 + movq %rcx, %cr0 ret diff --git a/dev/ZKA/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx b/dev/ZKA/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx index 1101e5e2..611ec596 100644 --- a/dev/ZKA/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx +++ b/dev/ZKA/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx @@ -54,12 +54,12 @@ EXTERN_C Kernel::Void hal_system_call_enter(Kernel::UIntPtr rcx, Kernel::UIntPtr { if (rcx <= (kSyscalls.Count() - 1)) { - Kernel::kcout << "newoskrnl.dll: syscall: enter.\r"; + Kernel::kcout << "newoskrnl.exe: syscall: enter.\r"; if (kSyscalls[rcx].fHooked) (kSyscalls[rcx].fProc)((Kernel::VoidPtr)rdx); - Kernel::kcout << "newoskrnl.dll: syscall: exit.\r"; + Kernel::kcout << "newoskrnl.exe: syscall: exit.\r"; } } @@ -70,11 +70,11 @@ EXTERN_C Kernel::Void hal_kernel_call_enter(Kernel::UIntPtr rcx, Kernel::UIntPtr { if (rcx <= (kSyscalls.Count() - 1)) { - Kernel::kcout << "newoskrnl.dll: kerncall: enter.\r"; + Kernel::kcout << "newoskrnl.exe: kerncall: enter.\r"; if (kKerncalls[rcx].fHooked) (kKerncalls[rcx].fProc)((Kernel::VoidPtr)rdx); - Kernel::kcout << "newoskrnl.dll: kerncall: exit.\r"; + Kernel::kcout << "newoskrnl.exe: kerncall: exit.\r"; } } diff --git a/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx b/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx index 9a7e276c..2e76d73a 100644 --- a/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx +++ b/dev/ZKA/HALKit/AMD64/HalCoreMPScheduler.cxx @@ -191,7 +191,7 @@ namespace Kernel::HAL cSMPInterrupt = 0; kSMPCount = 0; - kcout << "newoskrnl.dll: Probing MADT cores...\r"; + kcout << "newoskrnl.exe: Probing MADT cores...\r"; UIntPtr madt_address = kMADTBlock->Address; @@ -205,13 +205,13 @@ namespace Kernel::HAL { case 0x00: { cSMPCores[index] = kMADTBlock->List[index].LAPIC.ProcessorID; - kcout << "newoskrnl.dll: Core ID: " << number(cSMPCores[index]) << endl; + kcout << "newoskrnl.exe: Core ID: " << number(cSMPCores[index]) << endl; ++kSMPCount; break; } case 0x05: { madt_address = kMADTBlock->List[index].LAPIC_ADDRESS_OVERRIDE.Address; - kcout << "newoskrnl.dll: Address: " << number(madt_address) << endl; + kcout << "newoskrnl.exe: Address: " << number(madt_address) << endl; break; } } @@ -219,7 +219,7 @@ namespace Kernel::HAL ++index; } - kcout << "newoskrnl.dll: # of cores: " << number(kSMPCount) << endl; + kcout << "newoskrnl.exe: # of cores: " << number(kSMPCount) << endl; // Kernel is now SMP aware. // That means that the scheduler is now available (on MP Kernels) diff --git a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx index af767938..d99431fa 100644 --- a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx +++ b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx @@ -20,14 +20,6 @@ #include <CFKit/Property.hxx> #include <Modules/CoreCG/TextRenderer.hxx> -Kernel::Property cKernelVersion; - -Kernel::User cUserSuper{Kernel::RingKind::kRingSuperUser, kSuperUser}; - -EXTERN Kernel::Boolean kAllocationInProgress; - -EXTERN_C Kernel::VoidPtr kInterruptVectorTable[]; - struct HEAP_ALLOC_INFO final { Kernel::VoidPtr fThe; @@ -61,32 +53,37 @@ namespace Kernel::HAL EXTERN void mp_get_cores(Kernel::voidPtr rsdPtr) noexcept; } // namespace Kernel::HAL -/* GDT, mostly descriptors for user and kernel segments. */ -STATIC Kernel::HAL::Detail::ZKA_GDT_ENTRY cGdt[9] = { - {.fLimitLow = 0, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fGranularity = 0x00, .fBaseHigh = 0}, // Null entry - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x9A, .fGranularity = 0xA0, .fBaseHigh = 0}, // Kernel code - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x92, .fGranularity = 0xA0, .fBaseHigh = 0}, // Kernel data - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xFA, .fGranularity = 0xA0, .fBaseHigh = 0}, // User code - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fGranularity = 0xA0, .fBaseHigh = 0}, // User data - // reserve them for later. - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fGranularity = 0xA0, .fBaseHigh = 0}, // User data - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fGranularity = 0xA0, .fBaseHigh = 0}, // User data - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fGranularity = 0xA0, .fBaseHigh = 0}, // User data - {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fGranularity = 0xA0, .fBaseHigh = 0}, // User data -}; +Kernel::Property cKernelVersion; +Kernel::User cUserSuper{Kernel::RingKind::kRingSuperUser, kSuperUser}; + +EXTERN Kernel::Boolean kAllocationInProgress; +EXTERN_C Kernel::VoidPtr kInterruptVectorTable[]; Kernel::Void hal_real_init(Kernel::Void) noexcept; EXTERN_C void hal_user_code_start(void); EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void); + +/* GDT, mostly descriptors for user and kernel segments. */ +STATIC Kernel::HAL::Detail::ZKA_GDT_ENTRY cGdt[9] = { + {.fLimitLow = 0, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // Null entry + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x9A, .fFlags = 0xA0, .fBaseHigh = 0}, // Kernel code + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x92, .fFlags = 0xA0, .fBaseHigh = 0}, // Kernel data + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xFA, .fFlags = 0xA0, .fBaseHigh = 0}, // User code + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0xF2, .fFlags = 0xA0, .fBaseHigh = 0}, // User data + // reserve them for later. + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // User data + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // User data + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // User data + {.fLimitLow = 0xFFFF, .fBaseLow = 0, .fBaseMid = 0, .fAccessByte = 0x00, .fFlags = 0x00, .fBaseHigh = 0}, // User data +}; + EXTERN_C void hal_init_platform( Kernel::HEL::HandoverInformationHeader* HandoverHeader) { /* Setup globals. */ - sizeof(Kernel::HAL::Detail::ZKA_GDT_ENTRY); - kHandoverHeader = HandoverHeader; if (kHandoverHeader->f_Magic != kHandoverMagic && @@ -137,7 +134,7 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept if (kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled) Kernel::HAL::mp_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr); - Kernel::kcout << "newoskrnl.dll: Creating filesystem and such.\r"; + Kernel::kcout << "newoskrnl.exe: Creating filesystem and such.\r"; auto fs = new Kernel::NewFilesystemManager(); diff --git a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm index 221cd05e..ac68dfad 100644 --- a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm +++ b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm @@ -21,22 +21,21 @@ section .text ;; rcx: code ptr. ;; rdx: stack ptr. mp_do_context_switch: - jmp mp_jump_user_mode -mp_jump_user_mode: - mov r11, 0x0202 - mov r13, rdx - mov r12, rcx + mov r9, [r8 + (8 * 2)] + mov r10, [r8 + (8 * 3)] + mov fs, [r8 + (8 * 4)] + mov r12, [r8 + (8 * 5)] + mov r13, [r8 + (8 * 6)] + mov r14, [r8 + (8 * 7)] + mov r15, [r8 + (8 * 8)] + mov gs, [r8 + (8 * 9)] + mov r8, [r8] - mov eax, 0x23 - mov ds, eax - mov gs, eax - mov es, eax - mov fs, eax + mov r11, 0x202 + mov rsp, rdx - mov rcx, r12 - mov rsp, r13 - - o64 sysret + xor rax, rax + o64 sysret ;; @brief Gets the current stack frame. mp_get_current_context: @@ -46,8 +45,6 @@ mp_get_current_context: extern hal_system_call_enter mp_system_call_handler: - cli - push r8 push r9 push r10 @@ -58,21 +55,23 @@ mp_system_call_handler: pop r9 pop r8 - sti sysret mp_do_context_switch_pre: - ; Enable SCE that enables sysret and syscall + + xor rdx, rdx + mov rax, 0x202 + mov rcx, 0xc0000084 + wrmsr + xor rax, rax mov rax, mp_system_call_handler + mov rdx, rax + shr rdx, 32 mov rcx, 0xc0000082 wrmsr - mov rcx, 0xc0000080 - rdmsr - or eax, 1 + xor rax, rax + mov rdx, 0x230008 + mov rcx, 0xc0000081 wrmsr - mov rcx, 0xc0000081 - rdmsr - mov edx, 0x00180008 - wrmsr - - ret
\ No newline at end of file + + ret diff --git a/dev/ZKA/HALKit/AMD64/HalPageAlloc.hxx b/dev/ZKA/HALKit/AMD64/HalPageAlloc.hxx index 11a267e2..aadabd9c 100644 --- a/dev/ZKA/HALKit/AMD64/HalPageAlloc.hxx +++ b/dev/ZKA/HALKit/AMD64/HalPageAlloc.hxx @@ -31,7 +31,7 @@ #endif // !kAlign EXTERN_C void hal_flush_tlb(); -EXTERN_C void hal_write_cr3(Kernel::UIntPtr pde); +EXTERN_C void hal_write_cr3(Kernel::UIntPtr phys_addr); EXTERN_C void hal_write_cr0(Kernel::UIntPtr bit); EXTERN_C Kernel::VoidPtr hal_read_cr0(); // @brief CPU control register. diff --git a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx index 706bd5bd..94d989e7 100644 --- a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx +++ b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx @@ -24,9 +24,6 @@ namespace Kernel::HAL if (pte) { - if (flags & eFlagsSetPhysAddress) - pte->PhysicalAddress = (UIntPtr)phys_addr >> 12; - if (flags & eFlagsPresent) pte->Present = flags & eFlagsPresent; diff --git a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx index 4fa8c019..7b1f1711 100644 --- a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx +++ b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx @@ -26,9 +26,6 @@ namespace Kernel if (!stack_ptr) return false; - if (stack_ptr->BP == 0 || stack_ptr->SP == 0) - return false; - return true; } @@ -36,7 +33,7 @@ namespace Kernel /// Wakes up thread from the hang state. Void mp_wakeup_thread(HAL::StackFrame* stack) { - mp_do_context_switch((VoidPtr)stack->BP, (UInt8*)stack->SP, stack); + Kernel::UserProcessHelper::StartScheduling(); } /// @brief makes the thread sleep on a loop. diff --git a/dev/ZKA/HALKit/AMD64/Processor.hxx b/dev/ZKA/HALKit/AMD64/Processor.hxx index edbc6ae5..911af46e 100644 --- a/dev/ZKA/HALKit/AMD64/Processor.hxx +++ b/dev/ZKA/HALKit/AMD64/Processor.hxx @@ -110,13 +110,12 @@ namespace Kernel::HAL UIntPtr R8{0}; UIntPtr R9{0}; UIntPtr R10{0}; - UIntPtr R11{0}; // not tied to r11, rax this time! + UIntPtr FS{0}; UIntPtr R12{0}; UIntPtr R13{0}; UIntPtr R14{0}; UIntPtr R15{0}; - UIntPtr BP{0}; - UIntPtr SP{0}; + UIntPtr GS{0}; }; typedef StackFrame* StackFramePtr; @@ -241,7 +240,7 @@ namespace Kernel::HAL UInt16 fBaseLow; UInt8 fBaseMid; UInt8 fAccessByte; - UInt8 fGranularity; + UInt8 fFlags; UInt8 fBaseHigh; }; } // namespace Detail diff --git a/dev/ZKA/HALKit/AMD64/Storage/AHCI.cxx b/dev/ZKA/HALKit/AMD64/Storage/AHCI.cxx index 4fefee46..889b8c39 100644 --- a/dev/ZKA/HALKit/AMD64/Storage/AHCI.cxx +++ b/dev/ZKA/HALKit/AMD64/Storage/AHCI.cxx @@ -63,7 +63,7 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented) { if (ports_implemented) { - kcout << "newoskrnl.dll: Port is implemented by host.\r"; + kcout << "newoskrnl.exe: Port is implemented by host.\r"; UInt8 ipm = (mem_ahci->Ports[ahci_index].Ssts >> 8) & 0x0F; UInt8 det = mem_ahci->Ports[ahci_index].Ssts & 0x0F; @@ -72,8 +72,8 @@ Kernel::Boolean drv_std_init(Kernel::UInt16& PortsImplemented) det == cAhciPresent && ipm == cAhciIPMActive) { - kcout << "newoskrnl.dll: Found AHCI controller.\r"; - kcout << "newoskrnl.dll: Device is of SATA type.\r"; + kcout << "newoskrnl.exe: Found AHCI controller.\r"; + kcout << "newoskrnl.exe: Device is of SATA type.\r"; detected = true; diff --git a/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx b/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx index 35773924..996b93ee 100644 --- a/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx +++ b/dev/ZKA/HALKit/AMD64/Storage/ATA-PIO.cxx @@ -68,7 +68,7 @@ Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster) drv_std_select(IO); - Kernel::kcout << "newoskrnl.dll: Initializing drive...\r"; + Kernel::kcout << "newoskrnl.exe: Initializing drive...\r"; ATAInit_Retry: // Bus init, NEIN bit. @@ -80,7 +80,7 @@ ATAInit_Retry: if (statRdy & ATA_SR_ERR) { - Kernel::kcout << "newoskrnl.dll: Failing drive...\r"; + Kernel::kcout << "newoskrnl.exe: Failing drive...\r"; return false; } @@ -107,7 +107,7 @@ ATAInit_Retry: OutMaster = (Bus == ATA_PRIMARY_IO) ? ATA_MASTER : ATA_SLAVE; - Kernel::kcout << "newoskrnl.dll: Create ATA module.\r"; + Kernel::kcout << "newoskrnl.exe: Create ATA module.\r"; return true; } diff --git a/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx b/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx index 6bb3d7b4..52e4f1ee 100644 --- a/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx +++ b/dev/ZKA/HALKit/ARM64/HalKernelMain.cxx @@ -94,7 +94,7 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept else Kernel::HAL::mp_get_cores(nullptr); - Kernel::kcout << "newoskrnl.dll: Creating filesystem and such.\r"; + Kernel::kcout << "newoskrnl.exe: Creating filesystem and such.\r"; auto fs = new Kernel::NewFilesystemManager(); diff --git a/dev/ZKA/HALKit/ARM64/Processor.hxx b/dev/ZKA/HALKit/ARM64/Processor.hxx index be4e7e3e..1880d36c 100644 --- a/dev/ZKA/HALKit/ARM64/Processor.hxx +++ b/dev/ZKA/HALKit/ARM64/Processor.hxx @@ -37,8 +37,6 @@ namespace Kernel::HAL Reg R13{0}; Reg R14{0}; Reg R15{0}; - Reg BP{0}; - Reg SP{0}; }; typedef StackFrame* StackFramePtr; diff --git a/dev/ZKA/HALKit/ARM64/Storage/HalFlash.cxx b/dev/ZKA/HALKit/ARM64/Storage/HalFlash.cxx index 53238609..97950a78 100644 --- a/dev/ZKA/HALKit/ARM64/Storage/HalFlash.cxx +++ b/dev/ZKA/HALKit/ARM64/Storage/HalFlash.cxx @@ -53,13 +53,13 @@ namespace Kernel /// @brief Enable flash memory at slot. STATIC Void drv_enable_flash(Int32 arg) { - kcout << "newoskrnl.dll: Enabled FLSH hardware.\r"; + kcout << "newoskrnl.exe: Enabled FLSH hardware.\r"; } /// @brief Disable flash memory at slot. STATIC Void drv_disable_flash(Int32 arg) { - kcout << "newoskrnl.dll: Disabled FLSH hardware.\r"; + kcout << "newoskrnl.exe: Disabled FLSH hardware.\r"; } } // namespace Kernel diff --git a/dev/ZKA/HALKit/AXP/CoreSyscallHandlerDEC.cpp b/dev/ZKA/HALKit/AXP/CoreSyscallHandlerDEC.cpp index 148fa020..5f71380d 100644 --- a/dev/ZKA/HALKit/AXP/CoreSyscallHandlerDEC.cpp +++ b/dev/ZKA/HALKit/AXP/CoreSyscallHandlerDEC.cpp @@ -14,11 +14,11 @@ EXTERN_C void rt_syscall_handle(Kernel::HAL::StackFrame* stack) { if (stack->Rcx <= (kSyscalls.Count() - 1)) { - Kernel::kcout << "newoskrnl.dll: syscall: enter.\r"; + Kernel::kcout << "newoskrnl.exe: syscall: enter.\r"; if (kSyscalls[stack->Rcx].Leak().Leak().fHooked) (kSyscalls[stack->Rcx].Leak().Leak().fProc)(stack); - Kernel::kcout << "newoskrnl.dll: syscall: exit.\r"; + Kernel::kcout << "newoskrnl.exe: syscall: exit.\r"; } } diff --git a/dev/ZKA/HALKit/POWER/Processor.hxx b/dev/ZKA/HALKit/POWER/Processor.hxx index ca11bf08..75922d88 100644 --- a/dev/ZKA/HALKit/POWER/Processor.hxx +++ b/dev/ZKA/HALKit/POWER/Processor.hxx @@ -29,8 +29,6 @@ namespace Kernel::HAL Reg R13{0}; Reg R14{0}; Reg R15{0}; - Reg BP{0}; - Reg SP{0}; }; typedef StackFrame* StackFramePtr; diff --git a/dev/ZKA/KernelKit/DriveManager.hxx b/dev/ZKA/KernelKit/DriveManager.hxx index fa700907..96fbd95d 100644 --- a/dev/ZKA/KernelKit/DriveManager.hxx +++ b/dev/ZKA/KernelKit/DriveManager.hxx @@ -116,7 +116,7 @@ namespace Kernel return &mD; default: { ErrLocal() = kErrorNoSuchDisk; - kcout << "newoskrnl.dll: No such disk.\n"; + kcout << "newoskrnl.exe: No such disk.\n"; break; } diff --git a/dev/ZKA/KernelKit/FileManager.hxx b/dev/ZKA/KernelKit/FileManager.hxx index 32295241..05f74a63 100644 --- a/dev/ZKA/KernelKit/FileManager.hxx +++ b/dev/ZKA/KernelKit/FileManager.hxx @@ -408,7 +408,7 @@ namespace Kernel } } - kcout << "newoskrnl.dll: new file: " << path << ".\r"; + kcout << "newoskrnl.exe: new file: " << path << ".\r"; } /// @brief destructor diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index 7a7d200e..c779a8c6 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -31,7 +31,7 @@ namespace Kernel class PEFDLLInterface; class UserProcessTeam; class UserProcessScheduler; - class ProcessHelper; + class UserProcessHelper; //! @brief UserProcess identifier. typedef Int64 ProcessID; @@ -221,7 +221,7 @@ namespace Kernel Int32 fLocalCode{0}; friend UserProcessScheduler; - friend ProcessHelper; + friend UserProcessHelper; }; /// \brief Processs Team (contains multiple processes inside it.) @@ -283,7 +283,7 @@ namespace Kernel * \brief UserProcess helper class, which contains needed utilities for the scheduler. */ - class ProcessHelper final + class UserProcessHelper final { public: STATIC bool Switch(VoidPtr image_ptr, UInt8* stack_ptr, HAL::StackFramePtr frame_ptr, const PID& new_pid); diff --git a/dev/ZKA/KernelRsrc.rsrc b/dev/ZKA/KernelRsrc.rsrc index db09c394..dd476da2 100644 --- a/dev/ZKA/KernelRsrc.rsrc +++ b/dev/ZKA/KernelRsrc.rsrc @@ -9,12 +9,12 @@ BEGIN BLOCK "080904E4" BEGIN VALUE "CompanyName", "ZKA Technologies." - VALUE "FileDescription", "ZKA Kernel DLL." + VALUE "FileDescription", "ZKA Kernel and System." VALUE "FileVersion", KERNEL_VERSION VALUE "InternalName", "newoskrnl" VALUE "LegalCopyright", "(c) ZKA Technologies, all rights reserved." - VALUE "OriginalFilename", "newoskrnl.dll" - VALUE "ProductName", "newoskrnl" + VALUE "OriginalFilename", "newoskrnl.exe" + VALUE "ProductName", "ZKA Operating System" VALUE "ProductVersion", KERNEL_VERSION END END diff --git a/dev/ZKA/NetworkKit/NetworkDevice.inl b/dev/ZKA/NetworkKit/NetworkDevice.inl index 9fa34298..0ae5d9c6 100644 --- a/dev/ZKA/NetworkKit/NetworkDevice.inl +++ b/dev/ZKA/NetworkKit/NetworkDevice.inl @@ -15,7 +15,7 @@ namespace Kernel void (*on_cleanup)(void)) : DeviceInterface<NetworkDeviceCommand>(out, in), fCleanup(on_cleanup) { - kcout << "newoskrnl.dll: NetworkDevice initialized.\r"; + kcout << "newoskrnl.exe: NetworkDevice initialized.\r"; MUST_PASS(out && in && on_cleanup); } @@ -24,7 +24,7 @@ namespace Kernel { MUST_PASS(fCleanup); - kcout << "newoskrnl.dll: NetworkDevice cleanup.\r"; + kcout << "newoskrnl.exe: NetworkDevice cleanup.\r"; if (fCleanup) fCleanup(); 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); diff --git a/dev/ZKA/amd64-efi.make b/dev/ZKA/amd64-efi.make index 5bce68d3..730c4b10 100644 --- a/dev/ZKA/amd64-efi.make +++ b/dev/ZKA/amd64-efi.make @@ -39,7 +39,7 @@ LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x10000000 LDOBJ = Objects/*.obj # This file is the Kernel, responsible of task management and memory. -KERNEL = newoskrnl.dll +KERNEL = newoskrnl.exe .PHONY: error error: |
