Skip to contentSkip to conversation

KVM: x86 emulator: fix LMSW able to clear cr0.pe

PATCH In review Avi Kivity 2 participants 3 messages Aug 2, 2010

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: x86 emulator: fix LMSW able to clear cr0.pe

LMSW is documented not to be able to set cr0.pe; make it so.

---
 arch/x86/kvm/emulate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index dc1ecff..05f80f7 100644
@@ -3212,7 +3212,7 @@ twobyte_insn:
 			c->dst.val = ops->get_cr(0, ctxt->vcpu);
 			break;
 		case 6: /* lmsw */
-			ops->set_cr(0, (ops->get_cr(0, ctxt->vcpu) & ~0x0ful) |
+			ops->set_cr(0, (ops->get_cr(0, ctxt->vcpu) & ~0x0eul) |
 				    (c->src.val & 0x0f), ctxt->vcpu);
 			c->dst.type = OP_NONE;
 			break;
Signature · 1 line
1.7.1
maintainer
#1 lore raw
Quoted 1 line · Avi Kivity

LMSW is documented not to be able to set cr0.pe; make it so.

The code is correct, but LMSW is documented not to be able to _clear_ cr0.pe. :)

Paolo

Quoted 18 lines
---
  arch/x86/kvm/emulate.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index dc1ecff..05f80f7 100644
@@ -3212,7 +3212,7 @@ twobyte_insn:
  			c->dst.val = ops->get_cr(0, ctxt->vcpu);
  			break;
  		case 6: /* lmsw */
-			ops->set_cr(0, (ops->get_cr(0, ctxt->vcpu) & ~0x0ful) |
+			ops->set_cr(0, (ops->get_cr(0, ctxt->vcpu) & ~0x0eul) |
  				    (c->src.val & 0x0f), ctxt->vcpu);
  			c->dst.type = OP_NONE;
  			break;
author
#2 lore raw
Quoted 4 lines · Paolo Bonzini
Quoted 1 line · Avi Kivity

LMSW is documented not to be able to set cr0.pe; make it so.

The code is correct, but LMSW is documented not to be able to _clear_ cr0.pe. :)

Right, thinko.

Signature · 1 line
error compiling committee.c: too many arguments to function