From 64d60bbc7fbb0ef78f5884aef594203793772d5d Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Thu, 27 Feb 2014 14:04:10 +0100 Subject: [PATCH] rump: Remove deprecated ARM instruction Substitute 'swpb' (swap byte) instruction with 'ldrexb/strexb', because 'swpb' needs to be enabled explicitly by the kernel, which is done by neither HW or FOC. When disabled, 'swpb' will cause an undefined instruction exception. Issue #1048 --- dde_rump/patches/build.patch | 11 ++++++++++- dde_rump/patches/lock.patch | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 dde_rump/patches/lock.patch diff --git a/dde_rump/patches/build.patch b/dde_rump/patches/build.patch index 6318bd6442..722af57765 100644 --- a/dde_rump/patches/build.patch +++ b/dde_rump/patches/build.patch @@ -1,5 +1,5 @@ diff --git a/buildrump.sh b/buildrump.sh -index f600b6a..e394b47 100755 +index f600b6a..f6bb302 100755 --- a/buildrump.sh +++ b/buildrump.sh @@ -570,6 +570,16 @@ evaltools () @@ -55,3 +55,12 @@ index f600b6a..e394b47 100755 TOOLABI='' case ${MACH_ARCH} in "amd64"|"x86_64") +@@ -918,6 +910,8 @@ evaltarget () + MACHINE="evbarm" + MACH_ARCH="arm" + TOOLABI="elf" ++ EXTRA_CFLAGS='-march=armv7-a' ++ EXTRA_AFLAGS='-march=armv7-a' + probearm + ;; + "sparc") diff --git a/dde_rump/patches/lock.patch b/dde_rump/patches/lock.patch new file mode 100644 index 0000000000..2554da77ad --- /dev/null +++ b/dde_rump/patches/lock.patch @@ -0,0 +1,20 @@ +diff --git a/src/sys/arch/arm/include/lock.h b/sys/arch/arm/include/lock.h +index c52a44f..3b4ba93 100644 +--- a/src/sys/arch/arm/include/lock.h ++++ b/src/sys/arch/arm/include/lock.h +@@ -119,8 +119,13 @@ __swp(__cpu_simple_lock_t __val, volatile __cpu_simple_lock_t *__ptr) + return __rv; + #else + uint32_t __val32; +- __asm volatile("swpb %0, %1, [%2]" +- : "=&r" (__val32) : "r" (__val), "r" (__ptr) : "memory"); ++ __asm volatile(" 1: \n" ++ " ldrexb %0, [%2] \n" ++ " strexb r0, %1, [%2]\n" ++ " teqeq r0, #0 \n" ++ " bne 1b \n" ++ : "=&r" (__val32) : "r" (__val), "r" (__ptr) ++ : "memory", "r0"); + return __val32; + #endif + }