aboutsummaryrefslogtreecommitdiff
path: root/sys/arm64/include/pte.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm64/include/pte.h')
-rw-r--r--sys/arm64/include/pte.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/arm64/include/pte.h b/sys/arm64/include/pte.h
index 645cf3154226..da70dc4cda16 100644
--- a/sys/arm64/include/pte.h
+++ b/sys/arm64/include/pte.h
@@ -73,8 +73,10 @@ typedef uint64_t pt_entry_t; /* page table entry */
/* Level 0 table, 512GiB per entry */
#define L0_SHIFT 39
+#define L0_SIZE (1ul << L0_SHIFT)
+#define L0_OFFSET (L0_SIZE - 1ul)
#define L0_INVAL 0x0 /* An invalid address */
-#define L0_BLOCK 0x1 /* A block */
+ /* 0x1 Level 0 doesn't support block translation */
/* 0x2 also marks an invalid address */
#define L0_TABLE 0x3 /* A next-level table */
@@ -83,16 +85,16 @@ typedef uint64_t pt_entry_t; /* page table entry */
#define L1_SIZE (1 << L1_SHIFT)
#define L1_OFFSET (L1_SIZE - 1)
#define L1_INVAL L0_INVAL
-#define L1_BLOCK L0_BLOCK
+#define L1_BLOCK 0x1
#define L1_TABLE L0_TABLE
/* Level 2 table, 2MiB per entry */
#define L2_SHIFT 21
#define L2_SIZE (1 << L2_SHIFT)
#define L2_OFFSET (L2_SIZE - 1)
-#define L2_INVAL L0_INVAL
-#define L2_BLOCK L0_BLOCK
-#define L2_TABLE L0_TABLE
+#define L2_INVAL L1_INVAL
+#define L2_BLOCK L1_BLOCK
+#define L2_TABLE L1_TABLE
#define L2_BLOCK_MASK UINT64_C(0xffffffe00000)
@@ -106,7 +108,12 @@ typedef uint64_t pt_entry_t; /* page table entry */
/* 0x2 also marks an invalid address */
#define L3_PAGE 0x3
-#define Ln_ENTRIES (1 << 9)
+#define L0_ENTRIES_SHIFT 9
+#define L0_ENTRIES (1 << L0_ENTRIES_SHIFT)
+#define L0_ADDR_MASK (L0_ENTRIES - 1)
+
+#define Ln_ENTRIES_SHIFT 9
+#define Ln_ENTRIES (1 << Ln_ENTRIES_SHIFT)
#define Ln_ADDR_MASK (Ln_ENTRIES - 1)
#define Ln_TABLE_MASK ((1 << 12) - 1)