From: Aurelien Jarno <aurelien@aurel32.net>
To: Nathan Froyd <froydnj@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 01/11] target-mips: add ISAMode bits for mips16 execution
Date: Mon, 30 Nov 2009 18:45:23 +0100 [thread overview]
Message-ID: <20091130174523.GA12314@volta.aurel32.net> (raw)
In-Reply-To: <20091128101720.GA6391@volta.aurel32.net>
On Sat, Nov 28, 2009 at 11:17:20AM +0100, Aurelien Jarno wrote:
> On Mon, Nov 23, 2009 at 12:49:59PM -0800, Nathan Froyd wrote:
> >
> > Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
> > ---
> > target-mips/cpu.h | 1 +
> > target-mips/translate.c | 2 ++
> > 2 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/target-mips/cpu.h b/target-mips/cpu.h
> > index 82f9a38..e8febe6 100644
> > --- a/target-mips/cpu.h
> > +++ b/target-mips/cpu.h
> > @@ -167,6 +167,7 @@ struct TCState {
> > target_ulong CP0_TCContext;
> > target_ulong CP0_TCSchedule;
> > target_ulong CP0_TCScheFBack;
> > + uint32_t ISAMode; /* MIPS32 or MIPS16 mode */
> > int32_t CP0_Debug_tcstatus;
> > };
>
> I am fine with this.
>
> > diff --git a/target-mips/translate.c b/target-mips/translate.c
> > index e9d9224..b0a1b29 100644
> > --- a/target-mips/translate.c
> > +++ b/target-mips/translate.c
> > @@ -463,6 +463,7 @@ typedef struct DisasContext {
> > struct TranslationBlock *tb;
> > target_ulong pc, saved_pc;
> > uint32_t opcode;
> > + int isa_mode;
> > int singlestep_enabled;
> > /* Routine used to access memory */
> > int mem_idx;
> > @@ -8306,6 +8307,7 @@ gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
> > ctx.pc = pc_start;
> > ctx.saved_pc = -1;
> > ctx.singlestep_enabled = env->singlestep_enabled;
> > + ctx.isa_mode = env->active_tc.ISAMode;
> > ctx.tb = tb;
> > ctx.bstate = BS_NONE;
> > /* Restore delay slot state from the tb context. */
>
> Instead of a new ctx value, it's probably better to use a new bit in
> hflags. It is also necessary to change MIPS_HFLAG_TMASK accordingly, to
> ensure a MIPS16 translation block is not later executed while ISAMode is
> 0 (while it should generate an exception) and vice-versa.
>
> This also mean that hflags should be recomputed each time ISAMode is
> changed.
>
Actually just changing ctx.hflags is enough, as it is automatically
saved to env->hflags at the end of the TB or if an exception can occur.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
next prev parent reply other threads:[~2009-11-30 19:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 20:49 [Qemu-devel] [PATCH 00/11] target-mips: add mips16 support Nathan Froyd
2009-11-23 20:49 ` [Qemu-devel] [PATCH 01/11] target-mips: add ISAMode bits for mips16 execution Nathan Froyd
2009-11-28 10:17 ` Aurelien Jarno
2009-11-30 17:45 ` Aurelien Jarno [this message]
2009-11-23 20:50 ` [Qemu-devel] [PATCH 02/11] target-mips: add new HFLAGs for JALX and 16/32-bit delay slots Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 03/11] target-mips: change interrupt bits to be mips16-aware Nathan Froyd
2009-11-28 10:17 ` Aurelien Jarno
2009-11-23 20:50 ` [Qemu-devel] [PATCH 04/11] target-mips: move ROTR and ROTRV inside gen_shift_{imm, } Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 05/11] target-mips: make gen_compute_branch 16/32-bit-aware Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 06/11] target-mips: add gen_base_offset_addr Nathan Froyd
2009-11-28 10:17 ` Aurelien Jarno
2009-11-23 20:50 ` [Qemu-devel] [PATCH 07/11] target-mips: split out delay slot handling Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 08/11] target-mips: add enums for MIPS16 opcodes Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 09/11] target-mips: add mips16 instruction decoding Nathan Froyd
2009-11-28 10:17 ` Aurelien Jarno
2009-11-23 20:50 ` [Qemu-devel] [PATCH 10/11] gdbstub: add MIPS16 support Nathan Froyd
2009-11-23 20:50 ` [Qemu-devel] [PATCH 11/11] target-mips: add copyright notice for mips16 work Nathan Froyd
2009-11-28 10:17 ` [Qemu-devel] [PATCH 00/11] target-mips: add mips16 support Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091130174523.GA12314@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=froydnj@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).