19 Jun 2013 17:00
[PATCH 1/2] kvm-unit-tests: Add a func to run instruction in emulator
Arthur Chunqi Li <yzt356 <at> gmail.com>
2013-06-19 15:00:56 GMT
2013-06-19 15:00:56 GMT
Add a function trap_emulator to run an instruction in emulator.
Set inregs first (%rax is invalid because it is used as return
address), put instruction codec in alt_insn and call func with
alt_insn_length. Get results in outregs.
Signed-off-by: Arthur Chunqi Li <yzt356 <at> gmail.com>
---
x86/emulator.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
mode change 100644 => 100755 x86/emulator.c
diff --git a/x86/emulator.c b/x86/emulator.c
old mode 100644
new mode 100755
index 96576e5..48d45c8
--- a/x86/emulator.c
+++ b/x86/emulator.c
<at> <at> -11,6 +11,15 <at> <at> int fails, tests;
static int exceptions;
+struct regs {
+ u64 rax, rbx, rcx, rdx;
+ u64 rsi, rdi, rsp, rbp;
+ u64 r8, r9, r10, r11;
+ u64 r12, r13, r14, r15;
+ u64 rip, rflags;
+};
+struct regs inregs, outregs, save;
+
(Continue reading)
RSS Feed