From: Jan Kiszka Date: Sat, 2 Jan 2016 18:32:37 +0000 (+0100) Subject: inmates: Provide memset implementation for non-built-in cases X-Git-Url: http://rtime.felk.cvut.cz/gitweb/jailhouse.git/commitdiff_plain/c6f4ec76dd47c806f1cefc03673f1d12011fef67 inmates: Provide memset implementation for non-built-in cases This avoids the inline variant of ARM. The new link optimization will remove what is unused. Signed-off-by: Jan Kiszka --- diff --git a/inmates/lib/arm/Makefile b/inmates/lib/arm/Makefile index 03c07c2..ba0f5d2 100644 --- a/inmates/lib/arm/Makefile +++ b/inmates/lib/arm/Makefile @@ -1,7 +1,7 @@ # # Jailhouse, a Linux-based partitioning hypervisor # -# Copyright (c) Siemens AG, 2015 +# Copyright (c) Siemens AG, 2015, 2016 # # Authors: # Jan Kiszka @@ -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 diff --git a/inmates/lib/arm/include/inmate.h b/inmates/lib/arm/include/inmate.h index 2fee1bd..1f6638f 100644 --- a/inmates/lib/arm/include/inmate.h +++ b/inmates/lib/arm/include/inmate.h @@ -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 index 0000000..af80517 --- /dev/null +++ b/inmates/lib/string.c @@ -0,0 +1,22 @@ +/* + * Jailhouse, a Linux-based partitioning hypervisor + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#include + +void *memset(void *s, int c, unsigned long n) +{ + u8 *p = s; + + while (n-- > 0) + *p++ = c; + return s; +} diff --git a/inmates/lib/x86/Makefile b/inmates/lib/x86/Makefile index 3e4457a..3413d6a 100644 --- a/inmates/lib/x86/Makefile +++ b/inmates/lib/x86/Makefile @@ -1,7 +1,7 @@ # # Jailhouse, a Linux-based partitioning hypervisor # -# Copyright (c) Siemens AG, 2015 +# Copyright (c) Siemens AG, 2015, 2016 # # Authors: # Jan Kiszka @@ -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