|
Kernelite 0.1.0
Kernelite is a minimalist, educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction.
|
FLAT BLOCK/PAGE DATA DESCRIPTOR LAYOUT — maps real physical memory. More...
#include <page_table.h>
Data Fields | |
| uint64_t | valid: 1 |
| uint64_t | is_page: 1 |
| uint64_t | attr_indx: 3 |
| uint64_t | non_secure: 1 |
| uint64_t | ap: 2 |
| uint64_t | sh: 2 |
| uint64_t | access_flag: 1 |
| uint64_t | non_global: 1 |
| uint64_t | frame_addr_47_12: 36 |
| uint64_t | frame_addr_49_48: 2 |
| uint64_t | guarded_page: 1 |
| uint64_t | dirty_bit: 1 |
| uint64_t | contiguous: 1 |
| uint64_t | pxn: 1 |
| uint64_t | xn: 1 |
| uint64_t | sw_reserved: 4 |
| uint64_t | attr_indx_3: 1 |
| uint64_t | po_index: 3 |
| uint64_t | amec: 1 |
FLAT BLOCK/PAGE DATA DESCRIPTOR LAYOUT — maps real physical memory.
Represents a 64-bit Stage 1 VMSAv8-64 block or page descriptor (4 KB granule) as defined in ARMv8/ARMv9 Architecture Reference Manual.
Lower attributes (bits [11:2]) control memory type, permissions, and shareability. The output address window (bits [49:12]) holds the physical frame address. Upper attributes (bits [63:50]) carry execution controls and feature extensions.
| uint64_t page_desc_t::access_flag |
[Bit 10] AF — Access Flag. Must be 1 when software manages the flag; set automatically by hardware when FEAT_HAFDBS is enabled.
| uint64_t page_desc_t::amec |
[Bit 63] AMEC / nse — Realm Management Extension MECID control bit (FEAT_RME); selects the Memory Encryption Context for this page. RES0 when FEAT_RME is not implemented.
| uint64_t page_desc_t::ap |
[Bits 7:6] AP[2:1] — Data Access Permissions. 00 = EL1 RW / EL0 none, 01 = EL1+EL0 RW, 10 = EL1 RO / EL0 none, 11 = EL1+EL0 RO.
| uint64_t page_desc_t::attr_indx |
[Bits 4:2] AttrIndx[2:0] — index into MAIR_EL1 selecting the memory attribute (see mem_type_t for the kernel's slot assignments).
| uint64_t page_desc_t::attr_indx_3 |
[Bit 59] AttrIndx[3] (FEAT_AIE) or PBHA[0] (FEAT_HPDS2) — extends the MAIR index to 4 bits when FEAT_AIE is implemented; otherwise Page-Based Hardware Attribute bit 0.
| uint64_t page_desc_t::contiguous |
[Bit 52] Contiguous — hint to the TLB that this entry is part of a naturally-aligned contiguous set (16 × 4 KB for 4 KB granule), allowing a single TLB entry to cover the whole range.
| uint64_t page_desc_t::dirty_bit |
[Bit 51] DBM — Dirty Bit Modifier (FEAT_HAFDBS). When 1, hardware clears AP[2] on first write, marking the page dirty; otherwise this bit is available as a software dirty flag.
| uint64_t page_desc_t::frame_addr_47_12 |
[Bits 47:12] OA[47:12] — Output (physical) address of the 4 KB-aligned frame or block base (bits 11:0 are always 0 for 4 KB granule).
| uint64_t page_desc_t::frame_addr_49_48 |
[Bits 49:48] OA[49:48] — Additional PA bits when TCR_ELx.DS == 1 (FEAT_LPA, 52-bit PA); otherwise RES0.
| uint64_t page_desc_t::guarded_page |
[Bit 50] GP — Guarded Page (FEAT_BTI). When 1, the CPU enforces Branch Target Identification on indirect branches into this page.
| uint64_t page_desc_t::is_page |
[Bit 1] Descriptor type — 0 = block (L1/L2), 1 = page (L3). Combined with valid: L1/L2 block = 0b01, L3 page = 0b11.
| uint64_t page_desc_t::non_global |
[Bit 11] nG — Non-Global. When 1, TLB entries are tagged with the current ASID and are not global; used for process-private mappings.
| uint64_t page_desc_t::non_secure |
[Bit 5] NS — Non-Secure PA space selection (Secure state only); RES0 in Non-secure state.
| uint64_t page_desc_t::po_index |
[Bits 62:60] POIndex[2:0] (FEAT_S1POE) or PBHA[3:1] (FEAT_HPDS2) — Protection Object index for overlay permissions when FEAT_S1POE is active; otherwise Page-Based Hardware Attribute bits [3:1] passed to the interconnect.
| uint64_t page_desc_t::pxn |
[Bit 53] PXN — Privileged Execute-Never. When 1, execution at EL1 from this region causes a Permission fault.
| uint64_t page_desc_t::sh |
[Bits 9:8] SH[1:0] — Shareability domain for Normal memory. 00 = Non-shareable, 10 = Outer Shareable, 11 = Inner Shareable. (01 is reserved.)
| uint64_t page_desc_t::sw_reserved |
[Bits 58:55] IGNORED / software use — hardware does not interpret these bits; available for OS-defined flags (e.g. swap, COW markers).
| uint64_t page_desc_t::valid |
[Bit 0] Valid — must be 1; a 0 causes a translation fault.
| uint64_t page_desc_t::xn |
[Bit 54] UXN / XN — Unprivileged Execute-Never. When 1, execution at EL0 (and at all levels for non-stage-1 descriptors) is forbidden.