gitlab.arm.com will be in the maintainance mode on Wednesday June 29th 01:00 - 10:00 (UTC+1). Repositories is read only during the maintainance.

Commit 2616ad93 authored by Roman Bolshakov's avatar Roman Bolshakov Committed by Paolo Bonzini
Browse files

x86: realmode: Workaround clang issues

clang doesn't properly support .code16gcc and generates wrong machine
code [1][2][3][4]. But the test works if object file is compiled with -m16 and
explicit suffixes are added for instructions.

1. https://lore.kernel.org/kvm/4d20fbce-d247-abf4-3ceb-da2c0d48fc50@redhat.com/
2. https://lore.kernel.org/kvm/20200915155959.GF52559@SPB-NB-133.local/
3. https://lore.kernel.org/kvm/788b7191-6987-9399-f352-2e661255157e@redhat.com/
4. https://lore.kernel.org/kvm/20200922212507.GA11460@SPB-NB-133.local/

Suggested-by: default avatarThomas Huth <thuth@redhat.com>
Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
Message-Id: <20200924120516.77299-1-r.bolshakov@yadro.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent f01561d3
......@@ -24,7 +24,7 @@ jobs:
- BUILD_DIR="."
- TESTS="access asyncpf debug emulator ept hypercall hyperv_stimer
hyperv_synic idt_test intel_iommu ioapic ioapic-split
kvmclock_test msr pcid rdpru rmap_chain s3 setjmp umip"
kvmclock_test msr pcid rdpru realmode rmap_chain s3 setjmp umip"
- ACCEL="kvm"
- addons:
......
......@@ -72,7 +72,7 @@ $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
$(CC) -m32 -nostdlib -o $@ -Wl,-m,elf_i386 \
-Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
$(TEST_DIR)/realmode.o: bits = 32
$(TEST_DIR)/realmode.o: bits = 16
$(TEST_DIR)/kvmclock_test.elf: $(TEST_DIR)/kvmclock.o
......
......@@ -639,7 +639,7 @@ static void test_jcc_near(void)
static void test_long_jmp(void)
{
MK_INSN(long_jmp, "call 1f\n\t"
MK_INSN(long_jmp, "calll 1f\n\t"
"jmp 2f\n\t"
"1: jmp $0, $test_function\n\t"
"2:\n\t");
......@@ -728,26 +728,26 @@ static void test_null(void)
static void test_pusha_popa(void)
{
MK_INSN(pusha, "pusha\n\t"
"pop %edi\n\t"
"pop %esi\n\t"
"pop %ebp\n\t"
"add $4, %esp\n\t"
"pop %ebx\n\t"
"pop %edx\n\t"
"pop %ecx\n\t"
"pop %eax\n\t"
MK_INSN(pusha, "pushal\n\t"
"popl %edi\n\t"
"popl %esi\n\t"
"popl %ebp\n\t"
"addl $4, %esp\n\t"
"popl %ebx\n\t"
"popl %edx\n\t"
"popl %ecx\n\t"
"popl %eax\n\t"
);
MK_INSN(popa, "push %eax\n\t"
"push %ecx\n\t"
"push %edx\n\t"
"push %ebx\n\t"
"push %esp\n\t"
"push %ebp\n\t"
"push %esi\n\t"
"push %edi\n\t"
"popa\n\t"
MK_INSN(popa, "pushl %eax\n\t"
"pushl %ecx\n\t"
"pushl %edx\n\t"
"pushl %ebx\n\t"
"pushl %esp\n\t"
"pushl %ebp\n\t"
"pushl %esi\n\t"
"pushl %edi\n\t"
"popal\n\t"
);
init_inregs(&(struct regs){ .eax = 0, .ebx = 1, .ecx = 2, .edx = 3, .esi = 4, .edi = 5, .ebp = 6 });
......@@ -761,9 +761,9 @@ static void test_pusha_popa(void)
static void test_iret(void)
{
MK_INSN(iret32, "pushf\n\t"
MK_INSN(iret32, "pushfl\n\t"
"pushl %cs\n\t"
"call 1f\n\t" /* a near call will push eip onto the stack */
"calll 1f\n\t" /* a near call will push eip onto the stack */
"jmp 2f\n\t"
"1: iretl\n\t"
"2:\n\t"
......@@ -782,7 +782,7 @@ static void test_iret(void)
"orl $0xffc18028, %eax\n\t"
"pushl %eax\n\t"
"pushl %cs\n\t"
"call 1f\n\t"
"calll 1f\n\t"
"jmp 2f\n\t"
"1: iretl\n\t"
"2:\n\t");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment