blob: 67e4b1b8bf66a1e3bcae6cb8cca1285a0815c9ed [file] [log] [blame]
Arthur Heymans597b9e92022-04-19 20:48:42 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
3/*
4 * For reference see "AMD64 Architecture Programmer's Manual Volume 2",
5 * Document 24593-Rev. 3.31-July 2019 Chapter 5.3.4
6 *
7 * Page table attributes: WB, User+Supervisor, Present, Writeable, Accessed, Dirty
8 */
9
10.section .rodata
11#define _PRES (1ULL << 0)
12#define _RW (1ULL << 1)
13#define _US (1ULL << 2)
14#define _A (1ULL << 5)
15#define _D (1ULL << 6)
16#define _PS (1ULL << 7)
17#define _GEN_DIR(a) (_PRES + _RW + _US + _A + (a))
18#define _GEN_PAGE(a) (_PRES + _RW + _US + _PS + _A + _D + (a))
19
20.global PM4LE
Arthur Heymansee83be42024-02-02 18:49:53 +010021.align 4096
Arthur Heymans597b9e92022-04-19 20:48:42 +020022PM4LE:
23.quad _GEN_DIR(PDPE_table)
24
25.align 4096
26PDE_tables: /* identity map 2MiB pages */
27.rept 2048
28.quad _GEN_PAGE(0x200000 * ((. - PDE_tables) >> 3))
29.endr
30
31.align 4096
32PDPE_table: /* Point to PDE */
33.rept 4
34.quad _GEN_DIR(PDE_tables + 4096 * ((. - PDPE_table) >> 3))
35.endr