From 2aebb6cefe5548b57f194d32f81f9d6f7be7cd53 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 19 Jan 2013 04:03:18 +0000 Subject: [PATCH] Update the syscall calling convention for ARM EABI. We store the syscall in r7 and use ip to store the old version of r7 as it is not guaranteed to be kept when calling a subroutine. The kernel will preserve the register across system calls. --- lib/libc/arm/SYS.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libc/arm/SYS.h b/lib/libc/arm/SYS.h index 584c15138482..ed1a045c64e2 100644 --- a/lib/libc/arm/SYS.h +++ b/lib/libc/arm/SYS.h @@ -39,7 +39,15 @@ #include #include +#ifdef __ARM_EABI__ +#define SYSTRAP(x) \ + mov ip, r7; \ + ldr r7, =SYS_ ## x; \ + swi 0; \ + mov r7, ip +#else #define SYSTRAP(x) swi 0 | SYS_ ## x +#endif #define CERROR _C_LABEL(cerror) #define CURBRK _C_LABEL(curbrk)