Skip to content

Commit

Permalink
cpu: Introduce ENV_OFFSET macros
Browse files Browse the repository at this point in the history
Introduce ENV_OFFSET macros which can be used in non-target-specific
code that needs to generate TCG instructions which reference CPUState
fields given the cpu_env register that TCG targets set up with a
pointer to the CPUArchState struct.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
  • Loading branch information
afaerber authored and blueswirl committed Mar 3, 2013
1 parent 0980011 commit fadf982
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions target-alpha/cpu-qom.h
Expand Up @@ -72,5 +72,6 @@ static inline AlphaCPU *alpha_env_get_cpu(CPUAlphaState *env)

#define ENV_GET_CPU(e) CPU(alpha_env_get_cpu(e))

#define ENV_OFFSET offsetof(AlphaCPU, env)

#endif
2 changes: 2 additions & 0 deletions target-arm/cpu-qom.h
Expand Up @@ -109,6 +109,8 @@ static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)

#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))

#define ENV_OFFSET offsetof(ARMCPU, env)

void register_cp_regs_for_features(ARMCPU *cpu);

#endif
1 change: 1 addition & 0 deletions target-cris/cpu-qom.h
Expand Up @@ -71,5 +71,6 @@ static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)

#define ENV_GET_CPU(e) CPU(cris_env_get_cpu(e))

#define ENV_OFFSET offsetof(CRISCPU, env)

#endif
1 change: 1 addition & 0 deletions target-i386/cpu-qom.h
Expand Up @@ -74,5 +74,6 @@ static inline X86CPU *x86_env_get_cpu(CPUX86State *env)

#define ENV_GET_CPU(e) CPU(x86_env_get_cpu(e))

#define ENV_OFFSET offsetof(X86CPU, env)

#endif
1 change: 1 addition & 0 deletions target-lm32/cpu-qom.h
Expand Up @@ -69,5 +69,6 @@ static inline LM32CPU *lm32_env_get_cpu(CPULM32State *env)

#define ENV_GET_CPU(e) CPU(lm32_env_get_cpu(e))

#define ENV_OFFSET offsetof(LM32CPU, env)

#endif
1 change: 1 addition & 0 deletions target-m68k/cpu-qom.h
Expand Up @@ -68,5 +68,6 @@ static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)

#define ENV_GET_CPU(e) CPU(m68k_env_get_cpu(e))

#define ENV_OFFSET offsetof(M68kCPU, env)

#endif
1 change: 1 addition & 0 deletions target-microblaze/cpu-qom.h
Expand Up @@ -68,5 +68,6 @@ static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)

#define ENV_GET_CPU(e) CPU(mb_env_get_cpu(e))

#define ENV_OFFSET offsetof(MicroBlazeCPU, env)

#endif
1 change: 1 addition & 0 deletions target-mips/cpu-qom.h
Expand Up @@ -72,5 +72,6 @@ static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)

#define ENV_GET_CPU(e) CPU(mips_env_get_cpu(e))

#define ENV_OFFSET offsetof(MIPSCPU, env)

#endif
2 changes: 2 additions & 0 deletions target-openrisc/cpu.h
Expand Up @@ -340,6 +340,8 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)

#define ENV_GET_CPU(e) CPU(openrisc_env_get_cpu(e))

#define ENV_OFFSET offsetof(OpenRISCCPU, env)

OpenRISCCPU *cpu_openrisc_init(const char *cpu_model);

void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf);
Expand Down
3 changes: 2 additions & 1 deletion target-ppc/cpu-qom.h
Expand Up @@ -78,7 +78,8 @@ static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)

#define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))

PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
#define ENV_OFFSET offsetof(PowerPCCPU, env)

PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);

#endif
1 change: 1 addition & 0 deletions target-s390x/cpu-qom.h
Expand Up @@ -69,5 +69,6 @@ static inline S390CPU *s390_env_get_cpu(CPUS390XState *env)

#define ENV_GET_CPU(e) CPU(s390_env_get_cpu(e))

#define ENV_OFFSET offsetof(S390CPU, env)

#endif
1 change: 1 addition & 0 deletions target-sh4/cpu-qom.h
Expand Up @@ -68,5 +68,6 @@ static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)

#define ENV_GET_CPU(e) CPU(sh_env_get_cpu(e))

#define ENV_OFFSET offsetof(SuperHCPU, env)

#endif
1 change: 1 addition & 0 deletions target-sparc/cpu-qom.h
Expand Up @@ -73,5 +73,6 @@ static inline SPARCCPU *sparc_env_get_cpu(CPUSPARCState *env)

#define ENV_GET_CPU(e) CPU(sparc_env_get_cpu(e))

#define ENV_OFFSET offsetof(SPARCCPU, env)

#endif
1 change: 1 addition & 0 deletions target-unicore32/cpu-qom.h
Expand Up @@ -58,5 +58,6 @@ static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)

#define ENV_GET_CPU(e) CPU(uc32_env_get_cpu(e))

#define ENV_OFFSET offsetof(UniCore32CPU, env)

#endif
1 change: 1 addition & 0 deletions target-xtensa/cpu-qom.h
Expand Up @@ -78,5 +78,6 @@ static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)

#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))

#define ENV_OFFSET offsetof(XtensaCPU, env)

#endif

0 comments on commit fadf982

Please sign in to comment.