xref: /kvm-unit-tests/lib/x86/asm/page.h (revision 3e394a5852524d53a7c838f134ac3e7260f5edfd)
1 #ifndef _ASM_X86_PAGE_H_
2 #define _ASM_X86_PAGE_H_
3 /*
4  * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 
9 
10 #define PAGE_SIZE	4096ul
11 #ifdef __x86_64__
12 #define LARGE_PAGE_SIZE	(512 * PAGE_SIZE)
13 #else
14 #define LARGE_PAGE_SIZE	(1024 * PAGE_SIZE)
15 #endif
16 
17 #define PTE_PRESENT	(1ull << 0)
18 #define PTE_WRITE	(1ull << 1)
19 #define PTE_USER	(1ull << 2)
20 #define PTE_PSE		(1ull << 7)
21 #define PTE_ADDR	(0xffffffffff000ull)
22 
23 #ifdef __x86_64__
24 #define	PAGE_LEVEL	4
25 #define	PGDIR_WIDTH	9
26 #define	PGDIR_MASK	511
27 #else
28 #define	PAGE_LEVEL	2
29 #define	PGDIR_WIDTH	10
30 #define	PGDIR_MASK	1023
31 #endif
32 
33 #endif
34