KVM: x86 emulator: add CALL FAR instruction emulation (opcode 9a)
PATCH 1/1 KVM: x86 emulator: add CALL FAR instruction emulation (opcode 9a)
Signed-off-by Wei Yongjun <[email protected]>
--- arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
@@ -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
PATCH 1/1 Add realmode test for CALL FAR IMM instruction
Signed-off-by Wei Yongjun <[email protected]>
--- x86/realmode.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
x86/realmode.c +6 -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" );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
Re: [PATCH] Add realmode test for CALL FAR IMM instruction
Quoted 10 lines · Wei Yongjun
Signed-off-by Wei Yongjun <[email protected]>--- x86/realmode.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)x86/realmode.c +0
-0
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.
Re: [PATCH] Add realmode test for CALL FAR IMM instruction
Quoted 9 lines · Wei Yongjun
Quoted 6 lines
Signed-off-by Wei Yongjun <[email protected]>--- 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@@ -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.
PATCH v2 1/1 Add realmode test for CALL FAR IMM instruction
In reply to Avi KivitySigned-off-by Wei Yongjun <[email protected]>
--- x86/realmode.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
x86/realmode.c +4 -0
@@ -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
Quoted 4 lines · Wei Yongjun
Signed-off-by Wei Yongjun <[email protected]>--- arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied (and v2 testcase), thanks.