diff options
Diffstat (limited to 'Kernel/Sources')
| -rw-r--r-- | Kernel/Sources/FS/NewFS.cxx | 6 | ||||
| -rw-r--r-- | Kernel/Sources/Heap.cxx | 50 | ||||
| -rw-r--r-- | Kernel/Sources/PageManager.cxx | 2 | ||||
| -rw-r--r-- | Kernel/Sources/User.cxx | 9 |
4 files changed, 33 insertions, 34 deletions
diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx index 3382aa04..90f48eb2 100644 --- a/Kernel/Sources/FS/NewFS.cxx +++ b/Kernel/Sources/FS/NewFS.cxx @@ -1034,16 +1034,18 @@ namespace Kernel::Detail /***********************************************************************************/ Boolean fs_init_newfs(Void) noexcept { + kcout << "newoskrnl: 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: Testing drive...\r"; + kcout << "newoskrnl: Testing main drive...\r"; sMountpointInterface.A().fVerify(&sMountpointInterface.A().fPacket); - kcout << "newoskrnl: Testing drive [ OK ]...\r"; + kcout << "newoskrnl: Testing main drive [ OK ]...\r"; return true; } diff --git a/Kernel/Sources/Heap.cxx b/Kernel/Sources/Heap.cxx index 5b004880..de0c8a5c 100644 --- a/Kernel/Sources/Heap.cxx +++ b/Kernel/Sources/Heap.cxx @@ -94,17 +94,19 @@ namespace Kernel if (szFix == 0) ++szFix; + kcout << "newoskrnl: allocating VMH page...\r"; + auto wrapper = kHeapPageManager.Request(rw, user, false, szFix); - Detail::HEAP_INFORMATION_BLOCK_PTR heapInfo = + Detail::HEAP_INFORMATION_BLOCK_PTR heap_info_ptr = reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( wrapper.VirtualAddress()); - heapInfo->fTargetPtrSize = szFix; - heapInfo->fMagic = kKernelHeapMagic; - heapInfo->fCRC32 = 0; // dont fill it for now. - heapInfo->fTargetPtr = wrapper.VirtualAddress(); - heapInfo->fPagePtr = 0; + heap_info_ptr->fTargetPtrSize = szFix; + heap_info_ptr->fMagic = kKernelHeapMagic; + heap_info_ptr->fCRC32 = 0; // dont fill it for now. + heap_info_ptr->fTargetPtr = wrapper.VirtualAddress(); + heap_info_ptr->fPagePtr = 0; ++kHeapCount; @@ -115,22 +117,22 @@ namespace Kernel } /// @brief Makes a page heap. - /// @param heapPtr + /// @param heap_ptr /// @return - Int32 mm_make_ke_page(VoidPtr heapPtr) + Int32 mm_make_ke_page(VoidPtr heap_ptr) { if (kHeapCount < 1) return -kErrorInternal; - if (((IntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)) <= 0) + if (((IntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)) <= 0) return -kErrorInternal; - if (((IntPtr)heapPtr - kBadPtr) < 0) + if (((IntPtr)heap_ptr - kBadPtr) < 0) return -kErrorInternal; Detail::mm_alloc_init_timeout(); Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( - (UIntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); + (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); heapInfoBlk->fPagePtr = 1; @@ -140,22 +142,22 @@ namespace Kernel } /// @brief Declare pointer as free. - /// @param heapPtr the pointer. + /// @param heap_ptr the pointer. /// @return - Int32 mm_delete_ke_heap(VoidPtr heapPtr) + Int32 mm_delete_ke_heap(VoidPtr heap_ptr) { if (kHeapCount < 1) return -kErrorInternal; - if (((IntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)) <= 0) + if (((IntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)) <= 0) return -kErrorInternal; - if (((IntPtr)heapPtr - kBadPtr) < 0) + if (((IntPtr)heap_ptr - kBadPtr) < 0) return -kErrorInternal; Detail::mm_alloc_init_timeout(); Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( - (UIntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); + (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); if (heapInfoBlk && heapInfoBlk->fMagic == kKernelHeapMagic) { @@ -197,18 +199,18 @@ namespace Kernel } /// @brief Check if pointer is a valid kernel pointer. - /// @param heapPtr the pointer + /// @param heap_ptr the pointer /// @return if it exists. - Boolean mm_is_valid_heap(VoidPtr heapPtr) + Boolean mm_is_valid_heap(VoidPtr heap_ptr) { if (kHeapCount < 1) return false; - if (heapPtr) + if (heap_ptr) { Detail::HEAP_INFORMATION_BLOCK_PTR virtualAddress = reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( - (UIntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); + (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); if (virtualAddress->fPresent && virtualAddress->fMagic == kKernelHeapMagic) { @@ -220,15 +222,15 @@ namespace Kernel } /// @brief Protect the heap with a CRC value. - /// @param heapPtr HIB pointer. + /// @param heap_ptr HIB pointer. /// @return if it valid: point has crc now., otherwise fail. - Boolean mm_protect_ke_heap(VoidPtr heapPtr) + Boolean mm_protect_ke_heap(VoidPtr heap_ptr) { - if (heapPtr) + if (heap_ptr) { Detail::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( - (UIntPtr)heapPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); + (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); if (heapInfoBlk->fPresent && kKernelHeapMagic == heapInfoBlk->fMagic) { diff --git a/Kernel/Sources/PageManager.cxx b/Kernel/Sources/PageManager.cxx index 8e9e77cc..7e0ef67b 100644 --- a/Kernel/Sources/PageManager.cxx +++ b/Kernel/Sources/PageManager.cxx @@ -63,6 +63,8 @@ namespace Kernel /// @return PTEWrapper PageManager::Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz) { + kcout << "newoskrnl: Allocating VMH page from PageManager...\r"; + // Store PTE wrapper right after PTE. VoidPtr ptr = Kernel::HAL::hal_alloc_page(Rw, User, Sz); diff --git a/Kernel/Sources/User.cxx b/Kernel/Sources/User.cxx index 22dda57e..4109864a 100644 --- a/Kernel/Sources/User.cxx +++ b/Kernel/Sources/User.cxx @@ -75,12 +75,7 @@ namespace Kernel if (NewFilesystemManager::GetMounted()) { - auto node = NewFilesystemManager::GetMounted()->Open(kUsersFile, "wb"); - - if (!node) - { - NewFilesystemManager::GetMounted()->Create(kUsersFile); - } + auto node = NewFilesystemManager::GetMounted()->Create(kUsersFile); if (node) { @@ -89,12 +84,10 @@ namespace Kernel } delete token; - return true; } delete token; - return false; } |
