From 198a74de4c61d3486c365f09361c605daab90af5 Mon Sep 17 00:00:00 2001 From: ths Date: Thu, 27 Sep 2007 16:44:32 +0000 Subject: Move get_sp_from_cpustate from cpu.h to target_signal.h. Enable sigaltstack processing for more architectures. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3253 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/alpha/target_signal.h | 5 +++++ linux-user/arm/target_signal.h | 5 +++++ linux-user/i386/target_signal.h | 5 +++++ linux-user/mips/target_signal.h | 5 +++++ linux-user/ppc/target_signal.h | 5 +++++ linux-user/sparc/target_signal.h | 12 ++++++++++++ linux-user/syscall.c | 3 ++- 7 files changed, 39 insertions(+), 1 deletion(-) (limited to 'linux-user') diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index bf54ac71d8..7618c3e83b 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -21,4 +21,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 4096 #define TARGET_SIGSTKSZ 16384 +static inline target_ulong get_sp_from_cpustate(CPUAlphaState *state) +{ + return state->ir[IR_SP]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/arm/target_signal.h b/linux-user/arm/target_signal.h index eb4a0bb12c..d518165143 100644 --- a/linux-user/arm/target_signal.h +++ b/linux-user/arm/target_signal.h @@ -21,4 +21,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 +static inline target_ulong get_sp_from_cpustate(CPUARMState *state) +{ + return state->regs[13]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/i386/target_signal.h b/linux-user/i386/target_signal.h index eb4a0bb12c..f93a8d62b9 100644 --- a/linux-user/i386/target_signal.h +++ b/linux-user/i386/target_signal.h @@ -21,4 +21,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 +static inline target_ulong get_sp_from_cpustate(CPUX86State *state) +{ + return state->regs[R_ESP]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h index c94788497c..d7611b01d4 100644 --- a/linux-user/mips/target_signal.h +++ b/linux-user/mips/target_signal.h @@ -21,4 +21,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 +static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state) +{ + return state->gpr[29][state->current_tc]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/ppc/target_signal.h b/linux-user/ppc/target_signal.h index e210e7a317..80ad21187f 100644 --- a/linux-user/ppc/target_signal.h +++ b/linux-user/ppc/target_signal.h @@ -21,4 +21,9 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 2048 #define TARGET_SIGSTKSZ 8192 +static inline target_ulong get_sp_from_cpustate(CPUPPCState *state) +{ + return state->gpr[1]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h index bf54ac71d8..dfca129162 100644 --- a/linux-user/sparc/target_signal.h +++ b/linux-user/sparc/target_signal.h @@ -21,4 +21,16 @@ typedef struct target_sigaltstack { #define TARGET_MINSIGSTKSZ 4096 #define TARGET_SIGSTKSZ 16384 +#ifndef UREG_I6 +#define UREG_I6 6 +#endif +#ifndef UREG_FP +#define UREG_FP UREG_I6 +#endif + +static inline target_ulong get_sp_from_cpustate(CPUSPARCState *state) +{ + return state->regwptr[UREG_FP]; +} + #endif /* TARGET_SIGNAL_H */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5f1c804aaa..af5b9d9225 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4318,7 +4318,8 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, case TARGET_NR_capset: goto unimplemented; case TARGET_NR_sigaltstack: -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_MIPS) || \ + defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_ALPHA) ret = do_sigaltstack((struct target_sigaltstack *)arg1, (struct target_sigaltstack *)arg2, get_sp_from_cpustate((CPUState *)cpu_env)); -- cgit v1.2.3