Skip to contentSkip to conversation

KVM: x86 emulator: add CALL FAR instruction emulation (opcode 9a)

PATCH In review Wei Yongjun 3 participants 6 messages Aug 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86 emulator: add CALL FAR instruction emulation (opcode 9a)

---
 arch/x86/kvm/emulate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index 26f69c2..e5f7f5c 100644
@@ -2487,7 +2487,7 @@ static struct opcode opcode_table[256] = {
 	X8(D(SrcAcc | DstReg)),
 	/* 0x98 - 0x9F */
 	D(DstAcc | SrcNone), I(ImplicitOps | SrcAcc, em_cwd),
-	D(SrcImmFAddr | No64), N,
+	I(SrcImmFAddr | No64, em_call_far), N,
 	D(ImplicitOps | Stack), D(ImplicitOps | Stack), N, N,
 	/* 0xA0 - 0xA7 */
 	D(ByteOp | DstAcc | SrcMem | Mov | MemAbs), D(DstAcc | SrcMem | Mov | MemAbs),
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 Add realmode test for CALL FAR IMM instruction

---
 x86/realmode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
x86/realmode.c +6 -0
index a833829..2e12680 100644
@@ -437,6 +437,9 @@ void test_call(void)
 			    "ret\n\t"
 			    "2:\t");
 	MK_INSN(call_far1,  "lcallw *(%ebx)\n\t");
+	MK_INSN(call_far2,  ".byte 0x9a\n\t"
+			    ".word retf\n\t"
+			    ".word 0x00\n\t");
 	MK_INSN(ret_imm,    "sub $10, %sp; jmp 2f; 1: retw $10; 2: callw 1b");
 
 	exec_in_big_real_mode(&insn_call1);
@@ -453,6 +456,9 @@ void test_call(void)
 	exec_in_big_real_mode(&insn_call_far1);
 	report("call far 1", 0, 1);
 
+	exec_in_big_real_mode(&insn_call_far2);
+	report("call far 2", 0, 1);
+
 	exec_in_big_real_mode(&insn_ret_imm);
 	report("ret imm 1", 0, 1);
 }
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH] Add realmode test for CALL FAR IMM instruction

Quoted 10 lines · Wei Yongjun
---
 x86/realmode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
x86/realmode.c +0 -0
index a833829..2e12680 100644

x86/realmode.c void test_call(void) · line 442

Quoted 6 lines
x86/realmode.c +3 -0
@@ -437,6 +437,9 @@ void test_call(void)
 			    "ret\n\t"
 			    "2:\t");
 	MK_INSN(call_far1,  "lcallw *(%ebx)\n\t");
+	MK_INSN(call_far2,  ".byte 0x9a\n\t"
+			    ".word retf\n\t"
+			    ".word 0x00\n\t");

Why .byte encoding? won't "lcallw $0, $retf" (or the other way round) work?

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

Re: [PATCH] Add realmode test for CALL FAR IMM instruction

Quoted 9 lines · Wei Yongjun
Quoted 6 lines
---
 x86/realmode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Quoted 14 lines

x86/realmode.c void test_call(void) · line 443

Quoted 12 lines
x86/realmode.c +3 -0
index a833829..2e12680 100644
@@ -437,6 +437,9 @@ void test_call(void)
 			    "ret\n\t"
 			    "2:\t");
 	MK_INSN(call_far1,  "lcallw *(%ebx)\n\t");
+	MK_INSN(call_far2,  ".byte 0x9a\n\t"
+			    ".word retf\n\t"
+			    ".word 0x00\n\t");
 

Why .byte encoding? won't "lcallw $0, $retf" (or the other way round) work?

Oh, it works, I will fix this.

#4 lore raw

PATCH v2 1/1 Add realmode test for CALL FAR IMM instruction

In reply to Avi Kivity
---
 x86/realmode.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
x86/realmode.c +4 -0
index a833829..d171a56 100644
@@ -437,6 +437,7 @@ void test_call(void)
 			    "ret\n\t"
 			    "2:\t");
 	MK_INSN(call_far1,  "lcallw *(%ebx)\n\t");
+	MK_INSN(call_far2,  "lcallw $0, $retf\n\t");
 	MK_INSN(ret_imm,    "sub $10, %sp; jmp 2f; 1: retw $10; 2: callw 1b");
 
 	exec_in_big_real_mode(&insn_call1);
@@ -453,6 +454,9 @@ void test_call(void)
 	exec_in_big_real_mode(&insn_call_far1);
 	report("call far 1", 0, 1);
 
+	exec_in_big_real_mode(&insn_call_far2);
+	report("call far 2", 0, 1);
+
 	exec_in_big_real_mode(&insn_ret_imm);
 	report("ret imm 1", 0, 1);
 }
Signature · 1 line
1.7.0.4