* [kvm-unit-tests PATCH] x86: realmode: Add suffixes for push, pop and iret
@ 2020-05-29 21:26 Roman Bolshakov
2020-06-01 8:47 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Roman Bolshakov @ 2020-05-29 21:26 UTC (permalink / raw)
To: kvm; +Cc: Roman Bolshakov, Paolo Bonzini
binutils 2.33 and 2.34 changed generation of PUSH and POP for segment
registers and IRET in '.code16gcc' [1][2][3][4]. gas also yields the
following warnings during the build of realmode.c:
snip.s: Assembler messages:
snip.s:2279: Warning: generating 32-bit `push', unlike earlier gas versions
snip.s:2296: Warning: generating 32-bit `pop', unlike earlier gas versions
snip.s:3633: Warning: generating 16-bit `iret' for .code16gcc directive
This change fixes warnings and failures of the tests:
push/pop 3
push/pop 4
iret 1
iret 3
1. https://sourceware.org/bugzilla/show_bug.cgi?id=24485
2. https://sourceware.org/git/?p=binutils-gdb.git;h=7cb22ff84745
3. https://sourceware.org/git/?p=binutils-gdb.git;h=06f74c5cb868
4. https://sourceware.org/git/?p=binutils-gdb.git;h=13e600d0f560
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
x86/realmode.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/x86/realmode.c b/x86/realmode.c
index 3518224..234d607 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -649,24 +649,24 @@ static void test_push_pop(void)
MK_INSN(push_es, "mov $0x231, %bx\n\t" //Just write a dummy value to see if it gets overwritten
"mov $0x123, %ax\n\t"
"mov %ax, %es\n\t"
- "push %es\n\t"
+ "pushw %es\n\t"
"pop %bx \n\t"
);
MK_INSN(pop_es, "push %ax\n\t"
- "pop %es\n\t"
+ "popw %es\n\t"
"mov %es, %bx\n\t"
);
- MK_INSN(push_pop_ss, "push %ss\n\t"
+ MK_INSN(push_pop_ss, "pushw %ss\n\t"
"pushw %ax\n\t"
"popw %ss\n\t"
"mov %ss, %bx\n\t"
- "pop %ss\n\t"
+ "popw %ss\n\t"
);
- MK_INSN(push_pop_fs, "push %fs\n\t"
+ MK_INSN(push_pop_fs, "pushl %fs\n\t"
"pushl %eax\n\t"
"popl %fs\n\t"
"mov %fs, %ebx\n\t"
- "pop %fs\n\t"
+ "popl %fs\n\t"
);
MK_INSN(push_pop_high_esp_bits,
"xor $0x12340000, %esp \n\t"
@@ -752,7 +752,7 @@ static void test_iret(void)
"pushl %cs\n\t"
"call 1f\n\t" /* a near call will push eip onto the stack */
"jmp 2f\n\t"
- "1: iret\n\t"
+ "1: iretl\n\t"
"2:\n\t"
);
@@ -771,7 +771,7 @@ static void test_iret(void)
"pushl %cs\n\t"
"call 1f\n\t"
"jmp 2f\n\t"
- "1: iret\n\t"
+ "1: iretl\n\t"
"2:\n\t");
MK_INSN(iret_flags16, "pushfw\n\t"
@@ -1340,10 +1340,10 @@ static void test_lds_lss(void)
{
init_inregs(&(struct regs){ .ebx = (unsigned long)&desc });
- MK_INSN(lds, "push %ds\n\t"
+ MK_INSN(lds, "pushl %ds\n\t"
"lds (%ebx), %eax\n\t"
"mov %ds, %ebx\n\t"
- "pop %ds\n\t");
+ "popl %ds\n\t");
exec_in_big_real_mode(&insn_lds);
report("lds", R_AX | R_BX,
outregs.eax == (unsigned long)desc.address &&
@@ -1356,28 +1356,28 @@ static void test_lds_lss(void)
outregs.eax == (unsigned long)desc.address &&
outregs.ebx == desc.sel);
- MK_INSN(lfs, "push %fs\n\t"
+ MK_INSN(lfs, "pushl %fs\n\t"
"lfs (%ebx), %eax\n\t"
"mov %fs, %ebx\n\t"
- "pop %fs\n\t");
+ "popl %fs\n\t");
exec_in_big_real_mode(&insn_lfs);
report("lfs", R_AX | R_BX,
outregs.eax == (unsigned long)desc.address &&
outregs.ebx == desc.sel);
- MK_INSN(lgs, "push %gs\n\t"
+ MK_INSN(lgs, "pushl %gs\n\t"
"lgs (%ebx), %eax\n\t"
"mov %gs, %ebx\n\t"
- "pop %gs\n\t");
+ "popl %gs\n\t");
exec_in_big_real_mode(&insn_lgs);
report("lgs", R_AX | R_BX,
outregs.eax == (unsigned long)desc.address &&
outregs.ebx == desc.sel);
- MK_INSN(lss, "push %ss\n\t"
+ MK_INSN(lss, "pushl %ss\n\t"
"lss (%ebx), %eax\n\t"
"mov %ss, %ebx\n\t"
- "pop %ss\n\t");
+ "popl %ss\n\t");
exec_in_big_real_mode(&insn_lss);
report("lss", R_AX | R_BX,
outregs.eax == (unsigned long)desc.address &&
--
2.26.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [kvm-unit-tests PATCH] x86: realmode: Add suffixes for push, pop and iret
2020-05-29 21:26 [kvm-unit-tests PATCH] x86: realmode: Add suffixes for push, pop and iret Roman Bolshakov
@ 2020-06-01 8:47 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2020-06-01 8:47 UTC (permalink / raw)
To: Roman Bolshakov, kvm
On 29/05/20 23:26, Roman Bolshakov wrote:
> binutils 2.33 and 2.34 changed generation of PUSH and POP for segment
> registers and IRET in '.code16gcc' [1][2][3][4]. gas also yields the
> following warnings during the build of realmode.c:
>
> snip.s: Assembler messages:
> snip.s:2279: Warning: generating 32-bit `push', unlike earlier gas versions
> snip.s:2296: Warning: generating 32-bit `pop', unlike earlier gas versions
> snip.s:3633: Warning: generating 16-bit `iret' for .code16gcc directive
>
> This change fixes warnings and failures of the tests:
>
> push/pop 3
> push/pop 4
> iret 1
> iret 3
>
> 1. https://sourceware.org/bugzilla/show_bug.cgi?id=24485
> 2. https://sourceware.org/git/?p=binutils-gdb.git;h=7cb22ff84745
> 3. https://sourceware.org/git/?p=binutils-gdb.git;h=06f74c5cb868
> 4. https://sourceware.org/git/?p=binutils-gdb.git;h=13e600d0f560
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
> x86/realmode.c | 32 ++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/x86/realmode.c b/x86/realmode.c
> index 3518224..234d607 100644
> --- a/x86/realmode.c
> +++ b/x86/realmode.c
> @@ -649,24 +649,24 @@ static void test_push_pop(void)
> MK_INSN(push_es, "mov $0x231, %bx\n\t" //Just write a dummy value to see if it gets overwritten
> "mov $0x123, %ax\n\t"
> "mov %ax, %es\n\t"
> - "push %es\n\t"
> + "pushw %es\n\t"
> "pop %bx \n\t"
> );
> MK_INSN(pop_es, "push %ax\n\t"
> - "pop %es\n\t"
> + "popw %es\n\t"
> "mov %es, %bx\n\t"
> );
> - MK_INSN(push_pop_ss, "push %ss\n\t"
> + MK_INSN(push_pop_ss, "pushw %ss\n\t"
> "pushw %ax\n\t"
> "popw %ss\n\t"
> "mov %ss, %bx\n\t"
> - "pop %ss\n\t"
> + "popw %ss\n\t"
> );
> - MK_INSN(push_pop_fs, "push %fs\n\t"
> + MK_INSN(push_pop_fs, "pushl %fs\n\t"
> "pushl %eax\n\t"
> "popl %fs\n\t"
> "mov %fs, %ebx\n\t"
> - "pop %fs\n\t"
> + "popl %fs\n\t"
> );
> MK_INSN(push_pop_high_esp_bits,
> "xor $0x12340000, %esp \n\t"
> @@ -752,7 +752,7 @@ static void test_iret(void)
> "pushl %cs\n\t"
> "call 1f\n\t" /* a near call will push eip onto the stack */
> "jmp 2f\n\t"
> - "1: iret\n\t"
> + "1: iretl\n\t"
> "2:\n\t"
> );
>
> @@ -771,7 +771,7 @@ static void test_iret(void)
> "pushl %cs\n\t"
> "call 1f\n\t"
> "jmp 2f\n\t"
> - "1: iret\n\t"
> + "1: iretl\n\t"
> "2:\n\t");
>
> MK_INSN(iret_flags16, "pushfw\n\t"
> @@ -1340,10 +1340,10 @@ static void test_lds_lss(void)
> {
> init_inregs(&(struct regs){ .ebx = (unsigned long)&desc });
>
> - MK_INSN(lds, "push %ds\n\t"
> + MK_INSN(lds, "pushl %ds\n\t"
> "lds (%ebx), %eax\n\t"
> "mov %ds, %ebx\n\t"
> - "pop %ds\n\t");
> + "popl %ds\n\t");
> exec_in_big_real_mode(&insn_lds);
> report("lds", R_AX | R_BX,
> outregs.eax == (unsigned long)desc.address &&
> @@ -1356,28 +1356,28 @@ static void test_lds_lss(void)
> outregs.eax == (unsigned long)desc.address &&
> outregs.ebx == desc.sel);
>
> - MK_INSN(lfs, "push %fs\n\t"
> + MK_INSN(lfs, "pushl %fs\n\t"
> "lfs (%ebx), %eax\n\t"
> "mov %fs, %ebx\n\t"
> - "pop %fs\n\t");
> + "popl %fs\n\t");
> exec_in_big_real_mode(&insn_lfs);
> report("lfs", R_AX | R_BX,
> outregs.eax == (unsigned long)desc.address &&
> outregs.ebx == desc.sel);
>
> - MK_INSN(lgs, "push %gs\n\t"
> + MK_INSN(lgs, "pushl %gs\n\t"
> "lgs (%ebx), %eax\n\t"
> "mov %gs, %ebx\n\t"
> - "pop %gs\n\t");
> + "popl %gs\n\t");
> exec_in_big_real_mode(&insn_lgs);
> report("lgs", R_AX | R_BX,
> outregs.eax == (unsigned long)desc.address &&
> outregs.ebx == desc.sel);
>
> - MK_INSN(lss, "push %ss\n\t"
> + MK_INSN(lss, "pushl %ss\n\t"
> "lss (%ebx), %eax\n\t"
> "mov %ss, %ebx\n\t"
> - "pop %ss\n\t");
> + "popl %ss\n\t");
> exec_in_big_real_mode(&insn_lss);
> report("lss", R_AX | R_BX,
> outregs.eax == (unsigned long)desc.address &&
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-01 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 21:26 [kvm-unit-tests PATCH] x86: realmode: Add suffixes for push, pop and iret Roman Bolshakov
2020-06-01 8:47 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.