lkml.org 
[lkml]   [2014]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH kvm-unit-tests 1/3] x86: Check rflags.rf is cleared after emulation
Date
RFLAGS.RF should be cleared after every instruction emulation. Recently
discovered bug indicated this is not the case. This patch adds a test to check
this behavior. It is done by setting RF, executing IRET and checking whether
the saved RF is cleared. Since the flags are saved several instructions after
IRET is executed, RF should be cleared.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
x86/realmode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index 10c3e03..09e6aa7 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -744,7 +744,7 @@ void test_iret()
MK_INSN(iret_flags32, "pushfl\n\t"
"popl %eax\n\t"
"andl $~0x2, %eax\n\t"
- "orl $0xffc08028, %eax\n\t"
+ "orl $0xffc18028, %eax\n\t"
"pushl %eax\n\t"
"pushl %cs\n\t"
"call 1f\n\t"
@@ -773,6 +773,7 @@ void test_iret()

exec_in_big_real_mode(&insn_iret_flags32);
report("iret 3", R_AX, 1);
+ report("rflags.rf", ~0, !(outregs.eflags & (1 << 16)));

exec_in_big_real_mode(&insn_iret_flags16);
report("iret 4", R_AX, 1);
--
1.9.1


\
 
 \ /
  Last update: 2014-07-21 14:41    [W:0.170 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site