From patchwork Thu Dec 20 02:14:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: target-mips: Use EXCP_SC rather than a magic number Date: Wed, 19 Dec 2012 16:14:20 -0000 From: =?utf-8?b?6Zmz6Z+L5Lu7?= X-Patchwork-Id: 207600 Message-Id: <20121220021420.GA11565@cs.nctu.edu.tw> To: li guang Cc: Aurelien Jarno , qemu-devel@nongnu.org, =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= , "Johnson, Eric" Hi Li, > > > Signed-off-by: Chen Wei-Ren > > > --- > > > target-mips/op_helper.c | 6 +++--- > > > 1 files changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c > > > index f45d494..98a445c 100644 > > > --- a/target-mips/op_helper.c > > > +++ b/target-mips/op_helper.c > > > @@ -39,10 +39,10 @@ static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, > > > uintptr_t pc) > > > { > > > TranslationBlock *tb; > > > -#if 1 > > > - if (exception < 0x100) > > > + if (exception < EXCP_SC) { > > > qemu_log("%s: %d %d\n", __func__, exception, error_code); > > > -#endif > > > + } > > > + > > seems original '#if 1, #endif' statement > is for temporary debug only, > so maybe can be concealed out entirely. > for log purpose, every exception code > will log when 'do_interrupt' for MIPS > if log is enabled. Thanks for your feedback. You mean the code snippet below? --- target-mips/helper.c void do_interrupt (CPUMIPSState *env) { ... if (qemu_log_enabled() && env->exception_index != EXCP_EXT_INTERRUPT) { if (env->exception_index < 0 || env->exception_index > EXCP_LAST) name = "unknown"; else name = excp_names[env->exception_index]; qemu_log("%s enter: PC " TARGET_FMT_lx " EPC " TARGET_FMT_lx " %s exception\n", __func__, env->active_tc.PC, env->CP0_EPC, name); } ... } Maybe we can do this way? --- --- Aurelien, Johnson, thoughts? :) Regards, chenwj diff --git a/target-mips/cpu.h b/target-mips/cpu.h index 31602ac..507a213 100644 --- a/target-mips/cpu.h +++ b/target-mips/cpu.h @@ -616,9 +616,9 @@ enum { EXCP_DSPDIS, EXCP_LAST = EXCP_DSPDIS, + /* Dummy exception for conditional stores. */ + EXCP_SC = EXCP_LAST, }; -/* Dummy exception for conditional stores. */ -#define EXCP_SC 0x100 /* * This is an interrnally generated WAKE request line.