qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] kvm-unittest: fix build with gcc 4.3.X and older
@ 2013-10-16 19:46 Michael S. Tsirkin
  2013-10-17  6:27 ` Gleb Natapov
  2013-10-17 10:53 ` Paolo Bonzini
  0 siblings, 2 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2013-10-16 19:46 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, qemu-devel, gleb

Old GCC didn't let you reference variable by
number if it is listed with a specific register
constraint, on the assumption you can just
use the register name explicitly.

Build fails with errors like this:
a.c:6: error: invalid 'asm': invalid operand code 'd'

To fix, let's just use %eax %al etc.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 lib/x86/pci.c | 4 ++--
 x86/s3.c      | 4 ++--
 x86/vmexit.c  | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/x86/pci.c b/lib/x86/pci.c
index f95cd88..08f7ebf 100644
--- a/lib/x86/pci.c
+++ b/lib/x86/pci.c
@@ -3,13 +3,13 @@
 
 static void outl(unsigned short port, unsigned val)
 {
-    asm volatile("outl %d0, %w1" : : "a"(val), "Nd"(port));
+    asm volatile("outl %%eax, %w1" : : "a"(val), "Nd"(port));
 }
 
 static unsigned inl(unsigned short port)
 {
     unsigned data;
-    asm volatile("inl %w1, %d0" : "=a"(data) : "Nd"(port));
+    asm volatile("inl %w1, %%eax" : "=a"(data) : "Nd"(port));
     return data;
 }
 static uint32_t pci_config_read(pcidevaddr_t dev, uint8_t reg)
diff --git a/x86/s3.c b/x86/s3.c
index 1feb452..eeffa17 100644
--- a/x86/s3.c
+++ b/x86/s3.c
@@ -149,8 +149,8 @@ static inline int rtc_in(u8 reg)
 
 static inline void rtc_out(u8 reg, u8 val)
 {
-    asm volatile("outb %b1, $0x70; mov %b2, %b1; outb %b1, $0x71"
-		 : "+a"(reg) : "0"(reg), "ri"(val));
+    asm volatile("outb %%al, $0x70; mov %b1, %%al; outb %%al, $0x71"
+		 : "+a"(reg) : "ri"(val));
 }
 
 extern char resume_start, resume_end;
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 3b945de..29bc582 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -26,7 +26,7 @@ static void outw(unsigned short port, unsigned val)
 
 static void outl(unsigned short port, unsigned val)
 {
-    asm volatile("outl %d0, %w1" : : "a"(val), "Nd"(port));
+    asm volatile("outl %%eax, %w1" : : "a"(val), "Nd"(port));
 }
 
 static unsigned int inb(unsigned short port)
-- 
MST

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-10-17 11:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 19:46 [Qemu-devel] [PATCH] kvm-unittest: fix build with gcc 4.3.X and older Michael S. Tsirkin
2013-10-17  6:27 ` Gleb Natapov
2013-10-17  8:12   ` Michael S. Tsirkin
2013-10-17  8:20     ` Gleb Natapov
2013-10-17  8:27       ` Michael S. Tsirkin
2013-10-17  8:34         ` Gleb Natapov
2013-10-17  9:28           ` Michael S. Tsirkin
2013-10-17  9:33             ` Gleb Natapov
2013-10-17  9:44               ` Michael S. Tsirkin
2013-10-17  9:43                 ` Gleb Natapov
2013-10-17 10:55   ` Paolo Bonzini
2013-10-17 10:58     ` Gleb Natapov
2013-10-17 11:02       ` Paolo Bonzini
2013-10-17 11:31         ` Michael S. Tsirkin
2013-10-17 10:53 ` Paolo Bonzini
2013-10-17 11:29   ` Michael S. Tsirkin

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).