From fc0d38259fd6670966b916b1f28a11f3cb2a4c45 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 1 Jun 2024 09:29:31 +0200 Subject: MHR-23: SMP: Add hal_send_start_ipi and hal_send_end_ipi, as well as DMA utilities. Signed-off-by: Amlal El Mahrouss --- Kernel/Sources/KernelHeap.cxx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'Kernel/Sources/KernelHeap.cxx') 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( + (UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock)); + + virtualAddress->fPagePtr = 1; + + return 0; + } + /// @brief Declare pointer as free. /// @param heapPtr the pointer. /// @return -- cgit v1.2.3