From: Antonios Motakis <antonios.mota...@huawei.com>

On the AArch32 port of Jailhouse, the arm_write_sysreg and
arm_read_sysreg macros are used to access the system registers.
Implementing these helpers on AArch64 allows to approach some low
hanging fruit when looking for code to reuse from the AArch32 port.

On AArch64 we always get a u64 value from a system register, while
on AArch32 it might be either u32 or u64. We need to look at the
users of this macro on a case by case basis and see if it makes
sense to reuse code.

Signed-off-by: Antonios Motakis <antonios.mota...@huawei.com>
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>
---
 hypervisor/arch/arm64/include/asm/sysregs.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 hypervisor/arch/arm64/include/asm/sysregs.h

diff --git a/hypervisor/arch/arm64/include/asm/sysregs.h 
b/hypervisor/arch/arm64/include/asm/sysregs.h
new file mode 100644
index 0000000..fa13ea3
--- /dev/null
+++ b/hypervisor/arch/arm64/include/asm/sysregs.h
@@ -0,0 +1,26 @@
+/*
+ * Jailhouse AArch64 support
+ *
+ * Copyright (C) 2015 Huawei Technologies Duesseldorf GmbH
+ *
+ * Authors:
+ *  Antonios Motakis <antonios.mota...@huawei.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#ifndef _JAILHOUSE_ASM_SYSREGS_H
+#define _JAILHOUSE_ASM_SYSREGS_H
+
+#ifndef __ASSEMBLY__
+
+#define arm_write_sysreg(sysreg, val) \
+       asm volatile ("msr      "#sysreg", %0\n" : : "r"((u64)(val)))
+
+#define arm_read_sysreg(sysreg, val) \
+       asm volatile ("mrs      %0, "#sysreg"\n" : "=r"((u64)(val)))
+
+#endif
+
+#endif
-- 
2.1.4

-- 
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 jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to