Xen maps the virtual memory space starting from L0 slot 4, so it's open
coded for macros with the offset '4'.
For more readable, add a new macro XEN_VM_MAPPING which defines the
start slot for Xen virtual memory mapping, and all virtual memory
regions are defined based on it.
Acked-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
xen/arch/arm/include/asm/mmu/layout.h | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/xen/arch/arm/include/asm/mmu/layout.h b/xen/arch/arm/include/asm/mmu/layout.h
index da6be276ac..2cb2382fbf 100644
--- a/xen/arch/arm/include/asm/mmu/layout.h
+++ b/xen/arch/arm/include/asm/mmu/layout.h
@@ -49,11 +49,14 @@
#define XEN_VIRT_START _AT(vaddr_t, MB(2))
#else
+#define IDENTITY_MAPPING_AREA_NR_L0 4
+#define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0)
+
#define SLOT0_ENTRY_BITS 39
#define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
#define SLOT0_ENTRY_SIZE SLOT0(1)
-#define XEN_VIRT_START (SLOT0(4) + _AT(vaddr_t, MB(2)))
+#define XEN_VIRT_START (XEN_VM_MAPPING + _AT(vaddr_t, MB(2)))
#endif
/*
@@ -116,12 +119,10 @@
#else /* ARM_64 */
-#define IDENTITY_MAPPING_AREA_NR_L0 4
-
-#define VMAP_VIRT_START (SLOT0(4) + GB(1))
+#define VMAP_VIRT_START (XEN_VM_MAPPING + GB(1))
#define VMAP_VIRT_SIZE GB(1)
-#define FRAMETABLE_VIRT_START (SLOT0(4) + GB(32))
+#define FRAMETABLE_VIRT_START (XEN_VM_MAPPING + GB(32))
#define FRAMETABLE_SIZE GB(32)
#define FRAMETABLE_NR (FRAMETABLE_SIZE / sizeof(*frame_table))
--
2.39.2