diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-09 19:55:54 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-09 19:56:35 +0200 |
| commit | 1c217ed09c6c4b13ec09b897270a208439f0db55 (patch) | |
| tree | 43c93aef6ee233fafcd7ca07a5700dd76d5ecdf5 /Kernel/HALKit | |
| parent | acd8297fe927e601a7173cec7ca5445fd4a9c74a (diff) | |
[FIX] Fix bootloop on serial write, fixing more bugs now, still have to
fix allocation.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
| -rw-r--r-- | Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx | 10 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx | 5 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx | 3 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/HalDebugOutput.cxx | 4 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/HalKernelMain.cxx | 44 |
5 files changed, 46 insertions, 20 deletions
diff --git a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx index aca319c3..e13cc0fc 100644 --- a/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx +++ b/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cxx @@ -102,18 +102,18 @@ namespace Kernel for (Size index = 0; index < this->fEntries; ++index) { - SDT& sdt = *reinterpret_cast<SDT*>(xsdt->AddressArr[index]); + SDT* sdt = reinterpret_cast<SDT*>(xsdt->AddressArr[index]); - kcout << "ACPI: Checksum: " << number(sdt.Checksum) << endl; - kcout << "ACPI: Revision: " << number(sdt.Revision) << endl; + kcout << "ACPI: Checksum: " << number(sdt->Checksum) << endl; + kcout << "ACPI: Revision: " << number(sdt->Revision) << endl; for (short signature_index = 0; signature_index < cAcpiSignatureLength; ++signature_index) { - if (sdt.Signature[signature_index] != signature[signature_index]) + if (sdt->Signature[signature_index] != signature[signature_index]) break; if (signature_index == (cAcpiSignatureLength - 1)) - return ErrorOr<voidPtr>(reinterpret_cast<voidPtr>(&sdt)); + return ErrorOr<voidPtr>(reinterpret_cast<voidPtr>(xsdt->AddressArr[index])); } } diff --git a/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx index c181be30..bf463ae9 100644 --- a/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx +++ b/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cxx @@ -84,10 +84,13 @@ EXTERN_C Kernel::Void hal_system_call_enter(Kernel::UIntPtr rcx, Kernel::UIntPtr /// @return nothing. EXTERN_C Kernel::Void hal_kernel_call_enter(Kernel::UIntPtr rcx, Kernel::UIntPtr rdx, Kernel::UIntPtr r8, Kernel::UIntPtr r9) { - if (rcx != 0) + if (rcx <= (kSyscalls.Count() - 1)) { Kernel::kcout << "newoskrnl: kerncall: enter.\r"; + if (kKerncalls[rcx].Leak().Leak()->fHooked) + (kKerncalls[rcx].Leak().Leak()->fProc)((Kernel::VoidPtr)rdx); + Kernel::kcout << "newoskrnl: kerncall: exit.\r"; } } diff --git a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx index 5c1a4323..d15fba73 100644 --- a/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx +++ b/Kernel/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx @@ -16,6 +16,8 @@ #include <KernelKit/MP.hxx> +#define kApicSignature "APIC" + #define kAPIC_ICR_Low 0x300 #define kAPIC_ICR_High 0x310 #define kAPIC_SIPI_Vector 0x00500 @@ -66,7 +68,6 @@ namespace Kernel::HAL }; STATIC VoidPtr kApicMadt = nullptr; - STATIC const Char* kApicSignature = "APIC"; /// @brief Multiple APIC Descriptor Table. struct MadtType final : public SDT diff --git a/Kernel/HALKit/AMD64/HalDebugOutput.cxx b/Kernel/HALKit/AMD64/HalDebugOutput.cxx index b80ab761..3b4c29c7 100644 --- a/Kernel/HALKit/AMD64/HalDebugOutput.cxx +++ b/Kernel/HALKit/AMD64/HalDebugOutput.cxx @@ -136,9 +136,9 @@ namespace Kernel #endif // __DEBUG__ } - TerminalDevice& TerminalDevice::The() noexcept + TerminalDevice TerminalDevice::The() noexcept { - STATIC TerminalDevice out(Kernel::ke_io_write, Kernel::ke_io_read); + TerminalDevice out(Kernel::ke_io_write, Kernel::ke_io_read); return out; } diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index 93841bc1..924eb6c9 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -53,6 +53,13 @@ namespace Kernel::HAL extern void hal_system_get_cores(Kernel::voidPtr rsdPtr); } // namespace Kernel::HAL +namespace Kernel +{ + EXTERN SizeT kHeapCount; + EXTERN PageManager kHeapPageManager; + EXTERN Bool kOperationInProgress; +} // namespace Kernel + /* GDT. */ STATIC Kernel::HAL::Detail::NewOSGDT cGdt = { {0, 0, 0, 0x00, 0x00, 0}, // null entry @@ -65,6 +72,8 @@ STATIC Kernel::HAL::Detail::NewOSGDT cGdt = { void hal_real_init(void); +static Kernel::User* cRoot; + EXTERN_C void hal_init_platform( Kernel::HEL::HandoverInformationHeader* HandoverHeader) { @@ -78,25 +87,24 @@ EXTERN_C void hal_init_platform( return; } - STATIC Kernel::UInt32 kTextOffsetY = 30; - - cg_write_text("NEWOSKRNL (C) ZKA TECHNOLOGIES.", kTextOffsetY, 10, RGB(0x00, 0x00, 0x00)); - kTextOffsetY += 10; - cg_write_text("SMP OS (MAX 8 CORES).", kTextOffsetY, 10, RGB(0x00, 0x00, 0x00)); - - Kernel::ke_stop(RUNTIME_CHECK_BOOTSTRAP); - hal_real_init(); } +EXTERN Kernel::Boolean kAllocationInProgress; + void hal_real_init(void) { + Kernel::kHeapPageManager = Kernel::PageManager(); + Kernel::kHeapCount = 0UL; + Kernel::kOperationInProgress = No; + kAllocationInProgress = No; + // get page size. kKernelVirtualSize = kHandoverHeader->f_VirtualSize; - // get virtual address start. + // get virtual address start (for the heap) kKernelVirtualStart = reinterpret_cast<Kernel::VoidPtr>( - reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_VirtualStart)); + reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_VirtualStart) + cHeapStartOffset); // get physical address start. kKernelPhysicalStart = reinterpret_cast<Kernel::VoidPtr>( @@ -217,5 +225,19 @@ void hal_real_init(void) kSyscalls[cShutdownInterrupt].Leak().Leak()->fHooked = true; kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true; - Kernel::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr); + cRoot = new Kernel::User(Kernel::RingKind::kRingSuperUser, kSuperUser); + +#ifdef __DEBUG__ + cRoot->TrySave("6aa162f3-20f6-4143-92f9-5dd37066aedc"); +#else + cRoot->TrySave("password"); +#endif + +#ifdef __DEBUG__ + Kernel::UserManager::The()->TryLogIn(cRoot, "6aa162f3-20f6-4143-92f9-5dd37066aedc"); +#else + Kernel::UserManager::The()->TryLogIn(cRoot, "password"); +#endif + + Kernel::ke_stop(RUNTIME_CHECK_FAILED); } |
