From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2WMo-00022q-QY for qemu-devel@nongnu.org; Tue, 18 Nov 2008 14:36:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2WMn-00022Z-Vp for qemu-devel@nongnu.org; Tue, 18 Nov 2008 14:36:06 -0500 Received: from [199.232.76.173] (port=46430 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2WMn-00022S-PQ for qemu-devel@nongnu.org; Tue, 18 Nov 2008 14:36:05 -0500 Received: from savannah.gnu.org ([199.232.41.3]:44821 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2WMn-0003Bw-7u for qemu-devel@nongnu.org; Tue, 18 Nov 2008 14:36:05 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L2WMm-0006qN-FD for qemu-devel@nongnu.org; Tue, 18 Nov 2008 19:36:04 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L2WMm-0006qH-1z for qemu-devel@nongnu.org; Tue, 18 Nov 2008 19:36:04 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Tue, 18 Nov 2008 19:36:04 +0000 Subject: [Qemu-devel] [5735] Convert CPU_PC_FROM_TB to static inline (Jan Kiszka) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5735 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5735 Author: aliguori Date: 2008-11-18 19:36:03 +0000 (Tue, 18 Nov 2008) Log Message: ----------- Convert CPU_PC_FROM_TB to static inline (Jan Kiszka) as macros should be avoided when possible. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/cpu-exec.c trunk/target-alpha/cpu.h trunk/target-arm/cpu.h trunk/target-cris/cpu.h trunk/target-i386/cpu.h trunk/target-m68k/cpu.h trunk/target-mips/cpu.h trunk/target-ppc/cpu.h trunk/target-sh4/cpu.h trunk/target-sparc/cpu.h Modified: trunk/cpu-exec.c =================================================================== --- trunk/cpu-exec.c 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/cpu-exec.c 2008-11-18 19:36:03 UTC (rev 5735) @@ -110,7 +110,7 @@ if ((next_tb & 3) == 2) { /* Restore PC. This may happen if async event occurs before the TB starts executing. */ - CPU_PC_FROM_TB(env, tb); + cpu_pc_from_tb(env, tb); } tb_phys_invalidate(tb, -1); tb_free(tb); @@ -654,7 +654,7 @@ int insns_left; tb = (TranslationBlock *)(long)(next_tb & ~3); /* Restore PC. */ - CPU_PC_FROM_TB(env, tb); + cpu_pc_from_tb(env, tb); insns_left = env->icount_decr.u32; if (env->icount_extra && insns_left >= 0) { /* Refill decrementer and continue execution. */ Modified: trunk/target-alpha/cpu.h =================================================================== --- trunk/target-alpha/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-alpha/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -318,6 +318,7 @@ #endif #include "cpu-all.h" +#include "exec-all.h" enum { FEATURE_ASN = 0x00000001, @@ -416,6 +417,9 @@ void call_pal (CPUState *env, int palcode); #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__) */ Modified: trunk/target-arm/cpu.h =================================================================== --- trunk/target-arm/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-arm/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -415,8 +415,12 @@ } #endif -#define CPU_PC_FROM_TB(env, tb) env->regs[15] = tb->pc - #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 Modified: trunk/target-cris/cpu.h =================================================================== --- trunk/target-cris/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-cris/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -237,7 +237,12 @@ #define SFR_RW_MM_TLB_LO env->pregs[PR_SRS]][5 #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 "exec-all.h" -#include "cpu-all.h" +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) +{ + env->pc = tb->pc; +} + #endif Modified: trunk/target-i386/cpu.h =================================================================== --- trunk/target-i386/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-i386/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -789,10 +789,14 @@ } #endif -#define CPU_PC_FROM_TB(env, tb) env->eip = tb->pc - tb->cs_base - #include "cpu-all.h" +#include "exec-all.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 */ Modified: trunk/target-m68k/cpu.h =================================================================== --- trunk/target-m68k/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-m68k/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -231,8 +231,12 @@ } #endif -#define CPU_PC_FROM_TB(env, tb) env->pc = tb->pc - #include "cpu-all.h" +#include "exec-all.h" +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) +{ + env->pc = tb->pc; +} + #endif Modified: trunk/target-mips/cpu.h =================================================================== --- trunk/target-mips/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-mips/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -502,6 +502,7 @@ } #include "cpu-all.h" +#include "exec-all.h" /* Memory access type : * may be needed for precise access rights control and precise exceptions. @@ -563,10 +564,11 @@ uint32_t cpu_mips_get_clock (void); int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc); -#define CPU_PC_FROM_TB(env, tb) do { \ - env->active_tc.PC = tb->pc; \ - env->hflags &= ~MIPS_HFLAG_BMASK; \ - env->hflags |= tb->flags & MIPS_HFLAG_BMASK; \ - } while (0) +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) +{ + env->active_tc.PC = tb->pc; + env->hflags &= ~MIPS_HFLAG_BMASK; + env->hflags |= tb->flags & MIPS_HFLAG_BMASK; +} #endif /* !defined (__MIPS_CPU_H__) */ Modified: trunk/target-ppc/cpu.h =================================================================== --- trunk/target-ppc/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-ppc/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -826,9 +826,8 @@ } #endif -#define CPU_PC_FROM_TB(env, tb) env->nip = tb->pc - #include "cpu-all.h" +#include "exec-all.h" /*****************************************************************************/ /* CRF definitions */ @@ -1432,4 +1431,9 @@ /*****************************************************************************/ +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) +{ + env->nip = tb->pc; +} + #endif /* !defined (__CPU_PPC_H__) */ Modified: trunk/target-sh4/cpu.h =================================================================== --- trunk/target-sh4/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-sh4/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -173,12 +173,8 @@ } #endif -#define CPU_PC_FROM_TB(env, tb) do { \ - env->pc = tb->pc; \ - env->flags = tb->flags; \ - } while (0) - #include "cpu-all.h" +#include "exec-all.h" /* Memory access type */ enum { @@ -269,4 +265,10 @@ #define PTEA_TC (1 << 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 */ Modified: trunk/target-sparc/cpu.h =================================================================== --- trunk/target-sparc/cpu.h 2008-11-18 15:41:18 UTC (rev 5734) +++ trunk/target-sparc/cpu.h 2008-11-18 19:36:03 UTC (rev 5735) @@ -491,12 +491,8 @@ } #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 "exec-all.h" /* sum4m.c, sun4u.c */ void cpu_check_irqs(CPUSPARCState *env); @@ -508,4 +504,10 @@ void cpu_tick_set_limit(void *opaque, uint64_t limit); #endif +static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb) +{ + env->pc = tb->pc; + env->npc = tb->cs_base; +} + #endif