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 #include <linux/const.h> 11 #include <bitops.h> 12 13 #define PAGE_SHIFT 12 14 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 15 #define PAGE_MASK (~(PAGE_SIZE-1)) 16 17 #ifndef __ASSEMBLY__ 18 19 #ifdef __x86_64__ 20 #define LARGE_PAGE_SIZE (512 * PAGE_SIZE) 21 #else 22 #define LARGE_PAGE_SIZE (1024 * PAGE_SIZE) 23 #endif 24 25 #define PT_PRESENT_MASK (1ull << 0) 26 #define PT_WRITABLE_MASK (1ull << 1) 27 #define PT_USER_MASK (1ull << 2) 28 #define PT_ACCESSED_MASK (1ull << 5) 29 #define PT_DIRTY_MASK (1ull << 6) 30 #define PT_PAGE_SIZE_MASK (1ull << 7) 31 #define PT64_NX_MASK (1ull << 63) 32 #define PT_ADDR_MASK GENMASK_ULL(51, 12) 33 34 #ifdef __x86_64__ 35 #define PAGE_LEVEL 4 36 #define PGDIR_WIDTH 9 37 #define PGDIR_MASK 511 38 #else 39 #define PAGE_LEVEL 2 40 #define PGDIR_WIDTH 10 41 #define PGDIR_MASK 1023 42 #endif 43 44 #endif /* !__ASSEMBLY__ */ 45 #endif 46