KVM: x86 emulator: fix LMSW able to clear cr0.pe
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.
Signed-off-by Avi Kivity <[email protected]>
--- arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
@@ -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
Paolo Bonzini
maintainerQuoted 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
Signed-off-by Avi Kivity<[email protected]>--- arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/x86/kvm/emulate.c +1
-1@@ -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 ;
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