Patchwork target-mips: Use EXCP_SC rather than a magic number

login
register
mail settings
Submitter 陳韋任
Date Dec. 10, 2012, 4:15 p.m.
Message ID <20121210161555.GA44699@cs.nctu.edu.tw>
Download mbox | patch
Permalink /patch/204965/
State New
Headers show

Comments

陳韋任 - Dec. 10, 2012, 4:15 p.m.
From the discussion on the ML [1], the exception limit defined by
magic number 0x100 is actually EXCP_SC defined in cpu.h. Replace the
magic number with EXCP_SC. Remove "#if 1 .. #endif" as well.

[1] http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03080.html

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
---
 target-mips/op_helper.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
陳韋任 - Dec. 20, 2012, 1:23 a.m.
ping? :-)

On Tue, Dec 11, 2012 at 12:15:55AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
>   From the discussion on the ML [1], the exception limit defined by
> magic number 0x100 is actually EXCP_SC defined in cpu.h. Replace the
> magic number with EXCP_SC. Remove "#if 1 .. #endif" as well.
> 
> [1] http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03080.html
> 
> Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> ---
>  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
> +    }
> +
>      env->exception_index = exception;
>      env->error_code = error_code;
>  
> -- 
> 1.7.3.4
liguang - Dec. 20, 2012, 1:59 a.m.
在 2012-12-20四的 09:23 +0800,陳韋任 (Wei-Ren Chen)写道:
> ping? :-)
> 
> On Tue, Dec 11, 2012 at 12:15:55AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
> >   From the discussion on the ML [1], the exception limit defined by
> > magic number 0x100 is actually EXCP_SC defined in cpu.h. Replace the
> > magic number with EXCP_SC. Remove "#if 1 .. #endif" as well.
> > 
> > [1] http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03080.html
> > 
> > Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> > ---
> >  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.

> >      env->exception_index = exception;
> >      env->error_code = error_code;
> >  
> > -- 
> > 1.7.3.4
>
Aurelien Jarno - Jan. 1, 2013, 11:03 a.m.
On Tue, Dec 11, 2012 at 12:15:55AM +0800, 陳韋任 (Wei-Ren Chen) wrote:
>   From the discussion on the ML [1], the exception limit defined by
> magic number 0x100 is actually EXCP_SC defined in cpu.h. Replace the
> magic number with EXCP_SC. Remove "#if 1 .. #endif" as well.
> 
> [1] http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg03080.html
> 
> Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
> ---
>  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
> +    }
> +
>      env->exception_index = exception;
>      env->error_code = error_code;
>  

Thanks, applied.

Patch

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
+    }
+
     env->exception_index = exception;
     env->error_code = error_code;