diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-10 10:35:44 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-10 10:35:44 +0200 |
| commit | 192892221333113b28353fbe428adfc1bf6bbaae (patch) | |
| tree | 04f2da30b021880ea3c5ca1bac030fcd206c5c52 /Kernel/HALKit | |
| parent | 80039963ff08d1810e22a0ae41497b156e861db0 (diff) | |
[FIX] [newoskrnl.dll] Fixed it's heap and improved it as well.
[FIX] Fix memory leak in TrySave. (\Kernel\Sources\User.cxx)
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/HALKit')
| -rw-r--r-- | Kernel/HALKit/AMD64/HalKernelMain.cxx | 9 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/Processor.hxx | 5 | ||||
| -rw-r--r-- | Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx | 17 |
3 files changed, 23 insertions, 8 deletions
diff --git a/Kernel/HALKit/AMD64/HalKernelMain.cxx b/Kernel/HALKit/AMD64/HalKernelMain.cxx index d24099f2..495cb0be 100644 --- a/Kernel/HALKit/AMD64/HalKernelMain.cxx +++ b/Kernel/HALKit/AMD64/HalKernelMain.cxx @@ -89,7 +89,7 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept // get virtual address start (for the heap) kKernelVirtualStart = reinterpret_cast<Kernel::VoidPtr>( - reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_VirtualStart) + cHeapStartOffset); + reinterpret_cast<Kernel::UIntPtr>(kHandoverHeader->f_VirtualStart)); // get physical address start. kKernelPhysicalStart = reinterpret_cast<Kernel::VoidPtr>( @@ -210,6 +210,12 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept kSyscalls[cShutdownInterrupt].Leak().Leak()->fHooked = true; kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true; + Kernel::kcout << "newoskrnl: Creating Filesystem and Super User...\r"; + + auto fs = new Kernel::NewFilesystemManager(); + + Kernel::NewFilesystemManager::Mount(fs); + cRoot = new Kernel::User(Kernel::RingKind::kRingSuperUser, kSuperUser); #ifdef __DEBUG__ @@ -218,6 +224,7 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept const auto cPassword = "password"; #endif + cRoot->TrySave(cPassword); Kernel::UserManager::The()->TryLogIn(cRoot, cPassword); diff --git a/Kernel/HALKit/AMD64/Processor.hxx b/Kernel/HALKit/AMD64/Processor.hxx index 53addd46..432d799d 100644 --- a/Kernel/HALKit/AMD64/Processor.hxx +++ b/Kernel/HALKit/AMD64/Processor.hxx @@ -40,7 +40,7 @@ EXTERN_C #define kTaskGate (0b10001100) #define kGdtCodeSelector (0x08) #define kGdtUserCodeSelector (0x10) -#define cHeapStartOffset (0x4000000) +#define cHeapStartOffset (0x80000000) namespace Kernel { @@ -340,7 +340,8 @@ EXTERN_C Kernel::Void hal_load_gdt(Kernel::HAL::RegisterGDT ptr); #define kKernelIdtSize 0x100 #define kKernelInterruptId 0x32 -inline Kernel::VoidPtr kKernelVirtualStart = (Kernel::VoidPtr)cHeapStartOffset; +inline Kernel::VoidPtr kKernelVMTStart = (Kernel::VoidPtr)cHeapStartOffset; +inline Kernel::VoidPtr kKernelVirtualStart = nullptr; inline Kernel::UIntPtr kKernelVirtualSize = 0UL; inline Kernel::VoidPtr kKernelPhysicalStart = nullptr; diff --git a/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx b/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx index fe47ce76..9d141aba 100644 --- a/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx +++ b/Kernel/HALKit/AMD64/Storage/ATA-PIO.cxx @@ -64,27 +64,32 @@ Void drv_std_select(UInt16 Bus) Boolean drv_std_init(UInt16 Bus, UInt8 Drive, UInt16& OutBus, UInt8& OutMaster) { - if (drv_std_detected()) - return true; - UInt16 IO = Bus; drv_std_select(IO); + + Kernel::kcout << "newoskrnl: Initializing drive...\r"; +ATAInit_Retry: // Bus init, NEIN bit. Out8(IO + ATA_REG_NEIN, 1); - // identify until it's good. -ATAInit_Retry: + // identify until it's good + auto statRdy = In8(IO + ATA_REG_STATUS); if (statRdy & ATA_SR_ERR) { + Kernel::kcout << "newoskrnl: Failing drive...\r"; + return false; } if ((statRdy & ATA_SR_BSY)) + { + kcout << "Retrying..."; goto ATAInit_Retry; + } Out8(IO + ATA_REG_COMMAND, ATA_CMD_IDENTIFY); @@ -102,6 +107,8 @@ ATAInit_Retry: OutMaster = (Bus == ATA_PRIMARY_IO) ? ATA_MASTER : ATA_SLAVE; + Kernel::kcout << "newoskrnl: Create ATA module.\r"; + return true; } |
