Commit 198a74de4c61d3486c365f09361c605daab90af5

Authored by ths
1 parent a04e134a

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
@@ -21,4 +21,9 @@ typedef struct target_sigaltstack { @@ -21,4 +21,9 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 4096 21 #define TARGET_MINSIGSTKSZ 4096
22 #define TARGET_SIGSTKSZ 16384 22 #define TARGET_SIGSTKSZ 16384
23 23
  24 +static inline target_ulong get_sp_from_cpustate(CPUAlphaState *state)
  25 +{
  26 + return state->ir[IR_SP];
  27 +}
  28 +
24 #endif /* TARGET_SIGNAL_H */ 29 #endif /* TARGET_SIGNAL_H */
linux-user/arm/target_signal.h
@@ -21,4 +21,9 @@ typedef struct target_sigaltstack { @@ -21,4 +21,9 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 2048 21 #define TARGET_MINSIGSTKSZ 2048
22 #define TARGET_SIGSTKSZ 8192 22 #define TARGET_SIGSTKSZ 8192
23 23
  24 +static inline target_ulong get_sp_from_cpustate(CPUARMState *state)
  25 +{
  26 + return state->regs[13];
  27 +}
  28 +
24 #endif /* TARGET_SIGNAL_H */ 29 #endif /* TARGET_SIGNAL_H */
linux-user/i386/target_signal.h
@@ -21,4 +21,9 @@ typedef struct target_sigaltstack { @@ -21,4 +21,9 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 2048 21 #define TARGET_MINSIGSTKSZ 2048
22 #define TARGET_SIGSTKSZ 8192 22 #define TARGET_SIGSTKSZ 8192
23 23
  24 +static inline target_ulong get_sp_from_cpustate(CPUX86State *state)
  25 +{
  26 + return state->regs[R_ESP];
  27 +}
  28 +
24 #endif /* TARGET_SIGNAL_H */ 29 #endif /* TARGET_SIGNAL_H */
linux-user/mips/target_signal.h
@@ -21,4 +21,9 @@ typedef struct target_sigaltstack { @@ -21,4 +21,9 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 2048 21 #define TARGET_MINSIGSTKSZ 2048
22 #define TARGET_SIGSTKSZ 8192 22 #define TARGET_SIGSTKSZ 8192
23 23
  24 +static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)
  25 +{
  26 + return state->gpr[29][state->current_tc];
  27 +}
  28 +
24 #endif /* TARGET_SIGNAL_H */ 29 #endif /* TARGET_SIGNAL_H */
linux-user/ppc/target_signal.h
@@ -21,4 +21,9 @@ typedef struct target_sigaltstack { @@ -21,4 +21,9 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 2048 21 #define TARGET_MINSIGSTKSZ 2048
22 #define TARGET_SIGSTKSZ 8192 22 #define TARGET_SIGSTKSZ 8192
23 23
  24 +static inline target_ulong get_sp_from_cpustate(CPUPPCState *state)
  25 +{
  26 + return state->gpr[1];
  27 +}
  28 +
24 #endif /* TARGET_SIGNAL_H */ 29 #endif /* TARGET_SIGNAL_H */
linux-user/sparc/target_signal.h
@@ -21,4 +21,16 @@ typedef struct target_sigaltstack { @@ -21,4 +21,16 @@ typedef struct target_sigaltstack {
21 #define TARGET_MINSIGSTKSZ 4096 21 #define TARGET_MINSIGSTKSZ 4096
22 #define TARGET_SIGSTKSZ 16384 22 #define TARGET_SIGSTKSZ 16384
23 23
  24 +#ifndef UREG_I6
  25 +#define UREG_I6 6
  26 +#endif
  27 +#ifndef UREG_FP
  28 +#define UREG_FP UREG_I6
  29 +#endif
  30 +
  31 +static inline target_ulong get_sp_from_cpustate(CPUSPARCState *state)
  32 +{
  33 + return state->regwptr[UREG_FP];
  34 +}
  35 +
24 #endif /* TARGET_SIGNAL_H */ 36 #endif /* TARGET_SIGNAL_H */
linux-user/syscall.c
@@ -4318,7 +4318,8 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1, @@ -4318,7 +4318,8 @@ target_long do_syscall(void *cpu_env, int num, target_long arg1,
4318 case TARGET_NR_capset: 4318 case TARGET_NR_capset:
4319 goto unimplemented; 4319 goto unimplemented;
4320 case TARGET_NR_sigaltstack: 4320 case TARGET_NR_sigaltstack:
4321 -#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) 4321 +#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_MIPS) || \
  4322 + defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_ALPHA)
4322 ret = do_sigaltstack((struct target_sigaltstack *)arg1, 4323 ret = do_sigaltstack((struct target_sigaltstack *)arg1,
4323 (struct target_sigaltstack *)arg2, 4324 (struct target_sigaltstack *)arg2,
4324 get_sp_from_cpustate((CPUState *)cpu_env)); 4325 get_sp_from_cpustate((CPUState *)cpu_env));
target-alpha/cpu.h
@@ -397,9 +397,4 @@ void cpu_loop_exit (void); @@ -397,9 +397,4 @@ void cpu_loop_exit (void);
397 void pal_init (CPUState *env); 397 void pal_init (CPUState *env);
398 void call_pal (CPUState *env, int palcode); 398 void call_pal (CPUState *env, int palcode);
399 399
400 -static inline target_ulong get_sp_from_cpustate(CPUAlphaState *state)  
401 -{  
402 - return state->ir[IR_SP];  
403 -}  
404 -  
405 #endif /* !defined (__CPU_ALPHA_H__) */ 400 #endif /* !defined (__CPU_ALPHA_H__) */
target-arm/cpu.h
@@ -300,11 +300,6 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum, @@ -300,11 +300,6 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,
300 #define cpu_gen_code cpu_arm_gen_code 300 #define cpu_gen_code cpu_arm_gen_code
301 #define cpu_signal_handler cpu_arm_signal_handler 301 #define cpu_signal_handler cpu_arm_signal_handler
302 302
303 -static inline target_ulong get_sp_from_cpustate(CPUARMState *state)  
304 -{  
305 - return state->regs[13];  
306 -}  
307 -  
308 #include "cpu-all.h" 303 #include "cpu-all.h"
309 304
310 #endif 305 #endif
target-i386/cpu.h
@@ -688,11 +688,6 @@ static inline int cpu_get_time_fast(void) @@ -688,11 +688,6 @@ static inline int cpu_get_time_fast(void)
688 #define cpu_gen_code cpu_x86_gen_code 688 #define cpu_gen_code cpu_x86_gen_code
689 #define cpu_signal_handler cpu_x86_signal_handler 689 #define cpu_signal_handler cpu_x86_signal_handler
690 690
691 -static inline target_ulong get_sp_from_cpustate(CPUX86State *state)  
692 -{  
693 - return state->regs[R_ESP];  
694 -}  
695 -  
696 #include "cpu-all.h" 691 #include "cpu-all.h"
697 692
698 #include "svm.h" 693 #include "svm.h"
target-mips/cpu.h
@@ -548,9 +548,4 @@ CPUMIPSState *cpu_mips_init(void); @@ -548,9 +548,4 @@ CPUMIPSState *cpu_mips_init(void);
548 uint32_t cpu_mips_get_clock (void); 548 uint32_t cpu_mips_get_clock (void);
549 int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); 549 int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
550 550
551 -static inline target_ulong get_sp_from_cpustate(CPUMIPSState *state)  
552 -{  
553 - return state->gpr[29][state->current_tc];  
554 -}  
555 -  
556 #endif /* !defined (__MIPS_CPU_H__) */ 551 #endif /* !defined (__MIPS_CPU_H__) */
target-ppc/cpu.h
@@ -1146,9 +1146,4 @@ enum { @@ -1146,9 +1146,4 @@ enum {
1146 1146
1147 /*****************************************************************************/ 1147 /*****************************************************************************/
1148 1148
1149 -static inline target_ulong get_sp_from_cpustate(CPUPPCState *state)  
1150 -{  
1151 - return state->gpr[1];  
1152 -}  
1153 -  
1154 #endif /* !defined (__CPU_PPC_H__) */ 1149 #endif /* !defined (__CPU_PPC_H__) */
target-sparc/cpu.h
@@ -316,18 +316,6 @@ void cpu_check_irqs(CPUSPARCState *env); @@ -316,18 +316,6 @@ void cpu_check_irqs(CPUSPARCState *env);
316 #define cpu_gen_code cpu_sparc_gen_code 316 #define cpu_gen_code cpu_sparc_gen_code
317 #define cpu_signal_handler cpu_sparc_signal_handler 317 #define cpu_signal_handler cpu_sparc_signal_handler
318 318
319 -#ifndef UREG_I6  
320 -#define UREG_I6 6  
321 -#endif  
322 -#ifndef UREG_FP  
323 -#define UREG_FP UREG_I6  
324 -#endif  
325 -  
326 -static inline target_ulong get_sp_from_cpustate(CPUSPARCState *state)  
327 -{  
328 - return state->regwptr[UREG_FP];  
329 -}  
330 -  
331 #include "cpu-all.h" 319 #include "cpu-all.h"
332 320
333 #endif 321 #endif