Will be required by the PCI layer. It's not worth optimizing this in
assembly, the compiler is already pretty good in this.

Signed-off-by: Jan Kiszka <[email protected]>
---
 hypervisor/arch/arm/Kbuild |  2 +-
 hypervisor/arch/arm/lib.c  | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 hypervisor/arch/arm/lib.c

diff --git a/hypervisor/arch/arm/Kbuild b/hypervisor/arch/arm/Kbuild
index e18fb04..f0afd10 100644
--- a/hypervisor/arch/arm/Kbuild
+++ b/hypervisor/arch/arm/Kbuild
@@ -17,7 +17,7 @@ KBUILD_AFLAGS := $(subst -include 
asm/unified.h,,$(KBUILD_AFLAGS))
 always := built-in.o
 
 obj-y := $(COMMON_OBJECTS)
-obj-y += entry.o exception.o setup.o control.o traps.o mmio.o
+obj-y += entry.o exception.o setup.o control.o traps.o mmio.o lib.o
 obj-y += mmu_hyp.o caches.o mach-stubs.o
 
 obj-$(CONFIG_ARM_GIC_V3) += gic-v3.o
diff --git a/hypervisor/arch/arm/lib.c b/hypervisor/arch/arm/lib.c
new file mode 100644
index 0000000..659e201
--- /dev/null
+++ b/hypervisor/arch/arm/lib.c
@@ -0,0 +1,32 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2016
+ *
+ * Authors:
+ *  Jan Kiszka <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <asm/types.h>
+
+unsigned long long __aeabi_llsl(unsigned long long val, unsigned int shift);
+unsigned long long __aeabi_llsr(unsigned long long val, unsigned int shift);
+
+unsigned long long __aeabi_llsl(unsigned long long val, unsigned int shift)
+{
+       u32 lo = (u32)val << shift;
+       u32 hi = ((u32)(val >> 32) << shift) | ((u32)val >> (32 - shift));
+
+       return ((unsigned long long)hi << 32) | lo;
+}
+
+unsigned long long __aeabi_llsr(unsigned long long val, unsigned int shift)
+{
+       u32 lo = ((u32)val >> shift) | ((u32)(val >> 32) << (32 - shift));
+       u32 hi = (u32)val >> shift;
+
+       return ((unsigned long long)hi << 32) | lo;
+}
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to