All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: Keir Fraser <keir@XenSource.com>
Cc: xen-devel@lists.xensource.com, Ian Campbell <Ian.Campbell@XenSource.com>
Subject: Re: trap bounce flags
Date: Wed, 25 Apr 2007 11:33:03 +0100	[thread overview]
Message-ID: <462F4A7F.76E4.0078.0@novell.com> (raw)
In-Reply-To: <C254E789.DCFB%keir@xensource.com>

>> - int80_direct_trap checks for non-zero TRAPBOUNCE_flags, yet
>>   {,compat_}create_bounce_frame clear the low byte of these flags (i.e.
>>   including TBF_exception, which is in this lower byte); it appears to be only
>>   a lucky coincidence that this still works as the cmp (again!) is suffix-less
>>   and hence gets sized as a 32-bit compare, accidentally coveringTRAPBOUNCE_cs
>
>Ooo, good catch. It's a tiny bit gross but the best fix is probably just to
>restore the flags field after the call to create_bounce_frame. And of course
>change the cmp to a cmpb. Agree?

That's the alternative solution I considered. The preferable one is to do the
compat/native distinction before the null check, and then be consistent with
the rest of the code and check cs for 32-bit guest and eip for 64-bit ones.
That's how I'm preparing a patch right now.

>> - from the above, why is it that only the lower byte (if anything) needs
>> clearing?
>
>Really it's a one-byte field: it's consistently treated that way in asm
>code. The upper byte is always zero. We should probably make the field
>explicitly uint8_t. Agree?

Making it a uint8_t is fine. It is, however, far from being consistently handled
in assembly code:
x86_32/entry.S: 4 word refs and 3 byte refs
x86_64/entry.S: 6 word refs, 3 byte refs, and one size-less ref
x86_64/compat/entry.S: 4 word refs and 3 byte refs

Jan

  parent reply	other threads:[~2007-04-25 10:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-25  9:56 trap bounce flags Jan Beulich
2007-04-25 10:10 ` Keir Fraser
2007-04-25 10:16   ` Keir Fraser
2007-04-25 10:33   ` Jan Beulich [this message]
2007-04-25 10:41     ` Keir Fraser
2007-04-25 10:56       ` Keir Fraser
2007-04-25 11:11         ` Jan Beulich
2007-04-25 11:26           ` Keir Fraser
2007-04-25 11:48             ` Jan Beulich

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=462F4A7F.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=Ian.Campbell@XenSource.com \
    --cc=keir@XenSource.com \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.