kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Bolshakov <r.bolshakov@yadro.com>
To: <kvm@vger.kernel.org>
Cc: Thomas Huth <thuth@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>,
	Cameron Esfahani <dirty@apple.com>
Subject: [kvm-unit-tests PATCH v2 02/10] x86: Replace instruction prefixes with spaces
Date: Tue, 1 Sep 2020 11:50:48 +0300	[thread overview]
Message-ID: <20200901085056.33391-3-r.bolshakov@yadro.com> (raw)
In-Reply-To: <20200901085056.33391-1-r.bolshakov@yadro.com>

There are three kinds of x86 prefix delimiters in GNU binutils:
'/', '\\' and a space.

The first works on Linux and few other platforms.  The second one is
SVR-4 compatible and works on the generic elf target. The last kind is
universal and works everywhere, it's also used in the GAS manual [1].
Space delimiters fix the build errors on x86_64-elf binutils:

  x86/cstart64.S:217: Error: invalid character '/' in mnemonic
  x86/cstart64.S:313: Error: invalid character '/' in mnemonic

1. https://sourceware.org/binutils/docs/as/i386_002dPrefixes.html

Cc: Cameron Esfahani <dirty@apple.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 x86/cstart.S   |  4 ++--
 x86/cstart64.S |  4 ++--
 x86/emulator.c | 38 +++++++++++++++++++-------------------
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/x86/cstart.S b/x86/cstart.S
index c0efc5f..489c561 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -149,7 +149,7 @@ save_id:
 ap_start32:
 	setup_segments
 	mov $-4096, %esp
-	lock/xaddl %esp, smp_stacktop
+	lock xaddl %esp, smp_stacktop
 	setup_percpu_area
 	call prepare_32
 	call reset_apic
@@ -206,7 +206,7 @@ ap_init:
 	lea sipi_entry, %esi
 	xor %edi, %edi
 	mov $(sipi_end - sipi_entry), %ecx
-	rep/movsb
+	rep movsb
 	mov $APIC_DEFAULT_PHYS_BASE, %eax
 	movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_INIT | APIC_INT_ASSERT), APIC_ICR(%eax)
 	movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_STARTUP), APIC_ICR(%eax)
diff --git a/x86/cstart64.S b/x86/cstart64.S
index 2d16688..25a296c 100644
--- a/x86/cstart64.S
+++ b/x86/cstart64.S
@@ -226,7 +226,7 @@ sipi_end:
 ap_start32:
 	setup_segments
 	mov $-4096, %esp
-	lock/xaddl %esp, smp_stacktop
+	lock xaddl %esp, smp_stacktop
 	setup_percpu_area
 	call prepare_64
 	ljmpl $8, $ap_start64
@@ -323,7 +323,7 @@ ap_init:
 	lea sipi_entry, %rsi
 	xor %rdi, %rdi
 	mov $(sipi_end - sipi_entry), %rcx
-	rep/movsb
+	rep movsb
 	mov $APIC_DEFAULT_PHYS_BASE, %eax
 	movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_INIT | APIC_INT_ASSERT), APIC_ICR(%rax)
 	movl $(APIC_DEST_ALLBUT | APIC_DEST_PHYSICAL | APIC_DM_STARTUP), APIC_ICR(%rax)
diff --git a/x86/emulator.c b/x86/emulator.c
index 98743d1..e46d97e 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -61,71 +61,71 @@ static void test_cmps_one(unsigned char *m1, unsigned char *m3)
 
 	rsi = m1; rdi = m3; rcx = 30;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsb"
+		     "repe cmpsb"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 0 && rsi == m1 + 30 && rdi == m3 + 30, "repe/cmpsb (1)");
 
 	rsi = m1; rdi = m3; rcx = 30;
 	asm volatile("or $1, %[tmp]\n\t" // clear ZF
-		     "repe/cmpsb"
+		     "repe cmpsb"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 0 && rsi == m1 + 30 && rdi == m3 + 30,
-	       "repe/cmpsb (1.zf)");
+	       "repe cmpsb (1.zf)");
 
 	rsi = m1; rdi = m3; rcx = 15;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsw"
+		     "repe cmpsw"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
-	report(rcx == 0 && rsi == m1 + 30 && rdi == m3 + 30, "repe/cmpsw (1)");
+	report(rcx == 0 && rsi == m1 + 30 && rdi == m3 + 30, "repe cmpsw (1)");
 
 	rsi = m1; rdi = m3; rcx = 7;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsl"
+		     "repe cmpsl"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
-	report(rcx == 0 && rsi == m1 + 28 && rdi == m3 + 28, "repe/cmpll (1)");
+	report(rcx == 0 && rsi == m1 + 28 && rdi == m3 + 28, "repe cmpll (1)");
 
 	rsi = m1; rdi = m3; rcx = 4;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsq"
+		     "repe cmpsq"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
-	report(rcx == 0 && rsi == m1 + 32 && rdi == m3 + 32, "repe/cmpsq (1)");
+	report(rcx == 0 && rsi == m1 + 32 && rdi == m3 + 32, "repe cmpsq (1)");
 
 	rsi = m1; rdi = m3; rcx = 130;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsb"
+		     "repe cmpsb"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 29 && rsi == m1 + 101 && rdi == m3 + 101,
-	       "repe/cmpsb (2)");
+	       "repe cmpsb (2)");
 
 	rsi = m1; rdi = m3; rcx = 65;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsw"
+		     "repe cmpsw"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 14 && rsi == m1 + 102 && rdi == m3 + 102,
-	       "repe/cmpsw (2)");
+	       "repe cmpsw (2)");
 
 	rsi = m1; rdi = m3; rcx = 32;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsl"
+		     "repe cmpsl"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 6 && rsi == m1 + 104 && rdi == m3 + 104,
-	       "repe/cmpll (2)");
+	       "repe cmpll (2)");
 
 	rsi = m1; rdi = m3; rcx = 16;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
-		     "repe/cmpsq"
+		     "repe cmpsq"
 		     : "+S"(rsi), "+D"(rdi), "+c"(rcx), [tmp]"=&r"(tmp)
 		     : : "cc");
 	report(rcx == 3 && rsi == m1 + 104 && rdi == m3 + 104,
-	       "repe/cmpsq (2)");
+	       "repe cmpsq (2)");
 
 }
 
@@ -304,8 +304,8 @@ static void test_ljmp(void *mem)
     volatile int res = 1;
 
     *(unsigned long**)m = &&jmpf;
-    asm volatile ("data16/mov %%cs, %0":"=m"(*(m + sizeof(unsigned long))));
-    asm volatile ("rex64/ljmp *%0"::"m"(*m));
+    asm volatile ("data16 mov %%cs, %0":"=m"(*(m + sizeof(unsigned long))));
+    asm volatile ("rex64 ljmp *%0"::"m"(*m));
     res = 0;
 jmpf:
     report(res, "ljmp");
-- 
2.28.0


  parent reply	other threads:[~2020-09-01  8:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01  8:50 [kvm-unit-tests PATCH v2 00/10] Add support for generic ELF cross-compiler Roman Bolshakov
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 01/10] x86: Makefile: Allow division on x86_64-elf binutils Roman Bolshakov
2020-09-03 15:19   ` Thomas Huth
2020-09-01  8:50 ` Roman Bolshakov [this message]
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 03/10] x86: Makefile: Fix linkage of realmode " Roman Bolshakov
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 04/10] lib: Bundle debugreg.h from the kernel Roman Bolshakov
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 05/10] lib: x86: Use portable format macros for uint32_t Roman Bolshakov
2020-09-04 13:47   ` Thomas Huth
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 06/10] configure: Add an option to specify getopt Roman Bolshakov
2020-09-04 13:50   ` Thomas Huth
2020-09-22 13:53   ` Paolo Bonzini
2020-09-22 21:51     ` Roman Bolshakov
2020-09-23  2:41       ` Paolo Bonzini
2020-09-23  5:14         ` Thomas Huth
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 07/10] README: Update build instructions for macOS Roman Bolshakov
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 08/10] travis.yml: Add CI " Roman Bolshakov
2020-09-04 13:53   ` Thomas Huth
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 09/10] travis.yml: Change matrix keyword to jobs Roman Bolshakov
2020-09-04 14:20   ` Thomas Huth
2020-09-01  8:50 ` [kvm-unit-tests PATCH v2 10/10] travis.yml: Add x86 build with clang 10 Roman Bolshakov
2020-09-04 14:31   ` Thomas Huth
2020-09-14 14:45     ` Roman Bolshakov
2020-09-14 16:37       ` Thomas Huth
2020-09-15 15:59         ` Roman Bolshakov
2020-09-22 14:51           ` Paolo Bonzini
2020-09-22 21:25             ` Roman Bolshakov
2020-09-23  2:37               ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200901085056.33391-3-r.bolshakov@yadro.com \
    --to=r.bolshakov@yadro.com \
    --cc=dirty@apple.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).