提交 622ed360 编写于 作者: A aliguori

Convert CPU_PC_FROM_TB to static inline (Jan Kiszka)

as macros should be avoided when possible.
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5735 c046a42c-6fe2-441c-8c8c-71466251a162
上级 62d60e8c
...@@ -110,7 +110,7 @@ static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb) ...@@ -110,7 +110,7 @@ static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb)
if ((next_tb & 3) == 2) { if ((next_tb & 3) == 2) {
/* Restore PC. This may happen if async event occurs before /* Restore PC. This may happen if async event occurs before
the TB starts executing. */ the TB starts executing. */
CPU_PC_FROM_TB(env, tb); cpu_pc_from_tb(env, tb);
} }
tb_phys_invalidate(tb, -1); tb_phys_invalidate(tb, -1);
tb_free(tb); tb_free(tb);
...@@ -654,7 +654,7 @@ int cpu_exec(CPUState *env1) ...@@ -654,7 +654,7 @@ int cpu_exec(CPUState *env1)
int insns_left; int insns_left;
tb = (TranslationBlock *)(long)(next_tb & ~3); tb = (TranslationBlock *)(long)(next_tb & ~3);
/* Restore PC. */ /* Restore PC. */
CPU_PC_FROM_TB(env, tb); cpu_pc_from_tb(env, tb);
insns_left = env->icount_decr.u32; insns_left = env->icount_decr.u32;
if (env->icount_extra && insns_left >= 0) { if (env->icount_extra && insns_left >= 0) {
/* Refill decrementer and continue execution. */ /* Refill decrementer and continue execution. */
......
...@@ -318,6 +318,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -318,6 +318,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
#endif #endif
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
enum { enum {
FEATURE_ASN = 0x00000001, FEATURE_ASN = 0x00000001,
...@@ -416,6 +417,9 @@ void call_pal (CPUState *env); ...@@ -416,6 +417,9 @@ void call_pal (CPUState *env);
void call_pal (CPUState *env, int palcode); void call_pal (CPUState *env, int palcode);
#endif #endif
#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->pc = tb->pc;
}
#endif /* !defined (__CPU_ALPHA_H__) */ #endif /* !defined (__CPU_ALPHA_H__) */
...@@ -415,8 +415,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -415,8 +415,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) env->regs[15] = tb->pc
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->regs[15] = tb->pc;
}
#endif #endif
...@@ -237,7 +237,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -237,7 +237,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
#define SFR_RW_MM_TLB_LO env->pregs[PR_SRS]][5 #define SFR_RW_MM_TLB_LO env->pregs[PR_SRS]][5
#define SFR_RW_MM_TLB_HI env->pregs[PR_SRS]][6 #define SFR_RW_MM_TLB_HI env->pregs[PR_SRS]][6
#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->pc = tb->pc;
}
#endif #endif
...@@ -789,10 +789,14 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -789,10 +789,14 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) env->eip = tb->pc - tb->cs_base
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
#include "svm.h" #include "svm.h"
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->eip = tb->pc - tb->cs_base;
}
#endif /* CPU_I386_H */ #endif /* CPU_I386_H */
...@@ -231,8 +231,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -231,8 +231,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->pc = tb->pc;
}
#endif #endif
...@@ -502,6 +502,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -502,6 +502,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
/* Memory access type : /* Memory access type :
* may be needed for precise access rights control and precise exceptions. * may be needed for precise access rights control and precise exceptions.
...@@ -563,10 +564,11 @@ CPUMIPSState *cpu_mips_init(const char *cpu_model); ...@@ -563,10 +564,11 @@ CPUMIPSState *cpu_mips_init(const char *cpu_model);
uint32_t cpu_mips_get_clock (void); uint32_t cpu_mips_get_clock (void);
int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
#define CPU_PC_FROM_TB(env, tb) do { \ static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
env->active_tc.PC = tb->pc; \ {
env->hflags &= ~MIPS_HFLAG_BMASK; \ env->active_tc.PC = tb->pc;
env->hflags |= tb->flags & MIPS_HFLAG_BMASK; \ env->hflags &= ~MIPS_HFLAG_BMASK;
} while (0) env->hflags |= tb->flags & MIPS_HFLAG_BMASK;
}
#endif /* !defined (__MIPS_CPU_H__) */ #endif /* !defined (__MIPS_CPU_H__) */
...@@ -826,9 +826,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -826,9 +826,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) env->nip = tb->pc
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
/*****************************************************************************/ /*****************************************************************************/
/* CRF definitions */ /* CRF definitions */
...@@ -1432,4 +1431,9 @@ enum { ...@@ -1432,4 +1431,9 @@ enum {
/*****************************************************************************/ /*****************************************************************************/
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->nip = tb->pc;
}
#endif /* !defined (__CPU_PPC_H__) */ #endif /* !defined (__CPU_PPC_H__) */
...@@ -173,12 +173,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -173,12 +173,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) do { \
env->pc = tb->pc; \
env->flags = tb->flags; \
} while (0)
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
/* Memory access type */ /* Memory access type */
enum { enum {
...@@ -269,4 +265,10 @@ static inline int cpu_ptel_pr (uint32_t ptel) ...@@ -269,4 +265,10 @@ static inline int cpu_ptel_pr (uint32_t ptel)
#define PTEA_TC (1 << 3) #define PTEA_TC (1 << 3)
#define cpu_ptea_tc(ptea) (((ptea) & PTEA_TC) >> 3) #define cpu_ptea_tc(ptea) (((ptea) & PTEA_TC) >> 3)
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->pc = tb->pc;
env->flags = tb->flags;
}
#endif /* _CPU_SH4_H */ #endif /* _CPU_SH4_H */
...@@ -491,12 +491,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) ...@@ -491,12 +491,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
} }
#endif #endif
#define CPU_PC_FROM_TB(env, tb) do { \
env->pc = tb->pc; \
env->npc = tb->cs_base; \
} while(0)
#include "cpu-all.h" #include "cpu-all.h"
#include "exec-all.h"
/* sum4m.c, sun4u.c */ /* sum4m.c, sun4u.c */
void cpu_check_irqs(CPUSPARCState *env); void cpu_check_irqs(CPUSPARCState *env);
...@@ -508,4 +504,10 @@ uint64_t cpu_tick_get_count(void *opaque); ...@@ -508,4 +504,10 @@ uint64_t cpu_tick_get_count(void *opaque);
void cpu_tick_set_limit(void *opaque, uint64_t limit); void cpu_tick_set_limit(void *opaque, uint64_t limit);
#endif #endif
static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
{
env->pc = tb->pc;
env->npc = tb->cs_base;
}
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册