public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lmsw sets lower 16 bits of cr0, not just lower 4
@ 2007-08-01  0:31 Rusty Russell
       [not found] ` <1185928308.6131.116.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2007-08-01  0:31 UTC (permalink / raw)
  To: kvm-devel

According to my Intel manual, although lmsw only causes an exit when
trying to set the bottom 4 bits, it is supposed to set the bottom 16
bits of cr0.

Signed-off-by: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>

diff -r f06a5d7dc984 drivers/kvm/kvm_main.c
--- a/drivers/kvm/kvm_main.c	Wed Jul 25 13:05:14 2007 +1000
+++ b/drivers/kvm/kvm_main.c	Wed Jul 25 13:15:24 2007 +1000
@@ -526,7 +526,7 @@ EXPORT_SYMBOL_GPL(set_cr0);
 
 void lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
 {
-	set_cr0(vcpu, (vcpu->cr0 & ~0x0ful) | (msw & 0x0f));
+	set_cr0(vcpu, (vcpu->cr0 & ~0xffffUL) | (msw & 0xffff));
 }
 EXPORT_SYMBOL_GPL(lmsw);
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lmsw sets lower 16 bits of cr0, not just lower 4
       [not found] ` <1185928308.6131.116.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2007-08-01 18:44   ` Avi Kivity
       [not found]     ` <46B0D4A8.7040001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2007-08-01 18:44 UTC (permalink / raw)
  To: Rusty Russell; +Cc: kvm-devel

Rusty Russell wrote:
> According to my Intel manual, although lmsw only causes an exit when
> trying to set the bottom 4 bits, it is supposed to set the bottom 16
> bits of cr0.
>
>   

Well, _my_ Intel manual (2A) says:

> Loads the source operand into the machine status word, bits 0 through 
> 15 of register CR0. The
> source operand can be a 16-bit general-purpose register or a memory 
> location. Only the low-
> order 4 bits of the source operand (which contains the PE, MP, EM, and 
> TS flags) are loaded
> into CR0. The PG, CD, NW, AM, WP, NE, and ET flags of CR0 are not 
> affected. The operand-
> size attribute has no effect on this instruction.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lmsw sets lower 16 bits of cr0, not just lower 4
       [not found]     ` <46B0D4A8.7040001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-08-01 23:32       ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2007-08-01 23:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

On Wed, 2007-08-01 at 21:44 +0300, Avi Kivity wrote:
> Rusty Russell wrote:
> > According to my Intel manual, although lmsw only causes an exit when
> > trying to set the bottom 4 bits, it is supposed to set the bottom 16
> > bits of cr0.
> >
> >   
> 
> Well, _my_ Intel manual (2A) says:
> 
> > Loads the source operand into the machine status word, bits 0 through 
> > 15 of register CR0. The
> > source operand can be a 16-bit general-purpose register or a memory 
> > location. Only the low-
> > order 4 bits of the source operand (which contains the PE, MP, EM, and 
> > TS flags) are loaded

Damn, I should have kept reading.

Sorry for the noise!
Rusty.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-01 23:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-01  0:31 [PATCH] lmsw sets lower 16 bits of cr0, not just lower 4 Rusty Russell
     [not found] ` <1185928308.6131.116.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-08-01 18:44   ` Avi Kivity
     [not found]     ` <46B0D4A8.7040001-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-01 23:32       ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox