Signed-off-by: Ralf Ramsauer <[email protected]>
---
 hypervisor/arch/arm/include/asm/smc.h   | 38 +++++++++++++++++++++++++
 hypervisor/arch/arm64/include/asm/smc.h | 36 +++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 hypervisor/arch/arm/include/asm/smc.h
 create mode 100644 hypervisor/arch/arm64/include/asm/smc.h

diff --git a/hypervisor/arch/arm/include/asm/smc.h 
b/hypervisor/arch/arm/include/asm/smc.h
new file mode 100644
index 00000000..34944a2d
--- /dev/null
+++ b/hypervisor/arch/arm/include/asm/smc.h
@@ -0,0 +1,38 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (C) 2018 OTH Regensburg
+ *
+ * Authors:
+ *  Ralf Ramsauer <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+asm (".arch_extension sec\n");
+
+static inline int smc(unsigned long id)
+{
+       register unsigned long __id asm("r0") = id;
+
+       asm volatile ("smc #0\n\t"
+               : "=r" (__id)
+               : "r"(__id)
+               : "memory", "r1", "r2", "r3");
+
+       return __id;
+}
+
+static inline int smc_arg1(unsigned long id, unsigned long par1)
+{
+       register unsigned long __id asm("r0") = id;
+       register unsigned long __par1 asm("r1") = par1;
+
+       asm volatile ("smc #0\n\t"
+               : "=r" (__id)
+               : "r"(__id), "r"(__par1)
+               : "memory", "r2", "r3");
+
+       return __id;
+}
diff --git a/hypervisor/arch/arm64/include/asm/smc.h 
b/hypervisor/arch/arm64/include/asm/smc.h
new file mode 100644
index 00000000..7cc9891c
--- /dev/null
+++ b/hypervisor/arch/arm64/include/asm/smc.h
@@ -0,0 +1,36 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (C) 2018 OTH Regensburg
+ *
+ * Authors:
+ *  Ralf Ramsauer <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+static inline int smc(unsigned long id)
+{
+       register unsigned long __id asm("r0") = id;
+
+       asm volatile ("smc #0\n\t"
+               : "=r" (__id)
+               : "r"(__id)
+               : "memory", "x1", "x2", "x3");
+
+       return __id;
+}
+
+static inline int smc_arg1(unsigned long id, unsigned long par1)
+{
+       register unsigned long __id asm("r0") = id;
+       register unsigned long __par1 asm("r1") = par1;
+
+       asm volatile ("smc #0\n\t"
+               : "=r" (__id)
+               : "r"(__id), "r"(__par1)
+               : "memory", "x2", "x3");
+
+       return __id;
+}
-- 
2.20.1

-- 
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