@@ -7,7 +7,14 @@
*/
-#define PAGE_SIZE 4096ul
+#include <linux/const.h>
+
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#ifndef __ASSEMBLY__
+
#ifdef __x86_64__
#define LARGE_PAGE_SIZE (512 * PAGE_SIZE)
#else
@@ -30,4 +37,5 @@
#define PGDIR_MASK 1023
#endif
+#endif /* !__ASSEMBLY__ */
#endif
@@ -2,6 +2,7 @@
#include "libcflat.h"
#include "desc.h"
#include "processor.h"
+#include "asm/page.h"
#define smp_id() 0
@@ -15,9 +16,6 @@ static int cpuid_7_ebx;
static int cpuid_7_ecx;
static int invalid_mask;
-#define PAGE_SIZE ((pt_element_t)4096)
-#define PAGE_MASK (~(PAGE_SIZE-1))
-
#define PT_BASE_ADDR_MASK ((pt_element_t)((((pt_element_t)1 << 40) - 1) & PAGE_MASK))
#define PT_PSE_BASE_ADDR_MASK (PT_BASE_ADDR_MASK & ~(1ull << 21))
@@ -4,6 +4,7 @@
#include "libcflat.h"
#include "processor.h"
#include "bitops.h"
+#include "asm/page.h"
struct vmcs {
u32 revision_id; /* vmcs revision identifier */
@@ -476,7 +477,6 @@ enum Ctrl1 {
#define EPT_PGDIR_ENTRIES (1 << EPT_PGDIR_WIDTH)
#define EPT_LEVEL_SHIFT(level) (((level)-1) * EPT_PGDIR_WIDTH + 12)
#define EPT_ADDR_MASK GENMASK_ULL(51, 12)
-#define PAGE_MASK (~(PAGE_SIZE-1))
#define PAGE_MASK_2M (~(PAGE_SIZE_2M-1))
#define EPT_VLT_RD 1