On Sat, Nov 06, 1999 at 10:34:18AM +0100, Gary Jennejohn wrote:
> Here's a patch to bus.h which works for both EGCS and GCC 2.95.2. I have

Here is the patch I've been working on (before I 1st got BDE's reply).
The changes are mostly from OpenBSD + style changes for the way we do
things.  Can you also test this one?


Index: bus.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/include/bus.h,v
retrieving revision 1.6
diff -u -r1.6 bus.h
--- bus.h       1999/08/28 00:44:07     1.6
+++ bus.h       1999/11/06 21:42:15
@@ -252,15 +252,14 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      movb (%1),%%al                          \n\
+               1:      movb (%2),%%al                          \n\
                        stosb                                   \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory");
        }
 #endif
 }
@@ -280,15 +279,14 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      movw (%1),%%ax                          \n\
+               1:      movw (%2),%%ax                          \n\
                        stosw                                   \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory");
        }
 #endif
 }
@@ -308,15 +306,14 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      movl (%1),%%eax                         \n\
+               1:      movl (%2),%%eax                         \n\
                        stosl                                   \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory");
        }
 #endif
 }
@@ -355,16 +352,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      inb %w1,%%al                            \n\
+               1:      inb %w2,%%al                            \n\
                        stosb                                   \n\
-                       incl %1                                 \n\
+                       incl %2                                 \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edx", "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -372,13 +369,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsb"                                  :
-                                                               :
-                   "S" (bsh + offset), "D" (addr), "c" (count) :
-                   "%esi", "%edi", "%ecx", "memory");
+                   "=S" (_port_), "=D" (addr), "=c" (count)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "memory", "cc");
        }
 #endif
 }
@@ -392,16 +390,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      inw %w1,%%ax                            \n\
+               1:      inw %w2,%%ax                            \n\
                        stosw                                   \n\
-                       addl $2,%1                              \n\
+                       addl $2,%2                              \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edx", "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -409,13 +407,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsw"                                  :
-                                                               :
-                   "S" (bsh + offset), "D" (addr), "c" (count) :
-                   "%esi", "%edi", "%ecx", "memory");
+                   "=S" (_port_), "=D" (addr), "=c" (count)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "memory", "cc");
        }
 #endif
 }
@@ -429,16 +428,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
-               1:      inl %w1,%%eax                           \n\
+               1:      inl %w2,%%eax                           \n\
                        stosl                                   \n\
-                       addl $4,%1                              \n\
+                       addl $4,%2                              \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "D" (addr), "c" (count) :
-                   "%edx", "%edi", "%ecx", "memory");
+                   "=D" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -446,13 +445,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsl"                                  :
-                                                               :
-                   "S" (bsh + offset), "D" (addr), "c" (count) :
-                   "%esi", "%edi", "%ecx", "memory");
+                   "=S" (_port_), "=D" (addr), "=c" (count)    :
+                   "0" (addr), "1" (count), "2" (bsh + offset) :
+                   "memory", "cc");
        }
 #endif
 }
@@ -573,15 +573,14 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsb                                   \n\
-                       movb %%al,(%1)                          \n\
+                       movb %%al,(%2)                          \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "S" (addr), "c" (count) :
-                   "%esi", "%ecx");
+                   "=S" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 }
@@ -601,15 +600,15 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsw                                   \n\
                        movw %%ax,(%1)                          \n\
+                       movw %%ax,(%2)                          \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "S" (addr), "c" (count) :
-                   "%esi", "%ecx");
+                   "=S" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 }
@@ -629,15 +628,14 @@
        else
 #endif
        {
-               int __x __asm__("%eax");
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsl                                   \n\
-                       movl %%eax,(%1)                         \n\
+                       movl %%eax,(%2)                         \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "r" (bsh + offset), "S" (addr), "c" (count) :
-                   "%esi", "%ecx");
+                   "=S" (addr), "=c" (count)                   :
+                   "r" (bsh + offset), "0" (addr), "1" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 }
@@ -677,16 +675,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsb                                   \n\
                        outb %%al,%w1                           \n\
                        incl %1                                 \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edx", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -694,13 +692,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsb"                                  :
-                                                               :
-                   "D" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edi", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=D" (_port_), "=c" (count)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "memory", "cc");
        }
 #endif
 }
@@ -714,16 +713,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsw                                   \n\
                        outw %%ax,%w1                           \n\
                        addl $2,%1                              \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edx", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -731,13 +730,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsw"                                  :
-                                                               :
-                   "D" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edi", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=D" (_port_), "=c" (count)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "memory", "cc");
        }
 #endif
 }
@@ -751,16 +751,16 @@
        if (tag == I386_BUS_SPACE_IO)
 #endif
        {
-               int __x __asm__("%eax");
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                1:      lodsl                                   \n\
                        outl %%eax,%w1                          \n\
                        addl $4,%1                              \n\
                        loop 1b"                                :
-                   "=&a" (__x)                                 :
-                   "d" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edx", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=c" (count), "=d" (_port_)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "%eax", "memory", "cc");
        }
 #endif
 #if defined(_I386_BUS_MEMIO_H_)
@@ -768,13 +768,14 @@
        else
 #endif
        {
+               int _port_ = bsh + offset;                      \
                __asm __volatile("                              \n\
                        cld                                     \n\
                        repne                                   \n\
                        movsl"                                  :
-                                                               :
-                   "D" (bsh + offset), "S" (addr), "c" (count) :
-                   "%edi", "%esi", "%ecx", "memory");
+                   "=S" (addr), "=D" (_port_), "=c" (count)    :
+                   "0" (bsh + offset), "1" (addr), "2" (count) :
+                   "memory", "cc");
        }
 #endif
 }


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to