qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Brady <sdbrady@ntlworld.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH] s390x-linux-user
Date: Fri, 26 Jun 2009 20:07:14 +0100	[thread overview]
Message-ID: <20090626190714.GA464@miranda.arrow> (raw)
In-Reply-To: <f43fc5580906261017o1eace71dn8b6483fa354e693d@mail.gmail.com>

On Fri, Jun 26, 2009 at 08:17:42PM +0300, Blue Swirl wrote:
> On 6/26/09, Ulrich Hecht <uli@suse.de> wrote:
> > There is a very peculiar S/390 instruction called "EXECUTE". What it does
> > is to take another instruction stored somewhere in memory, logical-OR
> > the second byte of the instruction with the LSB of R0 and then execute
> > the result, without changing the instruction in memory or the program
> > counter. Any idea how to implement this in QEMU? Currently, I'm
> > interpreting the couple of instructions that GCC uses EXECUTE with, but
> > in the long run that would amount to implementing a second emulator...
> 
> Maybe something like this: Make a special TB of the EXECUTE
> instruction and add LSB of R0 to TB flags for these TBs. Then you can
> examine R0, OR and generate code at translation time. The TBs linking
> to EXECUTE TB may need to be special too in order to track for R0.

Stupid idea, I expect, but would it be possible to handle EXECUTE by 
'branching' to the 'instruction stored somewhere in memory', using one
bit to hold the state of R0, and another indicate that the TB is a 
special EXECUTE TB (i.e. only a single instruction should be decoded,
the LSB of R0 should be ORed, and code must be generated to return to 
the 'caller'), and another bit for the state of the LSB of R0?

Presumably, SMC handling would safely deal with the memory holding that
instruction being written to.  (If all variants of S/390 need precise
SMC handling, I suppose that shouldn't be a problem?)

My only real concern would be that it must not be possible to observe
this behaviour.  (I.e. an interrupt arriving at the 'wrong' moment or 
the EXECUTEd instruction faulting must be properly handled.)

Also, if S/390 has separate read/execute page bits, would access to the
memory location in question still count as 'execution'?  I suppose this
would also be possible to work around, though...

I won't be totally surprised if someone tells me that this would be
completely unworkable, but I'd be interested in learning why, if that
is indeed the case. :-)

Cheers,
-- 
Stuart Brady

  parent reply	other threads:[~2009-06-26 19:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-26 16:49 [Qemu-devel] [RFC PATCH] s390x-linux-user Ulrich Hecht
2009-06-26 17:17 ` Blue Swirl
2009-06-26 17:40   ` Paul Brook
2009-06-26 17:46     ` Blue Swirl
2009-06-26 17:59       ` Paul Brook
2009-06-26 18:18         ` Paul Brook
2009-06-26 18:22         ` Blue Swirl
2009-06-26 18:39           ` Paul Brook
2009-06-26 19:07   ` Stuart Brady [this message]
2009-06-26 19:24     ` Paul Brook
2009-07-03 15:11     ` Ulrich Hecht

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=20090626190714.GA464@miranda.arrow \
    --to=sdbrady@ntlworld.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).