From 70a04a287a2875c82e6822c36e071afba5b63a62 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 29 Jan 2014 18:58:56 +0100 Subject: libc: mips: Fix setjmp/longjmp for MIPS64 N64 ABI When booting a Linux system with qemu-system-mips64 the execution of $(pwd) in the ash shell triggers a segmentation fault. Ash uses setjmp/longjmp for exception handling. After looking at the glibc implementation, I found some differences, with this patch tries to resolve. Now the system boots up fine and no segmentation faults occur. The global pointer should be restored and the types for the register values should be wide enough. See: http://www.cygwin.com/ml/libc-alpha/2003-03/msg00363.html Signed-off-by: Waldemar Brodkorb Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/mips/bits/setjmp.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libc/sysdeps/linux/mips/bits') diff --git a/libc/sysdeps/linux/mips/bits/setjmp.h b/libc/sysdeps/linux/mips/bits/setjmp.h index 4d2a26ea4..375e537ae 100644 --- a/libc/sysdeps/linux/mips/bits/setjmp.h +++ b/libc/sysdeps/linux/mips/bits/setjmp.h @@ -25,13 +25,19 @@ #include +#if _MIPS_SIM == _MIPS_SIM_ABI32 +#define ptrsize void * +#else +#define ptrsize long long +#endif + typedef struct { /* Program counter. */ - void * __pc; + ptrsize __pc; /* Stack pointer. */ - void * __sp; + ptrsize __sp; /* Callee-saved registers s0 through s7. */ #if _MIPS_SIM == _MIPS_SIM_ABI32 @@ -41,10 +47,10 @@ typedef struct #endif /* The frame pointer. */ - void * __fp; + ptrsize __fp; /* The global pointer. */ - void * __gp; + ptrsize __gp; /* Floating point status register. */ int __fpc_csr; -- cgit v1.2.3