Compare commits

..

213 Commits

Author SHA1 Message Date
1339943473 Implement MM::KernelPool::FreeProcessorStructures
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 25s
Builds / ExectOS (i686, debug) (push) Successful in 37s
Builds / ExectOS (i686, release) (push) Successful in 27s
Builds / ExectOS (amd64, debug) (push) Successful in 39s
2026-03-25 15:03:33 +01:00
160222fd3b Implement TLB flushing for cache attribute changes during page removal 2026-03-25 15:03:33 +01:00
7e4b425702 Fix check for PTE removal flag 2026-03-25 15:03:33 +01:00
bbdbdc7bcd Mark PFN as deleted instead of clearing PteAddress when freeing pages 2026-03-25 15:03:33 +01:00
28dd16fb94 Revert 1e01c52c0c 2026-03-25 15:03:33 +01:00
6ac0fd0a1c Clear the internal list links to prevent corruption 2026-03-25 15:03:33 +01:00
202b98a3fd Rephrase comments for consistency 2026-03-25 15:03:33 +01:00
b323956f4b Add bounds checking and implement reclamation for large expansion pool allocations 2026-03-25 15:03:33 +01:00
6e992f3005 Set PTE frame for non-paged pool allocations 2026-03-25 15:03:33 +01:00
d1a4b378b1 Precommit page map to allocate memory 2026-03-25 15:03:33 +01:00
3ca3a86c0f Fix memory map size tracking and memory leak 2026-03-25 15:03:33 +01:00
8ee50255bb Fix memory corruption caused by UEFI memory map size changes during allocation 2026-03-25 15:03:33 +01:00
f1b9d57bf7 Strip MM_POOL_PROTECTED flag to maintain NT compatibility and ensure correct pool tracking hash lookups 2026-03-25 15:03:33 +01:00
f18c9ca5b4 Add expansion table and overflow handling for pool tag tracking 2026-03-25 15:03:33 +01:00
5fa948d57e Update pool tracking statistics when resizing big allocations table 2026-03-25 15:03:33 +01:00
6577876285 Unify naming convention for pool tracking structures 2026-03-25 15:03:33 +01:00
caf0287135 Implement pool allocations and frees tracking 2026-03-25 15:03:33 +01:00
95a3b5d7e2 Refactor big allocation tracker to use Tag 2026-03-25 15:03:33 +01:00
579ac1d90e Remove temporary hack and allocate processor structures from non-paged pool 2026-03-25 15:03:33 +01:00
4015b4b2f3 Implement core pool allocation and deallocation logic 2026-03-25 15:03:33 +01:00
0375a08ca5 Add definitions for pool management structures 2026-03-25 15:03:33 +01:00
d55a8219e3 Revert e2eff2b836 2026-03-25 15:03:33 +01:00
8a35727e43 Fix DebugPrint definition 2026-03-25 15:03:33 +01:00
322fea763b Replace NULL with NULLPTR 2026-03-25 15:03:33 +01:00
77e487495b Implement RAII guard for memory pool synchronization 2026-03-25 15:03:33 +01:00
7b3f4bb35a Decouple pool initialization and validation from allocation logic 2026-03-25 15:03:33 +01:00
427c7ae810 Track valid physical memory pages using a PFN bitmap 2026-03-25 15:03:33 +01:00
c575352f90 Update panic invocations with detailed error context 2026-03-25 15:03:33 +01:00
d8a430ee42 Add runlevel verification to memory pool allocations 2026-03-25 15:03:33 +01:00
2e5c259a5a Introduce pool allocation and free routines 2026-03-25 15:03:33 +01:00
66df8fddda Fix critical memory corruption bug caused by overwriting active page tables marked as free memory 2026-03-25 15:03:33 +01:00
4f16957016 Ensure correct PTE value assignment via accessors 2026-03-25 15:03:33 +01:00
e1b9664ec0 Unify PTE type definitions across architectures 2026-03-25 15:03:33 +01:00
60d8844afe Refactor panic calls in memory manager 2026-03-25 15:03:33 +01:00
d39ddabd04 Calculate virtual address per page when initializing PFN entries 2026-03-25 15:03:33 +01:00
6044dbaac9 Initialize system PTE pool for non-paged expansion pool 2026-03-25 15:03:33 +01:00
3d2be65545 Make MM::Pte::InitializeSystemPtePool public 2026-03-25 15:03:33 +01:00
caff02383c Correct PTE mapping logic during multiple page allocation 2026-03-25 15:03:33 +01:00
58bc1839f5 Implement memory deallocation and coalescing for non-paged pool 2026-03-25 15:03:33 +01:00
72b3fe8209 Set up owner pointers for all pages during pool initialization 2026-03-25 15:03:33 +01:00
a1899fd1fa Implement canonical address validation routine 2026-03-25 15:03:33 +01:00
5748e73853 Remove redundant static initialization of LowestPhysicalPage 2026-03-25 15:03:33 +01:00
792157eab1 Improve type safety of physical page boundaries initialization 2026-03-25 15:03:33 +01:00
14276179a7 Correct physical memory range detection 2026-03-25 15:03:33 +01:00
71684314c7 Fix uninitialized PTE pages causing memory corruption 2026-03-25 15:03:33 +01:00
b959e1908f Add MIN and MAX helper macros 2026-03-25 15:03:33 +01:00
5cca5970b1 Implement basic non-paged pool allocator 2026-03-25 15:03:33 +01:00
6c6b1f6a52 Initialize paged pool after PFN database setup 2026-03-25 15:03:33 +01:00
706aca6e20 Initialize paged pool alongside non-paged pool 2026-03-25 15:03:33 +01:00
cd60cd7b1a Implement page allocation interface 2026-03-25 15:03:33 +01:00
a6b050ddf2 Correct comment phrasing 2026-03-25 15:03:33 +01:00
398de5cb5b Expose the number of available physical pages 2026-03-25 15:03:33 +01:00
37d70c449c Refactor PFN linking logic 2026-03-25 15:03:33 +01:00
50654a28b5 Add definition for guarded PTE flag and remove hardcoded value 2026-03-25 15:03:33 +01:00
1f8d2a0370 Add interface to retrieve page map level (PML) 2026-03-25 15:03:33 +01:00
bd9af3bb5c Fix PFN calculation truncation for memory above 4GB to prevent memory descriptor aliasing on PAE systems 2026-03-25 15:03:33 +01:00
c303694384 Reorder initialization sequence and flush TLB 2026-03-25 15:03:33 +01:00
4de76886ee Map PDE and PTE ranges for i686 non-paged pool 2026-03-25 15:03:33 +01:00
52355698a9 Refactor EFI memory mapping to support distinct mapping strategies 2026-03-25 15:03:33 +01:00
420a66629b Fix boot image size alignment calculation 2026-03-25 15:03:33 +01:00
59f851f22c Minor style fixes 2026-03-25 15:03:33 +01:00
58ed35b0e4 Deduplicate PFN descriptor processing logic across architectures 2026-03-25 15:03:33 +01:00
dc2c24e83e Fix stale comment 2026-03-25 15:03:33 +01:00
932e951d4b Ensure paging hierarchy exists before processing memory descriptors 2026-03-25 15:03:33 +01:00
b7f85909cb Introduce page directory initialization helper 2026-03-25 15:03:33 +01:00
ca661d1201 Remove explicit identity mapping for internal page tables 2026-03-25 15:03:33 +01:00
1be5732789 Fix coding style 2026-03-25 15:03:33 +01:00
e08af6bfd3 Map and zero entire PFN database upfront 2026-03-25 15:03:33 +01:00
78fac504b7 Refactor PFN database initialization loop on i686 2026-03-25 15:03:33 +01:00
157c48ce7f Fix missing assignment of PointerPte 2026-03-25 15:03:33 +01:00
3b397aca92 Refactor PFN initialization to ensure proper page table setup 2026-03-25 15:03:33 +01:00
755c3fe1bf Use 64-bit format specifiers for memory mapping logs 2026-03-25 15:03:33 +01:00
75484e8c58 Fix physical address limit checks 2026-03-25 15:03:33 +01:00
3799dbae65 Fix PFN truncation on i686 with PAE enabled 2026-03-25 15:03:33 +01:00
aa7d9bb417 Centralize memory layout dumping 2026-03-25 15:03:33 +01:00
21fb192790 Handle non-paged pool overflow 2026-03-25 15:03:33 +01:00
a4f5211a96 Remove redundant PFN database alignment 2026-03-25 15:03:33 +01:00
9da11d827e Overhaul kernel memory layout initialization and pool sizing 2026-03-25 15:03:33 +01:00
bcd3032fe3 Enable non-paged pool setup 2026-03-25 15:03:33 +01:00
d8792cc9db Fix PFN database size calculation call sites 2026-03-25 15:03:33 +01:00
a2335900ad Move PFN database size tracking to memory layout 2026-03-25 15:03:33 +01:00
94320928bc Refactor memory layout structure 2026-03-25 15:03:33 +01:00
17e096f18c Add private helper declaration 2026-03-25 15:03:33 +01:00
66300103e1 Calculate aligned boot image size from loader parameters 2026-03-25 15:03:33 +01:00
8d05099d7b Add skeleton for memory pool allocator 2026-03-25 15:03:33 +01:00
488736512f Fix incorrect header guard comment 2026-03-25 15:03:33 +01:00
a326fea9af Limit system PTE space mapping to calculated pool size 2026-03-25 15:03:33 +01:00
bd7129ce13 Calculate total boot image size and pass it to kernel 2026-03-25 15:03:33 +01:00
af9cc43b1d Remove unused kernel base address definition 2026-03-25 15:03:33 +01:00
d272d2cb78 Ensure contiguous virtual memory mapping 2026-03-25 15:03:33 +01:00
b435752cbf Correctly advance virtual address after mapping non-free regions 2026-03-25 15:03:33 +01:00
2e0a32ca1d Rollback bootloader memory management changes 2026-03-25 15:03:33 +01:00
8554c634df Fix broken PPE check on i686 2026-03-25 15:03:33 +01:00
8577d23e47 Add routine to retrieve installed memory size 2026-03-25 15:03:33 +01:00
bc85eb3c12 Add missing annotations 2026-03-25 15:03:33 +01:00
52c119885c Standardize ValidPte setup across architectures 2026-03-25 15:03:33 +01:00
efe7f28675 Correctly initialize PFN entries for pre-mapped KSEG0 based memory 2026-03-25 15:03:33 +01:00
c29afe477c Annotate input parameters 2026-03-25 15:03:33 +01:00
ae43f7c723 Drop obsolete KSEG0_KERNEL_BASE definition 2026-03-25 15:03:33 +01:00
c8792a013a Abstract base mapping address retrieval 2026-03-25 15:03:33 +01:00
edfae7ec6a Extract MapDescriptor logic and simplify memory mapping API 2026-03-25 15:03:33 +01:00
31002b27be Clean up unused physical-to-virtual conversion routines 2026-03-25 15:03:33 +01:00
44a217ea14 Update function documentation and remove debug prints 2026-03-25 15:03:33 +01:00
4a26507228 Remove manual virtual address tracking from boot sequence 2026-03-25 15:03:33 +01:00
33d41a9442 Relocate kernel and modules to KSEG0 memory space 2026-03-25 15:03:33 +01:00
d2374799eb Temporary fix for PAE addressing limits and KSEG0 base mapping 2026-03-25 15:03:33 +01:00
0ee46924a7 Prevent adding referenced pages to the free list 2026-03-25 15:03:33 +01:00
3384556543 Correctly setup PFN database for ROM and in-use pages 2026-03-25 15:03:33 +01:00
3b8359042b Ensure every page in a bad memory region is marked as bad 2026-03-25 15:03:33 +01:00
c8fa998e38 Make memory descriptor processing architecture-dependent 2026-03-25 15:03:33 +01:00
807b0a736f Add logic to insert pages at the head of standby list 2026-03-25 15:03:33 +01:00
cb61566e8b Add temporary fallback for BeginStandbyList insertion 2026-03-25 15:03:33 +01:00
41eed4c7ad Allow PFN insertion at the beginning of standby list 2026-03-25 15:03:33 +01:00
042d0fa03a Optimize system PTE deallocation by avoiding immediate and expensive TLB flush 2026-03-25 15:03:33 +01:00
6accbfd2ae Replace ULONG with PFN_COUNT in system PTE variables 2026-03-25 15:03:33 +01:00
ec27cb7f76 Fix deadlock by reducing lock scope 2026-03-25 15:03:33 +01:00
bfa5cddb57 Add missing semicolon 2026-03-25 15:03:33 +01:00
f8cdcc3f75 Implement kernel stack deallocation and physical page freeing logic 2026-03-25 15:03:33 +01:00
602e837e11 Add mechanism to free system PTEs and merge adjacent clusters 2026-03-25 15:03:33 +01:00
0ca04a7dfe Clean up paging code 2026-03-25 15:03:33 +01:00
3270f920dd Remove dead code from paging and PTE management 2026-03-25 15:03:33 +01:00
4f6e8bc07a Initialize system PTEs with arch-specific list terminator 2026-03-25 15:03:33 +01:00
4aa841650a Abstract PTE list terminator into paging layer 2026-03-25 15:03:33 +01:00
c5ea9e4489 Add support for transitioning PTE to invalid state 2026-03-25 15:03:33 +01:00
c6041b02ae Add explicit default initialization for MM::Colors::ModifiedPages list 2026-03-25 15:03:33 +01:00
0153b2fb33 Properly handle bad physical pages 2026-03-25 15:03:33 +01:00
e0bcac3722 Implement generic PFN list linking function 2026-03-25 15:03:33 +01:00
466b0c8eab Introduce helper functions for querying the software prototype and transition bits of PTE 2026-03-25 15:03:33 +01:00
374f404324 Introduce per-page-color modified page lists 2026-03-25 15:03:33 +01:00
6308fd048b Remove redundant check for invisible memory regions 2026-03-25 15:03:33 +01:00
4963ff5367 Initialize PTE template dynamically to resolve build warnings 2026-03-25 15:03:33 +01:00
e0e3482326 Prevent initialization of invisible memory ranges 2026-03-25 15:03:33 +01:00
896803e248 Improve formatting 2026-03-25 15:03:33 +01:00
b5ebd24f24 Adjust thread initialization to match new stack allocator signature 2026-03-25 15:03:33 +01:00
e1144da195 Simplify stack page count calculation 2026-03-25 15:03:33 +01:00
0c9ea2ed20 Implement kernel stack allocation logic 2026-03-25 15:03:33 +01:00
43d0e8932d Implement logic to link physical pages to PTEs 2026-03-25 15:03:33 +01:00
d88fa93df9 Introduce page fault handling infrastructure 2026-03-25 15:03:33 +01:00
9cfc22e1f3 Reserve space for color tables to fix invalid memory access 2026-03-25 15:03:33 +01:00
d9a95527f3 Ensure page map structures are self-mapped 2026-03-25 15:03:33 +01:00
47606faded Initialize paged pool sizing logic 2026-03-25 15:03:33 +01:00
b6c5bae289 Minor style fixes in MM includes 2026-03-25 15:03:33 +01:00
330c9e3eaf Update PTE support to use safe write accessors 2026-03-25 15:03:33 +01:00
2854f77159 Refactor memory clearing calls and cleanup code style 2026-03-25 15:03:33 +01:00
75dfcec5a6 Implement PFN database initialization and memory descriptor processing 2026-03-25 15:03:33 +01:00
f33fa0fdaf Expose PFN database lookup via GetPfnEntry 2026-03-25 15:03:33 +01:00
cdad8ffe2c Implement tracking of available physical pages 2026-03-25 15:03:33 +01:00
425780de69 Initialize system PTE pools and implement reservation routines 2026-03-25 15:03:33 +01:00
446d9af325 Initialize system page tables and configure kernel mappings 2026-03-25 15:03:33 +01:00
536d59c3a8 Include mm/colors.cc in kernel build configuration 2026-03-25 15:03:33 +01:00
4192e93157 Introduce page coloring support to memory manager 2026-03-25 15:03:33 +01:00
b32c66110b Add storage for PFN database size 2026-03-25 15:03:33 +01:00
cdb3c1a8da Initialize memory manager during kernel startup 2026-03-25 15:03:33 +01:00
5e54aca398 Update modified page list enum terminology 2026-03-25 15:03:33 +01:00
68604e1bc0 Update memory manager type definitions and constants 2026-03-25 15:03:33 +01:00
a4b36827e4 Bring up i686 page table initialization 2026-03-25 15:03:33 +01:00
e8512e9f45 Fix physical page count overflow by using 64-bit type 2026-03-25 15:03:33 +01:00
0448217c06 Fix PTE free list sentinel handling 2026-03-25 15:03:33 +01:00
f9b27b48b0 Select correct self-map base for PAE and non-PAE paging 2026-03-25 15:03:33 +01:00
eb621e0264 Extend PTE helpers with raw read and write support 2026-03-25 15:03:33 +01:00
ed769e023f Respect architecture-specific PTE layouts and write PTEs via PML-aware helpers 2026-03-25 15:03:33 +01:00
08b095d47c Make PPE mapping architecture-specific 2026-03-25 15:03:33 +01:00
87aa3494f9 Add early spin lock initialization 2026-03-25 15:03:33 +01:00
244af13500 Clarify page table entry offset semantics 2026-03-25 15:03:33 +01:00
e6d2574bf9 Fix paging abstraction for PDE/PTE virtual address calculation 2026-03-25 15:03:33 +01:00
6f9e537e86 Implement initial virtual memory layout setup 2026-03-25 15:03:33 +01:00
be6ad1658f Update SelfMapAddress 2026-03-25 15:03:33 +01:00
a45cd95b6f Call page table initialization 2026-03-25 15:03:33 +01:00
3c5bb52152 Add virtual address validation and system PTE helpers 2026-03-25 15:03:33 +01:00
3a311a0497 Move memory layout initialization to architecture-specific code 2026-03-25 15:03:33 +01:00
140b25ff76 Architecture-specific system PTE limits 2026-03-25 15:03:33 +01:00
c760016ee5 Extend memory layout 2026-03-25 15:03:33 +01:00
6a55b1a42c Remove unsupported PML4/PML5 PTE interfaces 2026-03-25 15:03:33 +01:00
d8b2af8f1e Split PTE implementation per architecture 2026-03-25 15:03:33 +01:00
28fc0ab435 Compute PTE count per page from entry size 2026-03-25 15:03:33 +01:00
329c22ae82 Implement early page table mapping routines 2026-03-25 15:03:33 +01:00
d27954091a Add bootstrap physical page allocator 2026-03-25 15:03:33 +01:00
df9028d425 Introduce kernel virtual memory layout 2026-03-25 15:03:33 +01:00
540c4df13e Compute PFN database size during MM initialization 2026-03-25 15:03:33 +01:00
0a2fb7ae38 Tidy up memory type verification helpers 2026-03-25 15:03:33 +01:00
6f824c55bb Harden PFN initialization and expose page count 2026-03-25 15:03:33 +01:00
f371b305ad Make memory type verification helpers accessible to PFN 2026-03-25 15:03:33 +01:00
24e20f3d8f Extract PFN management into separate module 2026-03-25 15:03:33 +01:00
c7bfc028b6 Refactor memory manager initialization into MM::Manager 2026-03-25 15:03:33 +01:00
9492ba09a6 Fix GetP5eAddress return type 2026-03-25 15:03:33 +01:00
4e7ab3585e Add missing virtual GetPteDistance to pagemap interface 2026-03-25 15:03:33 +01:00
9d27778e4c Add architecture-specific GetPteDistance 2026-03-25 15:03:33 +01:00
0796164cf8 Refactor XPA detection API 2026-03-25 15:03:33 +01:00
2f4d26b432 Fix incorrect pointer types 2026-03-25 15:03:33 +01:00
48fafd4a9a Fix incorrect pointer types 2026-03-25 15:03:33 +01:00
1996024e96 Split paging interface into arch-specific code 2026-03-25 15:03:33 +01:00
42a96ae5c3 Implement virtual address resolvers for all page map levels and add XPA status accessor 2026-03-25 15:03:33 +01:00
f9a057db2d Add MM::PageMap::GetXpaStatus() for querying PML level 2026-03-25 15:03:33 +01:00
f210c9e334 Refactor PageMap to enable architecture-specific VA translation 2026-03-25 15:03:33 +01:00
117d174e6e Add PFN_COUNT typedef 2026-03-25 15:03:33 +01:00
8334fe5a48 Correct LA57 paging base addresses, add self-map constants and extend PTE structures 2026-03-25 15:03:33 +01:00
7b7426738a Add kernel parameters section and fix minor formatting issues 2026-03-25 15:03:33 +01:00
8d4455de88 Prevent duplicate object generation by linking xtoskrnl with libxtos 2026-03-25 15:03:33 +01:00
b7f0f07f8b Add page list and PTE pool type enums 2026-03-25 15:03:33 +01:00
e831902363 Fix class name 2026-03-25 15:03:33 +01:00
f247726ee9 Add GetPageFrameNumber() to PTE interfaces 2026-03-25 15:03:33 +01:00
9449ee6eb1 Make MM::Paging::GetExtendedPhysicalAddressingStatus public 2026-03-25 15:03:33 +01:00
34586d8fa1 Replace writable flag with AttributesMask in PTE setup 2026-03-25 15:03:33 +01:00
05b9bb75a7 Add PTE attribute definitions 2026-03-25 15:03:33 +01:00
d752de20f6 Unify PTE pointer types across MM subsystem 2026-03-25 15:03:33 +01:00
fd7cc019ee Unify MMPML2_PTE field naming convention 2026-03-25 15:03:33 +01:00
8e48153852 Add input qualifiers to page map interface definitions 2026-03-25 15:03:33 +01:00
bf98860ff2 Add input qualifiers to paging interface definitions 2026-03-25 15:03:33 +01:00
c2d3f2e6f4 Add PTE management routines 2026-03-25 15:03:33 +01:00
779726c4d6 Add missing EmptyPteList field to MMPAGEMAP_INFO 2026-03-25 15:03:33 +01:00
4cf2c0c9e8 Implement unified PTE accessors and management helpers 2026-03-25 15:03:33 +01:00
576a2b7f1b Enhance kernel panic output
Some checks failed
Builds / ExectOS (i686, debug) (push) Successful in 31s
Builds / ExectOS (amd64, debug) (push) Successful in 33s
Builds / ExectOS (i686, release) (push) Failing after 39s
Builds / ExectOS (amd64, release) (push) Successful in 42s
2026-03-25 14:59:40 +01:00
916d124c9b Separate synchronization guards from spinlock implementation
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 29s
Builds / ExectOS (amd64, release) (push) Successful in 40s
Builds / ExectOS (i686, debug) (push) Successful in 38s
Builds / ExectOS (i686, release) (push) Successful in 34s
2026-03-21 22:44:00 +01:00

Diff Content Not Available