From eb23ab3120223371136038f8518249461d90a516 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Mon, 14 Jan 2013 09:11:18 +0000 Subject: [PATCH] Update sigcode to use both the current ABI and FreeBSD's version of the ARM EABI syscall calling convention. The current ABI encodes the syscall number in the instruction. This causes issues with the thumb mode as it only has 8 bits to encode this value and we have too many system calls and by using a register will simplify the code to get the syscall number in the kernel. With the ARM EABI we reuse the Linux calling convention by storing the value in r7. Because of this we use both methods to encode the syscall number in this function. --- sys/arm/arm/locore.S | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/arm/arm/locore.S b/sys/arm/arm/locore.S index ed7af2591250..00a61e70e7f9 100644 --- a/sys/arm/arm/locore.S +++ b/sys/arm/arm/locore.S @@ -484,12 +484,29 @@ ENTRY_NP(abort) ENTRY_NP(sigcode) mov r0, sp + + /* + * Call the sigreturn system call. + * + * We have to load r7 manually rather than using + * "ldr r7, =SYS_sigreturn" to ensure the value of szsigcode is + * correct. Using the alternative places esigcode at the address + * of the data rather than the address one past the data. + */ + + ldr r7, [pc, #12] /* Load SYS_sigreturn */ swi SYS_sigreturn /* Well if that failed we better exit quick ! */ + ldr r7, [pc, #8] /* Load SYS_exit */ swi SYS_exit - b . - 8 + + /* Branch back to retry SYS_sigreturn */ + b . - 16 + + .word SYS_sigreturn + .word SYS_exit .align 0 .global _C_LABEL(esigcode)