diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-01 09:29:31 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-06-01 09:29:31 +0200 |
| commit | fc0d38259fd6670966b916b1f28a11f3cb2a4c45 (patch) | |
| tree | 2a54c64137eae7ffacfcb1842a92335b0e41b39b /Kernel/Sources/KernelHeap.cxx | |
| parent | c8b9625efaeae241d57cc8a40c3234807206e386 (diff) | |
MHR-23: SMP: Add hal_send_start_ipi and hal_send_end_ipi, as well as
DMA utilities.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources/KernelHeap.cxx')
| -rw-r--r-- | Kernel/Sources/KernelHeap.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/Kernel/Sources/KernelHeap.cxx b/Kernel/Sources/KernelHeap.cxx index a8ca467e..93f0c164 100644 --- a/Kernel/Sources/KernelHeap.cxx +++ b/Kernel/Sources/KernelHeap.cxx @@ -38,7 +38,10 @@ namespace NewOS SizeT fTargetPtrSize; /// @brief 64-bit target pointer. UIntPtr fTargetPtr; - UInt8 fPadding[kKernelHeapHeaderPaddingSz]; + /// @brief Is this a page pointer? + Boolean fPagePtr; + /// @brief Padding bytes for header. + UInt8 fPadding[kKernelHeapHeaderPaddingSz]; }; typedef HeapInformationBlock* HeapInformationBlockPtr; @@ -64,6 +67,7 @@ namespace NewOS heapInfo->fMagic = kKernelHeapMagic; heapInfo->fCRC32 = 0; // dont fill it for now. heapInfo->fTargetPtr = wrapper.VirtualAddress(); + heapInfo->fPagePtr = 0; ++kHeapCount; @@ -71,6 +75,27 @@ namespace NewOS sizeof(Detail::HeapInformationBlock)); } + /// @brief Makes a page heap. + /// @param heapPtr + /// @return + Int32 ke_make_ke_page(VoidPtr heapPtr) + { + if (kHeapCount < 1) + return -kErrorInternal; + if (((IntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)) <= 0) + return -kErrorInternal; + if (((IntPtr)heapPtr - kBadPtr) < 0) + return -kErrorInternal; + + Detail::HeapInformationBlockPtr virtualAddress = + reinterpret_cast<Detail::HeapInformationBlockPtr>( + (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + + virtualAddress->fPagePtr = 1; + + return 0; + } + /// @brief Declare pointer as free. /// @param heapPtr the pointer. /// @return |
