From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9hZf-0007kj-Ca for qemu-devel@nongnu.org; Sat, 01 Feb 2014 15:54:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9hZa-0001WF-G3 for qemu-devel@nongnu.org; Sat, 01 Feb 2014 15:53:59 -0500 Received: from ssl.serverraum.org ([88.198.40.39]:59139) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9hZa-0001W9-3T for qemu-devel@nongnu.org; Sat, 01 Feb 2014 15:53:54 -0500 From: Michael Walle Date: Sat, 1 Feb 2014 21:53:50 +0100 References: <1390246471-25167-1-git-send-email-michael@walle.cc> <1390246471-25167-12-git-send-email-michael@walle.cc> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201402012153.50410.michael@walle.cc> Subject: Re: [Qemu-devel] [PULL v4 11/12] target-lm32: stop VM on illegal or unknown instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Anthony Liguori Am Samstag, 1. Februar 2014, 19:06:40 schrieb Peter Maydell: > On 20 January 2014 19:34, Michael Walle 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 > > --- > > > > 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