diff options
Diffstat (limited to 'Kernel/Sources')
| -rw-r--r-- | Kernel/Sources/Heap.cxx | 58 | ||||
| -rw-r--r-- | Kernel/Sources/Main.cxx | 3 | ||||
| -rw-r--r-- | Kernel/Sources/New+Delete.cxx | 10 | ||||
| -rw-r--r-- | Kernel/Sources/PEFCodeManager.cxx | 22 | ||||
| -rw-r--r-- | Kernel/Sources/ProcessScheduler.cxx | 6 |
5 files changed, 49 insertions, 50 deletions
diff --git a/Kernel/Sources/Heap.cxx b/Kernel/Sources/Heap.cxx index b2acaffe..25a77d6b 100644 --- a/Kernel/Sources/Heap.cxx +++ b/Kernel/Sources/Heap.cxx @@ -21,12 +21,12 @@ namespace Kernel STATIC SizeT kHeapCount = 0UL; STATIC PageManager kHeapPageManager; - namespace Detail + namespace Details { /// @brief Kernel heap information block. /// Located before the address bytes. /// | HIB | ADDRESS | - struct PACKED HeapInformationBlock final + struct PACKED HEAP_INFORMATION_BLOCK final { ///! @brief 32-bit value which contains the magic number of the executable. UInt32 fMagic; @@ -44,26 +44,26 @@ namespace Kernel UInt8 fPadding[kKernelHeapHeaderPaddingSz]; }; - typedef HeapInformationBlock* HeapInformationBlockPtr; + typedef HEAP_INFORMATION_BLOCK* HEAP_INFORMATION_BLOCK_PTR; } // namespace Detail /// @brief Declare a new size for allocatedPtr. /// @param allocatedPtr the pointer. /// @return - voidPtr ke_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz) + voidPtr mm_realloc_ke_heap(voidPtr allocatedPtr, SizeT newSz) { if (!allocatedPtr || newSz < 1) return nullptr; - Detail::HeapInformationBlockPtr heapInfoBlk = - reinterpret_cast<Detail::HeapInformationBlockPtr>( - (UIntPtr)allocatedPtr - sizeof(Detail::HeapInformationBlock)); + Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( + (UIntPtr)allocatedPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)); heapInfoBlk->fTargetPtrSize = newSz; if (heapInfoBlk->fCRC32 > 0) { - MUST_PASS(ke_protect_ke_heap(allocatedPtr)); + MUST_PASS(mm_protect_ke_heap(allocatedPtr)); } return allocatedPtr; @@ -74,7 +74,7 @@ namespace Kernel /// @param rw read write (true to enable it) /// @param user is it accesible by user processes? /// @return the pointer - VoidPtr ke_new_ke_heap(const SizeT sz, const bool rw, const bool user) + VoidPtr mm_new_ke_heap(const SizeT sz, const bool rw, const bool user) { auto szFix = sz; @@ -83,8 +83,8 @@ namespace Kernel auto wrapper = kHeapPageManager.Request(rw, user, false, szFix); - Detail::HeapInformationBlockPtr heapInfo = - reinterpret_cast<Detail::HeapInformationBlockPtr>( + Details::HEAP_INFORMATION_BLOCK_PTR heapInfo = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( wrapper.VirtualAddress()); heapInfo->fTargetPtrSize = szFix; @@ -96,24 +96,24 @@ namespace Kernel ++kHeapCount; return reinterpret_cast<VoidPtr>(wrapper.VirtualAddress() + - sizeof(Detail::HeapInformationBlock)); + sizeof(Details::HEAP_INFORMATION_BLOCK)); } /// @brief Makes a page heap. /// @param heapPtr /// @return - Int32 ke_make_ke_page(VoidPtr heapPtr) + Int32 mm_make_ke_page(VoidPtr heapPtr) { if (kHeapCount < 1) return -kErrorInternal; - if (((IntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)) <= 0) + if (((IntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)) <= 0) return -kErrorInternal; if (((IntPtr)heapPtr - kBadPtr) < 0) return -kErrorInternal; - Detail::HeapInformationBlockPtr heapInfoBlk = - reinterpret_cast<Detail::HeapInformationBlockPtr>( - (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( + (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)); heapInfoBlk->fPagePtr = 1; @@ -123,18 +123,18 @@ namespace Kernel /// @brief Declare pointer as free. /// @param heapPtr the pointer. /// @return - Int32 ke_delete_ke_heap(VoidPtr heapPtr) + Int32 mm_delete_ke_heap(VoidPtr heapPtr) { if (kHeapCount < 1) return -kErrorInternal; - if (((IntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)) <= 0) + if (((IntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)) <= 0) return -kErrorInternal; if (((IntPtr)heapPtr - kBadPtr) < 0) return -kErrorInternal; - Detail::HeapInformationBlockPtr heapInfoBlk = - reinterpret_cast<Detail::HeapInformationBlockPtr>( - (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( + (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)); if (heapInfoBlk && heapInfoBlk->fMagic == kKernelHeapMagic) { @@ -181,9 +181,9 @@ namespace Kernel if (heapPtr) { - Detail::HeapInformationBlockPtr virtualAddress = - reinterpret_cast<Detail::HeapInformationBlockPtr>( - (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + Details::HEAP_INFORMATION_BLOCK_PTR virtualAddress = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( + (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)); if (virtualAddress->fPresent && virtualAddress->fMagic == kKernelHeapMagic) { @@ -197,13 +197,13 @@ namespace Kernel /// @brief Protect the heap with a CRC value. /// @param heapPtr HIB pointer. /// @return if it valid: point has crc now., otherwise fail. - Boolean ke_protect_ke_heap(VoidPtr heapPtr) + Boolean mm_protect_ke_heap(VoidPtr heapPtr) { if (heapPtr) { - Detail::HeapInformationBlockPtr heapInfoBlk = - reinterpret_cast<Detail::HeapInformationBlockPtr>( - (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + Details::HEAP_INFORMATION_BLOCK_PTR heapInfoBlk = + reinterpret_cast<Details::HEAP_INFORMATION_BLOCK_PTR>( + (UIntPtr)heapPtr - sizeof(Details::HEAP_INFORMATION_BLOCK)); if (heapInfoBlk->fPresent && kKernelHeapMagic == heapInfoBlk->fMagic) { diff --git a/Kernel/Sources/Main.cxx b/Kernel/Sources/Main.cxx index 318cbe3f..79febc15 100644 --- a/Kernel/Sources/Main.cxx +++ b/Kernel/Sources/Main.cxx @@ -190,8 +190,7 @@ namespace Kernel::Detail { Kernel::UserView::The()->fRootUser = new User(RingKind::kRingSuperUser, kSuperUser); - - Kernel::UserView::The()->LogIn(Kernel::UserView::The()->fRootUser, nullptr); + Kernel::UserView::The()->LogIn(Kernel::UserView::The()->fRootUser, ""); Kernel::kcout << "newoskrnl: " << cKernelVersion.GetKey().CData() << ": " << Kernel::number(cKernelVersion.GetValue()) << Kernel::endl; } diff --git a/Kernel/Sources/New+Delete.cxx b/Kernel/Sources/New+Delete.cxx index 2921e079..b43fafbc 100644 --- a/Kernel/Sources/New+Delete.cxx +++ b/Kernel/Sources/New+Delete.cxx @@ -12,7 +12,7 @@ void* operator new[](size_t sz) if (sz == 0) ++sz; - return Kernel::ke_new_ke_heap(sz, true, false); + return Kernel::mm_new_ke_heap(sz, true, false); } void* operator new(size_t sz) @@ -20,7 +20,7 @@ void* operator new(size_t sz) if (sz == 0) ++sz; - return Kernel::ke_new_ke_heap(sz, true, false); + return Kernel::mm_new_ke_heap(sz, true, false); } void operator delete[](void* ptr) @@ -28,7 +28,7 @@ void operator delete[](void* ptr) if (ptr == nullptr) return; - Kernel::ke_delete_ke_heap(ptr); + Kernel::mm_delete_ke_heap(ptr); } void operator delete(void* ptr) @@ -36,7 +36,7 @@ void operator delete(void* ptr) if (ptr == nullptr) return; - Kernel::ke_delete_ke_heap(ptr); + Kernel::mm_delete_ke_heap(ptr); } void operator delete(void* ptr, size_t sz) @@ -46,5 +46,5 @@ void operator delete(void* ptr, size_t sz) NEWOS_UNUSED(sz); - Kernel::ke_delete_ke_heap(ptr); + Kernel::mm_delete_ke_heap(ptr); } diff --git a/Kernel/Sources/PEFCodeManager.cxx b/Kernel/Sources/PEFCodeManager.cxx index 8b1918ef..223505b8 100644 --- a/Kernel/Sources/PEFCodeManager.cxx +++ b/Kernel/Sources/PEFCodeManager.cxx @@ -85,7 +85,7 @@ namespace Kernel kcout << "CodeManager: Warning: Executable format error!\n"; fBad = true; - ke_delete_ke_heap(fCachedBlob); + mm_delete_ke_heap(fCachedBlob); fCachedBlob = nullptr; } @@ -95,7 +95,7 @@ namespace Kernel PEFLoader::~PEFLoader() { if (fCachedBlob) - ke_delete_ke_heap(fCachedBlob); + mm_delete_ke_heap(fCachedBlob); fFile.Delete(); } @@ -160,7 +160,7 @@ namespace Kernel { if (!this->fFatBinary) { - ke_delete_ke_heap(blob); + mm_delete_ke_heap(blob); return nullptr; } } @@ -169,13 +169,13 @@ namespace Kernel rt_copy_memory((VoidPtr)((Char*)blob + sizeof(PEFCommandHeader)), blobRet, container_header->Size); - ke_delete_ke_heap(blob); + mm_delete_ke_heap(blob); return blobRet; } } } - ke_delete_ke_heap(blob); + mm_delete_ke_heap(blob); return nullptr; } @@ -219,18 +219,18 @@ namespace Kernel return fPath.Leak().CData(); } - const char* PEFLoader::FormatAsString() + const char* PEFLoader::AsString() { #ifdef __32x0__ - return "32x0 PEF."; + return "32x0 PEF format."; #elif defined(__64x0__) - return "64x0 PEF."; + return "64x0 PEF format."; #elif defined(__x86_64__) - return "x86_64 PEF."; + return "x86_64 PEF format."; #elif defined(__powerpc64__) - return "POWER PEF."; + return "POWER PEF format."; #else - return "Unknown PEF."; + return "Unknown PEF format."; #endif // __32x0__ || __64x0__ || __x86_64__ || __powerpc64__ } diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx index cccd8979..7002bd1f 100644 --- a/Kernel/Sources/ProcessScheduler.cxx +++ b/Kernel/Sources/ProcessScheduler.cxx @@ -185,10 +185,10 @@ namespace Kernel //! Delete image if not done already. if (this->Image) - ke_delete_ke_heap(this->Image); + mm_delete_ke_heap(this->Image); if (this->StackFrame) - ke_delete_ke_heap((VoidPtr)this->StackFrame); + mm_delete_ke_heap((VoidPtr)this->StackFrame); this->Image = nullptr; this->StackFrame = nullptr; @@ -231,7 +231,7 @@ namespace Kernel } process.Leak().StackFrame = reinterpret_cast<HAL::StackFrame*>( - ke_new_ke_heap(sizeof(HAL::StackFrame), true, false)); + mm_new_ke_heap(sizeof(HAL::StackFrame), true, false)); MUST_PASS(process.Leak().StackFrame); |
