All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"mtosatti@redhat.com" <mtosatti@redhat.com>
Subject: Re: [PATCH] KVM: move DR register access handling into generic code.
Date: Mon, 12 Apr 2010 18:09:50 +0200	[thread overview]
Message-ID: <4BC345CE.2060301@siemens.com> (raw)
In-Reply-To: <4BC3341E.2050108@redhat.com>

Avi Kivity wrote:
> On 04/12/2010 03:27 PM, Gleb Natapov wrote:
>> Currently both SVM and VMX have their own DR handling code. Move it to
>> x86.c.
>>
>>    
> 
> The standard process is to make them identical first and finally merge 
> identical code, but I guess we can skip it in this case (Jan?)

Looks OK, I would just...

> +int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
> +{
> +	switch (dr) {
> +	case 0 ... 3:
> +		vcpu->arch.db[dr] = val;
> +		if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP))
> +			vcpu->arch.eff_db[dr] = val;
> +		break;
> +	case 4:
> +		if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) {
> +			kvm_queue_exception(vcpu, UD_VECTOR);
> +			return 1;
> +		}
> +		/* fall through */
> +	case 6:
> +		if (val & 0xffffffff00000000ULL) {
> +			kvm_inject_gp(vcpu, 0);
> +			return -1;

...either return 1 or -1 on failure.

Jan

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

  reply	other threads:[~2010-04-12 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12 12:27 [PATCH] KVM: move DR register access handling into generic code Gleb Natapov
2010-04-12 14:54 ` Avi Kivity
2010-04-12 16:09   ` Jan Kiszka [this message]
2010-04-12 16:52     ` Gleb Natapov
2010-04-12 16:54       ` Avi Kivity
2010-04-12 17:26         ` 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=4BC345CE.2060301@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 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.