MOS Source Code
Loading...
Searching...
No Matches
paging_impl.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
6
7typedef volatile struct __packed
8{
9 bool present : 1;
10 bool writable : 1;
11 bool usermode : 1;
12 bool write_through : 1;
14 bool accessed : 1;
15 bool _ignored1 : 1;
16 bool page_size : 1; // reserved for pml4e and pml5e, 1 GiB page for pml3e
18 bool hlat_restart : 1; // for HLAT: if 1, linear-address translation is restarted with ordinary paging
21 bool no_execute : 1;
22} x86_pde64_t, x86_pmde64_t, x86_pude64_t; // PD, PDPT (PMD), PML4 (PUD)
23
24MOS_STATIC_ASSERT(sizeof(x86_pde64_t) == sizeof(pte_content_t), "x86_pde64_t differs from pde_content_t");
25
26typedef volatile struct __packed
27{
28 bool present : 1;
29 bool writable : 1;
30 bool usermode : 1;
31 bool write_through : 1;
33 bool accessed : 1;
34 bool dirty : 1;
35 bool page_size : 1; // must be 1
36 bool global : 1;
38 bool hlat_restart : 1; // for HLAT: if 1, linear-address translation is restarted with ordinary paging
39 bool pat : 1;
40 pfn_t pfn : 39;
41 u32 reserved_2 : 7; // must be 0
43 bool no_execute : 1;
44} x86_pde64_huge_t, x86_pmde64_huge_t; // 2MiB, 1GiB huge pages for PD, PDPT (PMD) respectively
45
46MOS_STATIC_ASSERT(sizeof(x86_pde64_huge_t) == sizeof(pte_content_t), "x86_pde64_huge_t differs from pde_content_t");
47
48typedef volatile struct __packed
49{
50 bool present : 1;
51 bool writable : 1;
52 bool usermode : 1;
53 bool write_through : 1;
55 bool accessed : 1;
56 bool dirty : 1;
57 bool pat : 1;
58 bool global : 1;
60 bool hlat_restart : 1;
61 pfn_t pfn : 40;
64 bool no_execute : 1;
65} x86_pte64_t; // PTE (4 KiB page)
66
67MOS_STATIC_ASSERT(sizeof(x86_pte64_t) == sizeof(pte_content_t), "x86_pde64_t differs from pte_content_t");
68
69void x86_paging_setup(void);
#define __packed
Definition mos_global.h:29
#define MOS_STATIC_ASSERT
Definition mos_global.h:14
struct x86_pde64_huge_t x86_pmde64_huge_t
struct x86_pde64_t x86_pude64_t
struct x86_pde64_t x86_pmde64_t
void x86_paging_setup(void)
Definition paging.cpp:61
pfn_t page_table_paddr
bool cache_disabled
bool cache_disabled
unsigned int u32
Definition types.h:17
unsigned long long pfn_t
Definition types.h:37
long pte_content_t
Definition types.h:82
unsigned char u8
Definition types.h:15