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