Commit Graph
100 Commits
Author SHA1 Message Date
harraiken a1899fd1fa Implement canonical address validation routine 2026-03-25 15:03:33 +01:00
harraiken 5748e73853 Remove redundant static initialization of LowestPhysicalPage 2026-03-25 15:03:33 +01:00
harraiken 792157eab1 Improve type safety of physical page boundaries initialization 2026-03-25 15:03:33 +01:00
harraiken 14276179a7 Correct physical memory range detection 2026-03-25 15:03:33 +01:00
harraiken 71684314c7 Fix uninitialized PTE pages causing memory corruption 2026-03-25 15:03:33 +01:00
harraiken b959e1908f Add MIN and MAX helper macros 2026-03-25 15:03:33 +01:00
harraiken 5cca5970b1 Implement basic non-paged pool allocator 2026-03-25 15:03:33 +01:00
harraiken 6c6b1f6a52 Initialize paged pool after PFN database setup 2026-03-25 15:03:33 +01:00
harraiken 706aca6e20 Initialize paged pool alongside non-paged pool 2026-03-25 15:03:33 +01:00
harraiken cd60cd7b1a Implement page allocation interface 2026-03-25 15:03:33 +01:00
harraiken a6b050ddf2 Correct comment phrasing 2026-03-25 15:03:33 +01:00
harraiken 398de5cb5b Expose the number of available physical pages 2026-03-25 15:03:33 +01:00
harraiken 37d70c449c Refactor PFN linking logic 2026-03-25 15:03:33 +01:00
harraiken 50654a28b5 Add definition for guarded PTE flag and remove hardcoded value 2026-03-25 15:03:33 +01:00
harraiken 1f8d2a0370 Add interface to retrieve page map level (PML) 2026-03-25 15:03:33 +01:00
harraiken 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
harraiken c303694384 Reorder initialization sequence and flush TLB 2026-03-25 15:03:33 +01:00
harraiken 4de76886ee Map PDE and PTE ranges for i686 non-paged pool 2026-03-25 15:03:33 +01:00
harraiken 52355698a9 Refactor EFI memory mapping to support distinct mapping strategies 2026-03-25 15:03:33 +01:00
harraiken 420a66629b Fix boot image size alignment calculation 2026-03-25 15:03:33 +01:00
harraiken 59f851f22c Minor style fixes 2026-03-25 15:03:33 +01:00
harraiken 58ed35b0e4 Deduplicate PFN descriptor processing logic across architectures 2026-03-25 15:03:33 +01:00
harraiken dc2c24e83e Fix stale comment 2026-03-25 15:03:33 +01:00
harraiken 932e951d4b Ensure paging hierarchy exists before processing memory descriptors 2026-03-25 15:03:33 +01:00
harraiken b7f85909cb Introduce page directory initialization helper 2026-03-25 15:03:33 +01:00
harraiken ca661d1201 Remove explicit identity mapping for internal page tables 2026-03-25 15:03:33 +01:00
harraiken 1be5732789 Fix coding style 2026-03-25 15:03:33 +01:00
harraiken e08af6bfd3 Map and zero entire PFN database upfront 2026-03-25 15:03:33 +01:00
harraiken 78fac504b7 Refactor PFN database initialization loop on i686 2026-03-25 15:03:33 +01:00
harraiken 157c48ce7f Fix missing assignment of PointerPte 2026-03-25 15:03:33 +01:00
harraiken 3b397aca92 Refactor PFN initialization to ensure proper page table setup 2026-03-25 15:03:33 +01:00
harraiken 755c3fe1bf Use 64-bit format specifiers for memory mapping logs 2026-03-25 15:03:33 +01:00
harraiken 75484e8c58 Fix physical address limit checks 2026-03-25 15:03:33 +01:00
harraiken 3799dbae65 Fix PFN truncation on i686 with PAE enabled 2026-03-25 15:03:33 +01:00
harraiken aa7d9bb417 Centralize memory layout dumping 2026-03-25 15:03:33 +01:00
harraiken 21fb192790 Handle non-paged pool overflow 2026-03-25 15:03:33 +01:00
harraiken a4f5211a96 Remove redundant PFN database alignment 2026-03-25 15:03:33 +01:00
harraiken 9da11d827e Overhaul kernel memory layout initialization and pool sizing 2026-03-25 15:03:33 +01:00
harraiken bcd3032fe3 Enable non-paged pool setup 2026-03-25 15:03:33 +01:00
harraiken d8792cc9db Fix PFN database size calculation call sites 2026-03-25 15:03:33 +01:00
harraiken a2335900ad Move PFN database size tracking to memory layout 2026-03-25 15:03:33 +01:00
harraiken 94320928bc Refactor memory layout structure 2026-03-25 15:03:33 +01:00
harraiken 17e096f18c Add private helper declaration 2026-03-25 15:03:33 +01:00
harraiken 66300103e1 Calculate aligned boot image size from loader parameters 2026-03-25 15:03:33 +01:00
harraiken 8d05099d7b Add skeleton for memory pool allocator 2026-03-25 15:03:33 +01:00
harraiken 488736512f Fix incorrect header guard comment 2026-03-25 15:03:33 +01:00
harraiken a326fea9af Limit system PTE space mapping to calculated pool size 2026-03-25 15:03:33 +01:00
harraiken bd7129ce13 Calculate total boot image size and pass it to kernel 2026-03-25 15:03:33 +01:00
harraiken af9cc43b1d Remove unused kernel base address definition 2026-03-25 15:03:33 +01:00
harraiken d272d2cb78 Ensure contiguous virtual memory mapping 2026-03-25 15:03:33 +01:00
harraiken b435752cbf Correctly advance virtual address after mapping non-free regions 2026-03-25 15:03:33 +01:00
harraiken 2e0a32ca1d Rollback bootloader memory management changes 2026-03-25 15:03:33 +01:00
harraiken 8554c634df Fix broken PPE check on i686 2026-03-25 15:03:33 +01:00
harraiken 8577d23e47 Add routine to retrieve installed memory size 2026-03-25 15:03:33 +01:00
harraiken bc85eb3c12 Add missing annotations 2026-03-25 15:03:33 +01:00
harraiken 52c119885c Standardize ValidPte setup across architectures 2026-03-25 15:03:33 +01:00
harraiken efe7f28675 Correctly initialize PFN entries for pre-mapped KSEG0 based memory 2026-03-25 15:03:33 +01:00
harraiken c29afe477c Annotate input parameters 2026-03-25 15:03:33 +01:00
harraiken ae43f7c723 Drop obsolete KSEG0_KERNEL_BASE definition 2026-03-25 15:03:33 +01:00
harraiken c8792a013a Abstract base mapping address retrieval 2026-03-25 15:03:33 +01:00
harraiken edfae7ec6a Extract MapDescriptor logic and simplify memory mapping API 2026-03-25 15:03:33 +01:00
harraiken 31002b27be Clean up unused physical-to-virtual conversion routines 2026-03-25 15:03:33 +01:00
harraiken 44a217ea14 Update function documentation and remove debug prints 2026-03-25 15:03:33 +01:00
harraiken 4a26507228 Remove manual virtual address tracking from boot sequence 2026-03-25 15:03:33 +01:00
harraiken 33d41a9442 Relocate kernel and modules to KSEG0 memory space 2026-03-25 15:03:33 +01:00
harraiken d2374799eb Temporary fix for PAE addressing limits and KSEG0 base mapping 2026-03-25 15:03:33 +01:00
harraiken 0ee46924a7 Prevent adding referenced pages to the free list 2026-03-25 15:03:33 +01:00
harraiken 3384556543 Correctly setup PFN database for ROM and in-use pages 2026-03-25 15:03:33 +01:00
harraiken 3b8359042b Ensure every page in a bad memory region is marked as bad 2026-03-25 15:03:33 +01:00
harraiken c8fa998e38 Make memory descriptor processing architecture-dependent 2026-03-25 15:03:33 +01:00
harraiken 807b0a736f Add logic to insert pages at the head of standby list 2026-03-25 15:03:33 +01:00
harraiken cb61566e8b Add temporary fallback for BeginStandbyList insertion 2026-03-25 15:03:33 +01:00
harraiken 41eed4c7ad Allow PFN insertion at the beginning of standby list 2026-03-25 15:03:33 +01:00
harraiken 042d0fa03a Optimize system PTE deallocation by avoiding immediate and expensive TLB flush 2026-03-25 15:03:33 +01:00
harraiken 6accbfd2ae Replace ULONG with PFN_COUNT in system PTE variables 2026-03-25 15:03:33 +01:00
harraiken ec27cb7f76 Fix deadlock by reducing lock scope 2026-03-25 15:03:33 +01:00
harraiken bfa5cddb57 Add missing semicolon 2026-03-25 15:03:33 +01:00
harraiken f8cdcc3f75 Implement kernel stack deallocation and physical page freeing logic 2026-03-25 15:03:33 +01:00
harraiken 602e837e11 Add mechanism to free system PTEs and merge adjacent clusters 2026-03-25 15:03:33 +01:00
harraiken 0ca04a7dfe Clean up paging code 2026-03-25 15:03:33 +01:00
harraiken 3270f920dd Remove dead code from paging and PTE management 2026-03-25 15:03:33 +01:00
harraiken 4f6e8bc07a Initialize system PTEs with arch-specific list terminator 2026-03-25 15:03:33 +01:00
harraiken 4aa841650a Abstract PTE list terminator into paging layer 2026-03-25 15:03:33 +01:00
harraiken c5ea9e4489 Add support for transitioning PTE to invalid state 2026-03-25 15:03:33 +01:00
harraiken c6041b02ae Add explicit default initialization for MM::Colors::ModifiedPages list 2026-03-25 15:03:33 +01:00
harraiken 0153b2fb33 Properly handle bad physical pages 2026-03-25 15:03:33 +01:00
harraiken e0bcac3722 Implement generic PFN list linking function 2026-03-25 15:03:33 +01:00
harraiken 466b0c8eab Introduce helper functions for querying the software prototype and transition bits of PTE 2026-03-25 15:03:33 +01:00
harraiken 374f404324 Introduce per-page-color modified page lists 2026-03-25 15:03:33 +01:00
harraiken 6308fd048b Remove redundant check for invisible memory regions 2026-03-25 15:03:33 +01:00
harraiken 4963ff5367 Initialize PTE template dynamically to resolve build warnings 2026-03-25 15:03:33 +01:00
harraiken e0e3482326 Prevent initialization of invisible memory ranges 2026-03-25 15:03:33 +01:00
harraiken 896803e248 Improve formatting 2026-03-25 15:03:33 +01:00
harraiken b5ebd24f24 Adjust thread initialization to match new stack allocator signature 2026-03-25 15:03:33 +01:00
harraiken e1144da195 Simplify stack page count calculation 2026-03-25 15:03:33 +01:00
harraiken 0c9ea2ed20 Implement kernel stack allocation logic 2026-03-25 15:03:33 +01:00
harraiken 43d0e8932d Implement logic to link physical pages to PTEs 2026-03-25 15:03:33 +01:00
harraiken d88fa93df9 Introduce page fault handling infrastructure 2026-03-25 15:03:33 +01:00
harraiken 9cfc22e1f3 Reserve space for color tables to fix invalid memory access 2026-03-25 15:03:33 +01:00
harraiken d9a95527f3 Ensure page map structures are self-mapped 2026-03-25 15:03:33 +01:00