kvm tools, bios: Setup CF after returning from interrupt handler

While reading the code, I noticed that we don't set CF in our interrupt handler
stubs. The guest kernel may think the interrupt handler succeeded depending on
whether or not it has set CF by itself (or whether BIOS code set it by chance).

While at it, fix INT 10h handler to clear CF to make sure the guest kernel
knows the interrupt handler succeeded.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Pekka Enberg
2015-06-01 16:39:47 +01:00
committed by Will Deacon
parent 7e012d3cec
commit 24a93433bb
+13 -3
View File
@@ -10,10 +10,19 @@
#include "macro.S"
#define EFLAGS_CF (1 << 0)
/*
* fake interrupt handler, nothing can be faster ever
*/
ENTRY(bios_intfake)
/*
* Set CF to indicate failure. We don't want callers to think that the
* interrupt handler succeeded and then treat the return values in
* registers as valid data.
*/
orl $EFLAGS_CF, 0x4(%esp)
IRET
ENTRY_END(bios_intfake)
@@ -48,11 +57,12 @@ ENTRY(bios_int10)
popl %es
popw %fs
/* Clear CF to indicate success. */
andl $~EFLAGS_CF, 0x4(%esp)
IRET
ENTRY_END(bios_int10)
#define EFLAGS_CF (1 << 0)
ENTRY(bios_int15)
cmp $0xE820, %eax
jne 1f
@@ -76,7 +86,7 @@ ENTRY(bios_int15)
popw %fs
/* Clear CF */
/* Clear CF to indicate success. */
andl $~EFLAGS_CF, 0x4(%esp)
1:
IRET