public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	Gleb Natapov <gleb@redhat.com>
Subject: Re: KVM: x86: Push potential exception error code on task switches
Date: Wed, 14 Apr 2010 14:58:09 +0200	[thread overview]
Message-ID: <4BC5BBE1.5070706@siemens.com> (raw)
In-Reply-To: <4BC5BA84.8070507@redhat.com>

Avi Kivity wrote:
> On 04/14/2010 03:37 PM, Jan Kiszka wrote:
>> Avi Kivity wrote:
>>    
>>> On 04/14/2010 03:11 PM, Jan Kiszka wrote:
>>>      
>>>> When a fault triggers a task switch, the error code, if it exists, has
>>>> to be pushed on the new task's stack. Implement the missing bits.
>>>>
>>>>
>>>> @@ -2416,12 +2417,23 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
>>>>    	ops->set_cached_descriptor(&next_tss_desc, VCPU_SREG_TR, ctxt->vcpu);
>>>>    	ops->set_segment_selector(tss_selector, VCPU_SREG_TR, ctxt->vcpu);
>>>>
>>>> +	if (ret == X86EMUL_CONTINUE&&   has_error_code) {
>>>> +		struct decode_cache *c =&ctxt->decode;
>>>> +
>>>> +		c->op_bytes = c->ad_bytes = (next_tss_desc.type&   8) ? 4 : 2;
>>>>
>>>>        
>>> Don't these depend on the attributes of the segment as well?
>>>      
>> Not on the segment, but actually on the gate size. Will fix.
>>    
> 
> The TSS descriptor (gate doesn't have a size).  But isn't it possible to 
> have a 32-bit TSS with a 16-bit CS/SS?

Might be possible, but will cause troubles as the spec says:

"The error code is pushed on the stack as a doubleword or word
(depending on the default interrupt, trap, or task gate size)."

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2010-04-14 12:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-14 12:11 KVM: x86: Push potential exception error code on task switches Jan Kiszka
2010-04-14 12:22 ` Avi Kivity
2010-04-14 12:37   ` Jan Kiszka
2010-04-14 12:39     ` Jan Kiszka
2010-04-14 12:52     ` Avi Kivity
2010-04-14 12:58       ` Jan Kiszka [this message]
2010-04-14 13:07         ` Avi Kivity
2010-04-14 13:08           ` Avi Kivity
2010-04-14 13:19           ` Jan Kiszka
2010-04-15  8:41             ` Avi Kivity
2010-04-15  8:47               ` Jan Kiszka
2010-04-14 12:38 ` Gleb Natapov
2010-04-14 12:43   ` Jan Kiszka
2010-04-14 13:00   ` Jan Kiszka
2010-04-14 14:09     ` Gleb Natapov

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=4BC5BBE1.5070706@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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