qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v4 11/12] target-lm32: stop VM on illegal or unkn


From: Michael Walle
Subject: Re: [Qemu-devel] [PULL v4 11/12] target-lm32: stop VM on illegal or unknown instruction
Date: Sat, 1 Feb 2014 21:53:50 +0100
User-agent: KMail/1.13.7 (Linux/3.2.0-4-686-pae; KDE/4.8.4; i686; ; )

Am Samstag, 1. Februar 2014, 19:06:40 schrieb Peter Maydell:
> On 20 January 2014 19:34, Michael Walle <address@hidden> wrote:
> > Instead of translating the instruction to a no-op, pause the VM and
> > display a message to the user.
> > 
> > As a side effect, this also works for instructions where the operands are
> > only known at runtime.
> > 
> > Signed-off-by: Michael Walle <address@hidden>
> > ---
> > 
> >  target-lm32/helper.h    |    1 +
> >  target-lm32/op_helper.c |   17 +++++++++
> >  target-lm32/translate.c |   91
> >  +++++++++++++++++++++++++++++++---------------- 3 files changed, 79
> >  insertions(+), 30 deletions(-)
> > 
> > diff --git a/target-lm32/helper.h b/target-lm32/helper.h
> > index ad44fdf..f4442e0 100644
> > --- a/target-lm32/helper.h
> > +++ b/target-lm32/helper.h
> > @@ -13,5 +13,6 @@ DEF_HELPER_1(rcsr_im, i32, env)
> > 
> >  DEF_HELPER_1(rcsr_ip, i32, env)
> >  DEF_HELPER_1(rcsr_jtx, i32, env)
> >  DEF_HELPER_1(rcsr_jrx, i32, env)
> > 
> > +DEF_HELPER_1(ill, void, env)
> > 
> >  #include "exec/def-helper.h"
> > 
> > diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
> > index 71f21d1..7189cb5 100644
> > --- a/target-lm32/op_helper.c
> > +++ b/target-lm32/op_helper.c
> > @@ -8,6 +8,10 @@
> > 
> >  #include "exec/softmmu_exec.h"
> > 
> > +#ifndef CONFIG_USER_ONLY
> > +#include "sysemu/sysemu.h"
> > +#endif
> > +
> > 
> >  #if !defined(CONFIG_USER_ONLY)
> >  #define MMUSUFFIX _mmu
> >  #define SHIFT 0
> > 
> > @@ -39,6 +43,19 @@ void HELPER(hlt)(CPULM32State *env)
> > 
> >      cpu_loop_exit(env);
> >  
> >  }
> > 
> > +void HELPER(ill)(CPULM32State *env)
> > +{
> > +#ifndef CONFIG_USER_ONLY
> > +    CPUState *cs = CPU(lm32_env_get_cpu(env));
> > +    fprintf(stderr, "VM paused due to illegal instruction. "
> > +            "Connect a debugger or switch to the monitor console "
> > +            "to find out more.\n");
> > +    qemu_system_vmstop_request(RUN_STATE_PAUSED);
> > +    cs->halted = 1;
> > +    raise_exception(env, EXCP_HALTED);
> > +#endif
> 
> Not really convinced this is a great idea. "This one target CPU
> type does something that none of the others do" seems less
> than ideal for QEMU as a whole.

this was discussed some time ago. unfortunately, i don't find the thread atm.

the particular problem with the lm32 target is that there is no defined 
behaviour if some unsupported opcode is executed on the real hardware, esp. 
there are no exceptions if that happens.

therefore the suggested behaviour was to just stop the emulation and give the 
developer the chance to look at it by connecting a debugger.

keep in mind that the lm32 target is more a development aid, rather than a 
real virtualization target.

-michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]