diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-25 15:35:28 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-03-25 15:35:28 +0100 |
| commit | 0ead895f52d24dad009f738037a7795d4e3d840a (patch) | |
| tree | 863fd1c881fc7bf26ab78b932421e6416bbef288 /dev/kernel/src/MemoryMgr.cc | |
| parent | 59dbe4cffc7c633709ef8b45f49c46daf7f74e92 (diff) | |
kernel: Refactor AHCI I/O path, enhance memory allocators, and cleanup obsolete script
- Removed unused `build_gcc.sh` script.
- Namespaced CPU feature flags under `NeOS` and transitioned from enum to unnamed enum for scoping.
- Renamed `drv_std_input_output` to `drv_std_input_output_ahci` for clarity.
- Improved AHCI driver documentation and added zeroing for read buffers.
- Added optional `pad` parameter to memory allocators: `mm_alloc_bitmap`, `mm_new_heap`, `PageMgr::Request`, etc.
- Updated bitmap allocator to correctly handle and align with padded sizes.
- Added `fPad` field to memory header block.
- Fixed `ATA-DMA` mode comment, corrected PRD usage and logic.
- Improved code documentation and formatting in `UserProcessScheduler`, `PageMgr`, and related components.
- Enhanced safety in process memory cleanup (e.g., `StackReserve` cleanup).
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/src/MemoryMgr.cc')
| -rw-r--r-- | dev/kernel/src/MemoryMgr.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/dev/kernel/src/MemoryMgr.cc b/dev/kernel/src/MemoryMgr.cc index 7a79b906..271dfa23 100644 --- a/dev/kernel/src/MemoryMgr.cc +++ b/dev/kernel/src/MemoryMgr.cc @@ -67,6 +67,9 @@ namespace NeOS /// @brief 64-bit target offset pointer. UIntPtr fOffset; + /// @brief Padding. + UInt32 fPad; + /// @brief Padding bytes for header. UInt8 fPadding[kMemoryMgrAlignSz]; }; @@ -116,7 +119,7 @@ namespace NeOS /// @param wr Read Write bit. /// @param user User enable bit. /// @return The newly allocated pointer. - _Output VoidPtr mm_new_heap(const SizeT sz, const bool wr, const bool user) + _Output VoidPtr mm_new_heap(const SizeT sz, const Bool wr, const Bool user, const SizeT pad_amount) { auto sz_fix = sz; @@ -126,7 +129,7 @@ namespace NeOS sz_fix += sizeof(Detail::MM_INFORMATION_BLOCK); PageMgr heap_mgr; - auto wrapper = heap_mgr.Request(wr, user, No, sz_fix); + auto wrapper = heap_mgr.Request(wr, user, No, sz_fix, pad_amount); Detail::MM_INFORMATION_BLOCK_PTR heap_info_ptr = reinterpret_cast<Detail::MM_INFORMATION_BLOCK_PTR>( @@ -140,6 +143,7 @@ namespace NeOS heap_info_ptr->fWriteRead = wr; heap_info_ptr->fUser = user; heap_info_ptr->fPresent = Yes; + heap_info_ptr->fPad = pad_amount; rt_set_memory(heap_info_ptr->fPadding, 0, kMemoryMgrAlignSz); @@ -232,6 +236,7 @@ namespace NeOS heap_info_ptr->fWriteRead = No; heap_info_ptr->fUser = No; heap_info_ptr->fMagic = 0; + heap_info_ptr->fPad = 0; kout << "Address has been successfully freed: " << hex_number((UIntPtr)heap_info_ptr) << kendl; |
