Later we'll need more sysregs, define them now.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 .../arm-common/include/asm/sysregs_common.h   | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/inmates/lib/arm-common/include/asm/sysregs_common.h 
b/inmates/lib/arm-common/include/asm/sysregs_common.h
index 09e91f8a..168cb70d 100644
--- a/inmates/lib/arm-common/include/asm/sysregs_common.h
+++ b/inmates/lib/arm-common/include/asm/sysregs_common.h
@@ -36,6 +36,9 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define HUGE_PAGE_SIZE         (2 * 1024 * 1024ULL)
+#define HUGE_PAGE_MASK         (~(HUGE_PAGE_SIZE - 1))
+
 #define ICC_IAR1_EL1           SYSREG_32(0, c12, c12, 0)
 #define ICC_EOIR1_EL1          SYSREG_32(0, c12, c12, 1)
 #define ICC_PMR_EL1            SYSREG_32(0, c4, c6, 0)
@@ -43,3 +46,23 @@
 #define ICC_IGRPEN1_EL1                SYSREG_32(0, c12, c12, 7)
 
 #define ICC_IGRPEN1_EN         0x1
+
+#define MAIR_ATTR_SHIFT(__n)   ((__n) << 3)
+#define MAIR_ATTR(__n, __attr) ((__attr) << MAIR_ATTR_SHIFT(__n))
+#define MAIR_ATTR_WBRWA                0xff
+#define MAIR_ATTR_DEVICE       0x00    /* nGnRnE */
+
+/* Common definitions for page table structure in long descriptor format */
+#define LONG_DESC_BLOCK 0x1
+#define LONG_DESC_TABLE 0x3
+
+#define LATTR_CONT             (1 << 12)
+#define LATTR_AF               (1 << 10)
+#define LATTR_INNER_SHAREABLE  (3 << 8)
+#define LATTR_MAIR(n)          (((n) & 0x3) << 2)
+
+#define LATTR_AP(n)            (((n) & 0x3) << 6)
+#define LATTR_AP_RW_EL1                LATTR_AP(0x0)
+
+#define PGD_INDEX(addr)                ((addr) >> 30)
+#define PMD_INDEX(addr)                (((addr) >> 21) & 0x1ff)
-- 
2.17.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to