]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: Provide memset implementation for non-built-in cases
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 2 Jan 2016 18:32:37 +0000 (19:32 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 8 Jan 2016 18:34:38 +0000 (19:34 +0100)
This avoids the inline variant of ARM. The new link optimization will
remove what is unused.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/lib/arm/Makefile
inmates/lib/arm/include/inmate.h
inmates/lib/string.c [new file with mode: 0644]
inmates/lib/x86/Makefile

index 03c07c29a96302c2e2ffd245f654b0a134d223b4..ba0f5d29be166173c80b1187b7d8dd7749924e1f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Jailhouse, a Linux-based partitioning hypervisor
 #
-# Copyright (c) Siemens AG, 2015
+# Copyright (c) Siemens AG, 2015, 2016
 #
 # Authors:
 #  Jan Kiszka <jan.kiszka@siemens.com>
@@ -17,6 +17,7 @@ always := lib.a
 ccflags-y := -ffunction-sections
 
 lib-y                          := header.o gic.o printk.o timer.o
+lib-y                          += ../string.o
 lib-$(CONFIG_ARM_GIC)          += gic-v2.o
 lib-$(CONFIG_ARM_GIC_V3)       += gic-v3.o
 lib-$(CONFIG_SERIAL_AMBA_PL011)        += uart-pl011.o
index 2fee1bdb17b981a4069b6c24891df2c8b7cbc54a..1f6638f51cce7b229900f844bce5cd2edc9a3838 100644 (file)
@@ -36,15 +36,7 @@ static inline void mmio_write32(void *address, u32 value)
        *(volatile u32 *)address = value;
 }
 
-static inline void *memset(void *addr, int val, unsigned int size)
-{
-       char *s = addr;
-       unsigned int i;
-       for (i = 0; i < size; i++)
-               *s++ = val;
-
-       return addr;
-}
+void *memset(void *s, int c, unsigned long n);
 
 extern unsigned long printk_uart_base;
 void printk(const char *fmt, ...);
diff --git a/inmates/lib/string.c b/inmates/lib/string.c
new file mode 100644 (file)
index 0000000..af80517
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2016
+ *
+ * Authors:
+ *  Jan Kiszka <jan.kiszka@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <inmate.h>
+
+void *memset(void *s, int c, unsigned long n)
+{
+       u8 *p = s;
+
+       while (n-- > 0)
+               *p++ = c;
+       return s;
+}
index 3e4457a97f113bd10d7d3216902412cb4966ce62..3413d6ae656f8aefbe87d022e831faa2d7673a44 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Jailhouse, a Linux-based partitioning hypervisor
 #
-# Copyright (c) Siemens AG, 2015
+# Copyright (c) Siemens AG, 2015, 2016
 #
 # Authors:
 #  Jan Kiszka <jan.kiszka@siemens.com>
@@ -13,7 +13,7 @@
 always := lib.a lib32.a
 
 TARGETS := header.o hypercall.o ioapic.o printk.o smp.o
-TARGETS += ../pci.o
+TARGETS += ../pci.o ../string.o
 TARGETS_64_ONLY := int.o mem.o pci.o timing.o
 
 ccflags-y := -ffunction-sections