[Krafton Jungle] PintOS
2.0.0
크래프톤 정글 PintOS
Loading...
Searching...
No Matches
pte.h
Go to the documentation of this file.
1
#ifndef THREADS_PTE_H
2
#define THREADS_PTE_H
3
4
#include "
threads/vaddr.h
"
5
6
/* Functions and macros for working with x86 hardware page tables.
7
* See vaddr.h for more generic functions and macros for virtual addresses.
8
*
9
* Virtual addresses are structured as follows:
10
* 63 48 47 39 38 30 29 21 20 12 11 0
11
* +-------------+----------------+----------------+----------------+-------------+------------+
12
* | Sign Extend | Page-Map | Page-Directory | Page-directory | Page-Table | Physical |
13
* | | Level-4 Offset | Pointer | Offset | Offset | Offset |
14
* +-------------+----------------+----------------+----------------+-------------+------------+
15
* | | | | | |
16
* +------- 9 ------+------- 9 ------+------- 9 ------+----- 9 -----+---- 12 ----+
17
* Virtual Address
18
*/
19
20
#define PML4SHIFT 39UL
21
#define PDPESHIFT 30UL
22
#define PDXSHIFT 21UL
23
#define PTXSHIFT 12UL
24
25
#define PML4(la) ((((uint64_t) (la)) >> PML4SHIFT) & 0x1FF)
26
#define PDPE(la) ((((uint64_t) (la)) >> PDPESHIFT) & 0x1FF)
27
#define PDX(la) ((((uint64_t) (la)) >> PDXSHIFT) & 0x1FF)
28
#define PTX(la) ((((uint64_t) (la)) >> PTXSHIFT) & 0x1FF)
29
#define PTE_ADDR(pte) ((uint64_t) (pte) & ~0xFFF)
30
31
/* The important flags are listed below.
32
When a PDE or PTE is not "present", the other flags are
33
ignored.
34
A PDE or PTE that is initialized to 0 will be interpreted as
35
"not present", which is just fine. */
36
#define PTE_FLAGS 0x00000000000000fffUL
/* Flag bits. */
37
#define PTE_ADDR_MASK 0xffffffffffffff000UL
/* Address bits. */
38
#define PTE_AVL 0x00000e00
/* Bits available for OS use. */
39
#define PTE_P 0x1
/* 1=present, 0=not present. */
40
#define PTE_W 0x2
/* 1=read/write, 0=read-only. */
41
#define PTE_U 0x4
/* 1=user/kernel, 0=kernel only. */
42
#define PTE_A 0x20
/* 1=accessed, 0=not acccessed. */
43
#define PTE_D 0x40
/* 1=dirty, 0=not dirty (PTEs only). */
44
45
#endif
/* threads/pte.h */
vaddr.h
include
threads
pte.h
Generated by
1.9.5