diff options
Diffstat (limited to 'dev/ZKA')
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm | 12 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalPageAlloc.cxx | 7 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalProcessor.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/Processor.hxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/Heap.cxx | 34 | ||||
| -rw-r--r-- | dev/ZKA/Sources/PEFCodeManager.cxx | 8 |
7 files changed, 37 insertions, 30 deletions
diff --git a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm index 601ff29e..221cd05e 100644 --- a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm +++ b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm @@ -48,15 +48,15 @@ extern hal_system_call_enter mp_system_call_handler: cli - push rcx - push rdx - push rax + push r8 + push r9 + push r10 call hal_system_call_enter - pop rax - pop rdx - pop rcx + pop r10 + pop r9 + pop r8 sti sysret diff --git a/dev/ZKA/HALKit/AMD64/HalPageAlloc.cxx b/dev/ZKA/HALKit/AMD64/HalPageAlloc.cxx index 4a830eee..3d8deac2 100644 --- a/dev/ZKA/HALKit/AMD64/HalPageAlloc.cxx +++ b/dev/ZKA/HALKit/AMD64/HalPageAlloc.cxx @@ -97,11 +97,12 @@ namespace Kernel kAllocationInProgress = false; - auto result = reinterpret_cast<VoidPtr>(vmh_header + sizeof(Detail::VIRTUAL_MEMORY_HEADER)); - + VoidPtr result = reinterpret_cast<VoidPtr>(vmh_header + sizeof(Detail::VIRTUAL_MEMORY_HEADER)); VoidPtr cr3 = hal_read_cr3(); - mm_update_page(cr3, 0, result, eFlagsPresent | (rw ? eFlagsRw : 0) | (user ? eFlagsUser : 0)); + mm_update_pte(cr3, 0, result, eFlagsPresent | (rw ? eFlagsRw : 0) | (user ? eFlagsUser : 0)); + mm_update_pte(cr3, 0, result, (rw ? eFlagsRw : 0)); + mm_update_pte(cr3, 0, result, (user ? eFlagsUser : 0)); return result; } diff --git a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx index 457752b7..706bd5bd 100644 --- a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx +++ b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx @@ -16,7 +16,7 @@ namespace Kernel::HAL { - EXTERN_C Int32 mm_update_page(VoidPtr pd_base, VoidPtr phys_addr, VoidPtr virt_addr, UInt32 flags) + EXTERN_C Int32 mm_update_pte(VoidPtr pd_base, VoidPtr phys_addr, VoidPtr virt_addr, UInt32 flags) { UIntPtr pte_idx = (UIntPtr)virt_addr >> 12; diff --git a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx index 50d00368..4fa8c019 100644 --- a/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx +++ b/dev/ZKA/HALKit/AMD64/HalSchedulerCore.cxx @@ -14,7 +14,7 @@ Void UserProcess::SetImageStart(VoidPtr imageStart) noexcept if (imageStart == nullptr) this->Crash(); - HAL::mm_update_page(hal_read_cr3(), 0, imageStart, HAL::eFlagsPresent | HAL::eFlagsUser); + HAL::mm_update_pte(hal_read_cr3(), 0, imageStart, HAL::eFlagsPresent | HAL::eFlagsUser); this->Image = imageStart; } diff --git a/dev/ZKA/HALKit/AMD64/Processor.hxx b/dev/ZKA/HALKit/AMD64/Processor.hxx index ec053435..edbc6ae5 100644 --- a/dev/ZKA/HALKit/AMD64/Processor.hxx +++ b/dev/ZKA/HALKit/AMD64/Processor.hxx @@ -71,7 +71,7 @@ namespace Kernel::HAL /// @param phys_addr a valid phyiscal address. /// @param virt_addr a valid virtual address. /// @param flags the flags to put on the page. - EXTERN_C Int32 mm_update_page(VoidPtr pd_base, VoidPtr phys_addr, VoidPtr virt_addr, UInt32 flags); + EXTERN_C Int32 mm_update_pte(VoidPtr pd_base, VoidPtr phys_addr, VoidPtr virt_addr, UInt32 flags); EXTERN_C UChar In8(UInt16 port); EXTERN_C UShort In16(UInt16 port); diff --git a/dev/ZKA/Sources/Heap.cxx b/dev/ZKA/Sources/Heap.cxx index 0ae6a965..bd7e299b 100644 --- a/dev/ZKA/Sources/Heap.cxx +++ b/dev/ZKA/Sources/Heap.cxx @@ -35,15 +35,15 @@ namespace Kernel ///! @brief Boolean value which tells if the heap is allocated. Boolean fPresent; /// @brief Is this valued owned by the user? - Boolean fUserOwned; + Boolean fUser; + /// @brief Is this a page pointer? + Boolean fPage; ///! @brief 32-bit CRC checksum. UInt32 fCRC32; /// @brief 64-bit pointer size. - SizeT fTargetPtrSize; + SizeT fHeapSize; /// @brief 64-bit target pointer. - UIntPtr fTargetPtr; - /// @brief Is this a page pointer? - Boolean fPagePtr; + UIntPtr fHeapPtr; /// @brief Padding bytes for header. UInt8 fPadding[kKernelHeapHeaderPaddingSz]; }; @@ -75,7 +75,7 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( (UIntPtr)allocatedPtr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); - heapInfoBlk->fTargetPtrSize = newSz; + heapInfoBlk->fHeapSize = newSz; if (heapInfoBlk->fCRC32 > 0) { @@ -105,12 +105,12 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( wrapper.VirtualAddress()); - heap_info_ptr->fTargetPtrSize = szFix; + heap_info_ptr->fHeapSize = szFix; heap_info_ptr->fMagic = kKernelHeapMagic; heap_info_ptr->fCRC32 = 0U; // dont fill it for now. - heap_info_ptr->fTargetPtr = wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK); - heap_info_ptr->fPagePtr = 0UL; - heap_info_ptr->fUserOwned = user; + heap_info_ptr->fHeapPtr = wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK); + heap_info_ptr->fPage = 0UL; + heap_info_ptr->fUser = user; heap_info_ptr->fPresent = true; ++kHeapCount; @@ -141,7 +141,7 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); - heapInfoBlk->fPagePtr = 1; + heapInfoBlk->fPage = true; Detail::mm_alloc_fini_timeout(); @@ -177,19 +177,19 @@ namespace Kernel if (heapInfoBlk->fCRC32 != 0) { if (heapInfoBlk->fCRC32 != - ke_calculate_crc32((Char*)heapInfoBlk->fTargetPtr, - heapInfoBlk->fTargetPtrSize)) + ke_calculate_crc32((Char*)heapInfoBlk->fHeapPtr, + heapInfoBlk->fHeapSize)) { - if (!heapInfoBlk->fUserOwned) + if (!heapInfoBlk->fUser) { ke_stop(RUNTIME_CHECK_POINTER); } } } - heapInfoBlk->fTargetPtrSize = 0UL; + heapInfoBlk->fHeapSize = 0UL; heapInfoBlk->fPresent = false; - heapInfoBlk->fTargetPtr = 0; + heapInfoBlk->fHeapPtr = 0; heapInfoBlk->fCRC32 = 0; heapInfoBlk->fMagic = 0; @@ -245,7 +245,7 @@ namespace Kernel if (heapInfoBlk->fPresent && kKernelHeapMagic == heapInfoBlk->fMagic) { heapInfoBlk->fCRC32 = - ke_calculate_crc32((Char*)heapInfoBlk->fTargetPtr, heapInfoBlk->fTargetPtrSize); + ke_calculate_crc32((Char*)heapInfoBlk->fHeapPtr, heapInfoBlk->fHeapSize); return true; } diff --git a/dev/ZKA/Sources/PEFCodeManager.cxx b/dev/ZKA/Sources/PEFCodeManager.cxx index 0f1a4885..911281f6 100644 --- a/dev/ZKA/Sources/PEFCodeManager.cxx +++ b/dev/ZKA/Sources/PEFCodeManager.cxx @@ -166,7 +166,13 @@ namespace Kernel rt_copy_memory((VoidPtr)((Char*)blob + sizeof(PEFCommandHeader)), blobRet, container_header->Size); - HAL::mm_update_page(hal_read_cr3(), 0, blobRet, HAL::eFlagsPresent | HAL::eFlagsUser | (container_header->Kind != kPefCode ? HAL::eFlagsRw : 0)); +#ifdef __ZKA_AMD64__ + HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, HAL::eFlagsPresent); + HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, HAL::eFlagsUser); + HAL::mm_update_pte(hal_read_cr3(), 0, blobRet, (container_header->Kind != kPefCode ? HAL::eFlagsRw : 0)); +#else +#warning ! No page bits set fo blob ! +#endif mm_delete_ke_heap(blob); return blobRet; |
