linux-user: move get_sp_from_cpustate() to target_cpu.h

Remove useless includes
Fix HPPA include guard.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180529194207.31503-9-laurent@vivier.eu>
This commit is contained in:
Laurent Vivier 2018-05-29 21:42:00 +02:00
parent 995d2004b7
commit 9850f9f63a
60 changed files with 83 additions and 177 deletions

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -35,4 +35,8 @@ static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
env->cp15.tpidr_el[0] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
{
return state->xregs[31];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef AARCH64_TARGET_SIGNAL_H
#define AARCH64_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
{
return state->xregs[31];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* AARCH64_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -33,4 +33,8 @@ static inline void cpu_set_tls(CPUAlphaState *env, target_ulong newtls)
env->unique = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state)
{
return state->ir[IR_SP];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef ALPHA_TARGET_SIGNAL_H
#define ALPHA_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -22,12 +20,6 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 4096
#define TARGET_SIGSTKSZ 16384
static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state)
{
return state->ir[IR_SP];
}
/* From <asm/gentrap.h>. */
#define TARGET_GEN_INTOVF -1 /* integer overflow */
#define TARGET_GEN_INTDIV -2 /* integer division by zero */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -49,4 +49,8 @@ static inline target_ulong cpu_get_tls(CPUARMState *env)
}
}
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
{
return state->regs[13];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef ARM_TARGET_SIGNAL_H
#define ARM_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
{
return state->regs[13];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* ARM_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -33,4 +33,8 @@ static inline void cpu_set_tls(CPUCRISState *env, target_ulong newtls)
env->pregs[PR_PID] = (env->pregs[PR_PID] & 0xff) | newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state)
{
return state->regs[14];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef CRIS_TARGET_SIGNAL_H
#define CRIS_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUCRISState *state)
{
return state->regs[14];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* CRIS_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -16,8 +16,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ALPHA_TARGET_CPU_H
#define ALPHA_TARGET_CPU_H
#ifndef HPPA_TARGET_CPU_H
#define HPPA_TARGET_CPU_H
static inline void cpu_clone_regs(CPUHPPAState *env, target_ulong newsp)
{
@ -36,4 +36,8 @@ static inline void cpu_set_tls(CPUHPPAState *env, target_ulong newtls)
env->cr[27] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUHPPAState *state)
{
return state->gr[30];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef HPPA_TARGET_SIGNAL_H
#define HPPA_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,8 +19,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUHPPAState *state)
{
return state->gr[30];
}
#endif /* HPPA_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -45,4 +45,8 @@ static inline void cpu_set_tls(CPUX86State *env, target_ulong newtls)
}
#endif /* defined(TARGET_ABI32) */
static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
{
return state->regs[R_ESP];
}
#endif /* I386_TARGET_CPU_H */

View File

@ -1,8 +1,6 @@
#ifndef I386_TARGET_SIGNAL_H
#define I386_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
{
return state->regs[R_ESP];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* I386_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -37,4 +37,8 @@ static inline void cpu_set_tls(CPUM68KState *env, target_ulong newtls)
ts->tp_value = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUM68KState *state)
{
return state->aregs[7];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef M68K_TARGET_SIGNAL_H
#define M68K_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUM68KState *state)
{
return state->aregs[7];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* M68K_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -32,4 +32,8 @@ static inline void cpu_set_tls(CPUMBState *env, target_ulong newtls)
env->regs[21] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUMBState *state)
{
return state->regs[1];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef MICROBLAZE_TARGET_SIGNAL_H
#define MICROBLAZE_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUMBState *state)
{
return state->regs[1];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* MICROBLAZE_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -33,4 +33,8 @@ static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)
env->active_tc.CP0_UserLocal = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
{
return state->active_tc.gpr[29];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef MIPS_TARGET_SIGNAL_H
#define MIPS_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,11 +19,6 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
{
return state->active_tc.gpr[29];
}
#if defined(TARGET_ABI_MIPSO32)
/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
#define TARGET_ARCH_HAS_SETUP_FRAME

View File

@ -1,8 +1,6 @@
#ifndef MIPS64_TARGET_SIGNAL_H
#define MIPS64_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,8 +19,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)
{
return state->active_tc.gpr[29];
}
#endif /* MIPS64_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -36,4 +36,8 @@ static inline void cpu_set_tls(CPUNios2State *env, target_ulong newtls)
*/
}
static inline abi_ulong get_sp_from_cpustate(CPUNios2State *state)
{
return state->regs[R_SP];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef TARGET_SIGNAL_H
#define TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -18,8 +16,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUNios2State *state)
{
return state->regs[R_SP];
}
#endif /* TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -33,4 +33,8 @@ static inline void cpu_set_tls(CPUOpenRISCState *env, target_ulong newtls)
cpu_set_gpr(env, 10, newtls);
}
static inline abi_ulong get_sp_from_cpustate(CPUOpenRISCState *state)
{
return cpu_get_gpr(state, 1);
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef OPENRISC_TARGET_SIGNAL_H
#define OPENRISC_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -18,8 +16,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUOpenRISCState *state)
{
return cpu_get_gpr(state, 1);
}
#endif /* OPENRISC_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -47,5 +47,8 @@ static inline uint32_t get_ppc64_abi(struct image_info *infop)
return infop->elf_flags & EF_PPC64_ABI;
}
static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state)
{
return state->gpr[1];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef PPC_TARGET_SIGNAL_H
#define PPC_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,11 +19,6 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state)
{
return state->gpr[1];
}
#if !defined(TARGET_PPC64)
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif

View File

@ -623,7 +623,6 @@ static inline void *lock_user_string(abi_ulong guest_addr)
* above, so include them last.
*/
#include "target_cpu.h"
#include "target_signal.h"
#include "target_structs.h"
#endif /* QEMU_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -15,4 +15,8 @@ static inline void cpu_set_tls(CPURISCVState *env, target_ulong newtls)
env->gpr[xTP] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPURISCVState *state)
{
return state->gpr[xSP];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef TARGET_SIGNAL_H
#define TARGET_SIGNAL_H
#include "cpu.h"
typedef struct target_sigaltstack {
abi_ulong ss_sp;
abi_int ss_flags;
@ -15,8 +13,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPURISCVState *state)
{
return state->gpr[xSP];
}
#endif /* TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -36,4 +36,8 @@ static inline void cpu_set_tls(CPUS390XState *env, target_ulong newtls)
env->aregs[1] = newtls & 0xffffffffULL;
}
static inline abi_ulong get_sp_from_cpustate(CPUS390XState *state)
{
return state->regs[15];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef S390X_TARGET_SIGNAL_H
#define S390X_TARGET_SIGNAL_H
#include "cpu.h"
typedef struct target_sigaltstack {
abi_ulong ss_sp;
int ss_flags;
@ -18,10 +16,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUS390XState *state)
{
return state->regs[15];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* S390X_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -32,4 +32,8 @@ static inline void cpu_set_tls(CPUSH4State *env, target_ulong newtls)
env->gbr = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUSH4State *state)
{
return state->gregs[15];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef SH4_TARGET_SIGNAL_H
#define SH4_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,10 +19,5 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUSH4State *state)
{
return state->gregs[15];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* SH4_TARGET_SIGNAL_H */

View File

@ -23,7 +23,6 @@
#include "qemu.h"
#include "qemu-common.h"
#include "target_signal.h"
#include "trace.h"
#include "signal-common.h"

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -41,4 +41,15 @@ static inline void cpu_set_tls(CPUSPARCState *env, target_ulong newtls)
env->gregs[7] = newtls;
}
#ifndef UREG_I6
#define UREG_I6 6
#endif
#ifndef UREG_FP
#define UREG_FP UREG_I6
#endif
static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
{
return state->regwptr[UREG_FP];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef SPARC_TARGET_SIGNAL_H
#define SPARC_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,17 +19,5 @@ 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 abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
{
return state->regwptr[UREG_FP];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* SPARC_TARGET_SIGNAL_H */

View File

@ -1,8 +1,6 @@
#ifndef SPARC64_TARGET_SIGNAL_H
#define SPARC64_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,17 +19,5 @@ 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 abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
{
return state->regwptr[UREG_FP];
}
#define TARGET_ARCH_HAS_SETUP_FRAME
#endif /* SPARC64_TARGET_SIGNAL_H */

View File

@ -482,6 +482,8 @@ int do_sigaction(int sig, const struct target_sigaction *act,
#define TARGET_SA_RESTORER 0x04000000
#endif
#include "target_signal.h"
#ifdef TARGET_SA_RESTORER
#define TARGET_ARCH_HAS_SA_RESTORER 1
#endif

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -32,4 +32,8 @@ static inline void cpu_set_tls(CPUTLGState *env, target_ulong newtls)
env->regs[TILEGX_R_TP] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUTLGState *state)
{
return state->regs[TILEGX_R_SP];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef TILEGX_TARGET_SIGNAL_H
#define TILEGX_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -20,8 +18,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUTLGState *state)
{
return state->regs[TILEGX_R_SP];
}
#endif /* TILEGX_TARGET_SIGNAL_H */

View File

@ -1,8 +1,6 @@
#ifndef X86_64_TARGET_SIGNAL_H
#define X86_64_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -21,8 +19,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
{
return state->regs[R_ESP];
}
#endif /* X86_64_TARGET_SIGNAL_H */

View File

@ -18,7 +18,6 @@
*/
#include "qemu/osdep.h"
#include "qemu.h"
#include "target_signal.h"
#include "signal-common.h"
#include "linux-user/trace.h"

View File

@ -19,4 +19,8 @@ static inline void cpu_set_tls(CPUXtensaState *env, target_ulong newtls)
env->uregs[THREADPTR] = newtls;
}
static inline abi_ulong get_sp_from_cpustate(CPUXtensaState *state)
{
return state->regs[1];
}
#endif

View File

@ -1,8 +1,6 @@
#ifndef XTENSA_TARGET_SIGNAL_H
#define XTENSA_TARGET_SIGNAL_H
#include "cpu.h"
/* this struct defines a stack used during syscall handling */
typedef struct target_sigaltstack {
@ -20,8 +18,4 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 2048
#define TARGET_SIGSTKSZ 8192
static inline abi_ulong get_sp_from_cpustate(CPUXtensaState *state)
{
return state->regs[1];
}
#endif