qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ed Robbins <er209@kent.ac.uk>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] TCG semantics
Date: Mon, 06 Feb 2017 10:57:42 +0000	[thread overview]
Message-ID: <A01BDA8C-E7A1-47CD-AFE8-3C863ECE3383@kent.ac.uk> (raw)
In-Reply-To: <CAFEAcA_ePwJUVrEh=jXu9Mup=zRwH=CWTjJsKcT7p7tA41ndtw@mail.gmail.com>



On 6 February 2017 10:39:11 GMT+00:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>On 6 February 2017 at 10:14, Ed Robbins <er209@kent.ac.uk> wrote:
>> It seems pretty good. I was surprised that call instructions can
>> have arguments/return specified, and wonder if those are normally
>> just empty, so that emulation of the target stack/registers just
>> carries the args/return in the background. Otherwise TCG must be
>> detecting the target's arguments/return for each call which would
>> need a clever dataflow analysis, or to follow calling convention
>> and just hope, right?
>
>"target" is a tricky word here, because it's unclear whether it
>means the guest or the host CPU architecture. Note that tcg/README
>always means "TCG target" (ie host) when it says "target", as
>per section 2.
>
>The "call" instruction is a call to a host function, so the
>only calling convention in play is the host OS's ABI. (This
>is what we use for calling C helper functions to implement
>more complex bits of the guest emulation.) We don't know or
>care about the guest's calling convention, because TCG only
>sees things at the level of guest instructions and registers.
>

Makes sense, thanks for clearing that up.

>> I also am not clear about the precise operation of the byte
>> swap instruction, but guess it follows the x86 bswap semantics.
>
>Er, there's more than one definition of how to do byteswaps?
>These instructions just swap the bytes in the however-many-bytes
>wide lump of data they're defined to operate on. (If the
>value type is wider than that lump of data then the insns
>are allowed to assume the high bytes are zeroes, ie undefined
>result if they're not.) Happy to take patches for clarifying
>the docs, though.
>

Maybe there's only one way it's done, but it's good to be clear on the precise operation.

Thanks,
Ed

      reply	other threads:[~2017-02-06 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 12:09 [Qemu-devel] TCG semantics E.Robbins
2017-02-03 14:46 ` Stefan Hajnoczi
2017-02-06 10:14   ` Ed Robbins
2017-02-06 10:39     ` Peter Maydell
2017-02-06 10:57       ` Ed Robbins [this message]

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=A01BDA8C-E7A1-47CD-AFE8-3C863ECE3383@kent.ac.uk \
    --to=er209@kent.ac.uk \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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).