Skip to contentSkip to conversation

KVM: Initialize rip for real mode interrupt injection

PATCH In review Avi Kivity 2 participants 9 messages Aug 18, 2010

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: Initialize rip for real mode interrupt injection

---
 arch/x86/kvm/x86.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +1 -0
index f6a31a1..e2b0e36 100644
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
 
 	vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
 	vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+	vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);
 	ret = emulate_int_real(&vcpu->arch.emulate_ctxt, &emulate_ops, irq);
 
 	if (ret != X86EMUL_CONTINUE)
Signature · 1 line
1.7.1
author
#1 lore raw
Quoted 10 lines · Avi Kivity
---
  arch/x86/kvm/x86.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) · line 3973

Quoted 7 lines
arch/x86/kvm/x86.c +1 -0
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
 
  	vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
  	vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+	vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);
  	ret = emulate_int_real(&vcpu->arch.emulate_ctxt,&emulate_ops, irq);
 
  	if (ret != X86EMUL_CONTINUE)

With this, the non-atomic-injection branch trips into an unemulated DAS instruction (when it doesn't inject an interrupt at the wrong place).

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#2 lore raw
In reply to Avi Kivity
Quoted 10 lines · Avi Kivity

---
 arch/x86/kvm/x86.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) · line 3970

Quoted 4 lines
arch/x86/kvm/x86.c +1 -0
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
 
        vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
        vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Quoted 7 lines
arch/x86/kvm/x86.c +0 -1
        ret = emulate_int_real(&vcpu->arch.emulate_ctxt, &emulate_ops, irq);
 
        if (ret != X86EMUL_CONTINUE)
--

1.7.1

author
#3 lore raw
Quoted 12 lines · Mohammed Gamal
Quoted 11 lines · Avi Kivity
---
  arch/x86/kvm/x86.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq)
 
Quoted 9 lines

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) · line 3970

Quoted 3 lines
arch/x86/kvm/x86.c +1 -0
        vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
        vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Right, patch updated.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
author
#4 lore raw
Quoted 24 lines · Avi Kivity
Quoted 13 lines · Mohammed Gamal
Quoted 12 lines · Avi Kivity
---
  arch/x86/kvm/x86.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct 
 kvm_vcpu *vcpu, int irq)
 
Quoted 9 lines

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) · line 3970

Quoted 3 lines
arch/x86/kvm/x86.c +1 -0
        vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
        vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Quoted 2 lines

Right, patch updated.

btw, with the other fixes in non-atomic-injection the bios is able to boot up to the "no bootable device" message.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#5 lore raw
Quoted 29 lines · Avi Kivity
Quoted 28 lines · Avi Kivity
Quoted 25 lines · Mohammed Gamal
Quoted 11 lines · Avi Kivity

---
 arch/x86/kvm/x86.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu · line 3971

Quoted 5 lines
arch/x86/kvm/x86.c +1 -0
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu
 *vcpu, int irq)
 
        vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
        vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip =  vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Quoted 5 lines
Quoted 2 lines

Right, patch updated.

btw, with the other fixes in non-atomic-injection the bios is able to boot up to the "no bootable device" message.

Did u try running it with any actual guests?

Quoted 6 lines

--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.

author
#6 lore raw
Quoted 25 lines · Mohammed Gamal
Quoted 24 lines · Avi Kivity
Quoted 23 lines · Avi Kivity
Quoted 22 lines · Mohammed Gamal
Quoted 10 lines · Avi Kivity
---
  arch/x86/kvm/x86.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644

arch/x86/kvm/x86.c int kvm_inject_realmode_interrupt(struct kvm_vcpu · line 3971

Quoted 5 lines
arch/x86/kvm/x86.c +1 -0
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu
 *vcpu, int irq)
 
        vcpu->arch.emulate_ctxt.decode.op_bytes = 2;
        vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip = vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

Right, patch updated.

btw, with the other fixes in non-atomic-injection the bios is able to boot
up to the "no bootable device" message.

Did u try running it with any actual guests?

I did, the disk is not recognized, so something's still broken.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#7 lore raw
Quoted 36 lines · Avi Kivity
Quoted 35 lines · Mohammed Gamal
Quoted 33 lines · Avi Kivity
Quoted 31 lines · Avi Kivity
Quoted 16 lines · Mohammed Gamal
Quoted 14 lines · Avi Kivity

---
 arch/x86/kvm/x86.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kvm/x86.c +0 -0
index f6a31a1..e2b0e36 100644
@@ -3967,6 +3967,7 @@ int kvm_inject_realmode_interrupt(struct

kvm_vcpu
*vcpu, int irq)

Quoted 10 lines
Quoted 3 lines

       vcpu->arch.emulate_ctxt.decode.op_bytes = 2; vcpu->arch.emulate_ctxt.decode.ad_bytes = 2;
+       vcpu->arch.emulate_ctxt.decode.eip = kvm_rip_read(vcpu);

I think it'd make more sense to make vcpu->arch.emulate_ctxt.decode.eip =  vcpu->arch.emulate_ctxt.eip, as we already initlialize the emulation context eip. It's not going to make any real difference, but it's more readable this way I suppose, and is symmetric to the assignment of the emulation context eip value after the call to emulate_int_real()

Right, patch updated.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

btw, with the other fixes in non-atomic-injection the bios is able to boot
 up to the "no bootable device" message.

Did u try running it with any actual guests?

I did, the disk is not recognized, so something's still broken.

So far I get hard disk images recognized, but cdrom images aren't.

Quoted 6 lines

--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.

author
#8 lore raw
Quoted 3 lines · Mohammed Gamal
Quoted 2 lines

I did, the disk is not recognized, so something's still broken.

So far I get hard disk images recognized, but cdrom images aren't.

Try DEBUG_BIOS in pc.c and see why.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.