Commit 622ed3605bf4caa5d52b407081ceb6ecce752aec

Authored by aliguori
1 parent 62d60e8c

Convert CPU_PC_FROM_TB to static inline (Jan Kiszka)

as macros should be avoided when possible.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5735 c046a42c-6fe2-441c-8c8c-71466251a162
cpu-exec.c
... ... @@ -110,7 +110,7 @@ static void cpu_exec_nocache(int max_cycles, TranslationBlock *orig_tb)
110 110 if ((next_tb & 3) == 2) {
111 111 /* Restore PC. This may happen if async event occurs before
112 112 the TB starts executing. */
113   - CPU_PC_FROM_TB(env, tb);
  113 + cpu_pc_from_tb(env, tb);
114 114 }
115 115 tb_phys_invalidate(tb, -1);
116 116 tb_free(tb);
... ... @@ -654,7 +654,7 @@ int cpu_exec(CPUState *env1)
654 654 int insns_left;
655 655 tb = (TranslationBlock *)(long)(next_tb & ~3);
656 656 /* Restore PC. */
657   - CPU_PC_FROM_TB(env, tb);
  657 + cpu_pc_from_tb(env, tb);
658 658 insns_left = env->icount_decr.u32;
659 659 if (env->icount_extra && insns_left >= 0) {
660 660 /* Refill decrementer and continue execution. */
... ...
target-alpha/cpu.h
... ... @@ -318,6 +318,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
318 318 #endif
319 319  
320 320 #include "cpu-all.h"
  321 +#include "exec-all.h"
321 322  
322 323 enum {
323 324 FEATURE_ASN = 0x00000001,
... ... @@ -416,6 +417,9 @@ void call_pal (CPUState *env);
416 417 void call_pal (CPUState *env, int palcode);
417 418 #endif
418 419  
419   -#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc
  420 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  421 +{
  422 + env->pc = tb->pc;
  423 +}
420 424  
421 425 #endif /* !defined (__CPU_ALPHA_H__) */
... ...
target-arm/cpu.h
... ... @@ -415,8 +415,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
415 415 }
416 416 #endif
417 417  
418   -#define CPU_PC_FROM_TB(env, tb) env->regs[15] = tb->pc
419   -
420 418 #include "cpu-all.h"
  419 +#include "exec-all.h"
  420 +
  421 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  422 +{
  423 + env->regs[15] = tb->pc;
  424 +}
421 425  
422 426 #endif
... ...
target-cris/cpu.h
... ... @@ -237,7 +237,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
237 237 #define SFR_RW_MM_TLB_LO env->pregs[PR_SRS]][5
238 238 #define SFR_RW_MM_TLB_HI env->pregs[PR_SRS]][6
239 239  
240   -#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc
241   -
242 240 #include "cpu-all.h"
  241 +#include "exec-all.h"
  242 +
  243 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  244 +{
  245 + env->pc = tb->pc;
  246 +}
  247 +
243 248 #endif
... ...
target-i386/cpu.h
... ... @@ -789,10 +789,14 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
789 789 }
790 790 #endif
791 791  
792   -#define CPU_PC_FROM_TB(env, tb) env->eip = tb->pc - tb->cs_base
793   -
794 792 #include "cpu-all.h"
  793 +#include "exec-all.h"
795 794  
796 795 #include "svm.h"
797 796  
  797 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  798 +{
  799 + env->eip = tb->pc - tb->cs_base;
  800 +}
  801 +
798 802 #endif /* CPU_I386_H */
... ...
target-m68k/cpu.h
... ... @@ -231,8 +231,12 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
231 231 }
232 232 #endif
233 233  
234   -#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc
235   -
236 234 #include "cpu-all.h"
  235 +#include "exec-all.h"
  236 +
  237 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  238 +{
  239 + env->pc = tb->pc;
  240 +}
237 241  
238 242 #endif
... ...
target-mips/cpu.h
... ... @@ -502,6 +502,7 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
502 502 }
503 503  
504 504 #include "cpu-all.h"
  505 +#include "exec-all.h"
505 506  
506 507 /* Memory access type :
507 508 * may be needed for precise access rights control and precise exceptions.
... ... @@ -563,10 +564,11 @@ CPUMIPSState *cpu_mips_init(const char *cpu_model);
563 564 uint32_t cpu_mips_get_clock (void);
564 565 int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
565 566  
566   -#define CPU_PC_FROM_TB(env, tb) do { \
567   - env->active_tc.PC = tb->pc; \
568   - env->hflags &= ~MIPS_HFLAG_BMASK; \
569   - env->hflags |= tb->flags & MIPS_HFLAG_BMASK; \
570   - } while (0)
  567 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  568 +{
  569 + env->active_tc.PC = tb->pc;
  570 + env->hflags &= ~MIPS_HFLAG_BMASK;
  571 + env->hflags |= tb->flags & MIPS_HFLAG_BMASK;
  572 +}
571 573  
572 574 #endif /* !defined (__MIPS_CPU_H__) */
... ...
target-ppc/cpu.h
... ... @@ -826,9 +826,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
826 826 }
827 827 #endif
828 828  
829   -#define CPU_PC_FROM_TB(env, tb) env->nip = tb->pc
830   -
831 829 #include "cpu-all.h"
  830 +#include "exec-all.h"
832 831  
833 832 /*****************************************************************************/
834 833 /* CRF definitions */
... ... @@ -1432,4 +1431,9 @@ enum {
1432 1431  
1433 1432 /*****************************************************************************/
1434 1433  
  1434 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  1435 +{
  1436 + env->nip = tb->pc;
  1437 +}
  1438 +
1435 1439 #endif /* !defined (__CPU_PPC_H__) */
... ...
target-sh4/cpu.h
... ... @@ -173,12 +173,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
173 173 }
174 174 #endif
175 175  
176   -#define CPU_PC_FROM_TB(env, tb) do { \
177   - env->pc = tb->pc; \
178   - env->flags = tb->flags; \
179   - } while (0)
180   -
181 176 #include "cpu-all.h"
  177 +#include "exec-all.h"
182 178  
183 179 /* Memory access type */
184 180 enum {
... ... @@ -269,4 +265,10 @@ static inline int cpu_ptel_pr (uint32_t ptel)
269 265 #define PTEA_TC (1 << 3)
270 266 #define cpu_ptea_tc(ptea) (((ptea) & PTEA_TC) >> 3)
271 267  
  268 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  269 +{
  270 + env->pc = tb->pc;
  271 + env->flags = tb->flags;
  272 +}
  273 +
272 274 #endif /* _CPU_SH4_H */
... ...
target-sparc/cpu.h
... ... @@ -491,12 +491,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
491 491 }
492 492 #endif
493 493  
494   -#define CPU_PC_FROM_TB(env, tb) do { \
495   - env->pc = tb->pc; \
496   - env->npc = tb->cs_base; \
497   - } while(0)
498   -
499 494 #include "cpu-all.h"
  495 +#include "exec-all.h"
500 496  
501 497 /* sum4m.c, sun4u.c */
502 498 void cpu_check_irqs(CPUSPARCState *env);
... ... @@ -508,4 +504,10 @@ uint64_t cpu_tick_get_count(void *opaque);
508 504 void cpu_tick_set_limit(void *opaque, uint64_t limit);
509 505 #endif
510 506  
  507 +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
  508 +{
  509 + env->pc = tb->pc;
  510 + env->npc = tb->cs_base;
  511 +}
  512 +
511 513 #endif
... ...