[kvm-unit-tests PATCH] x86: realmode: Add suffixes for push, pop and iret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
---
 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




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux