summaryrefslogtreecommitdiff
path: root/sys/arch/i386/include
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-03-09 15:39:09 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-03-09 15:39:09 +0000
commit2cd23df6e9b9636a3df73adf1d67a3b106670069 (patch)
tree8ca6792696bafabcf09f810446ea450791058f53 /sys/arch/i386/include
parentc17820c2d223c38e9b24af57e8e93304133580c5 (diff)
add more 'cc' usage, actually overestimating gcc's smartness; also fix currently unused bus macros. kids tested mother approved
Diffstat (limited to 'sys/arch/i386/include')
-rw-r--r--sys/arch/i386/include/bus.h115
-rw-r--r--sys/arch/i386/include/pio.h17
2 files changed, 72 insertions, 60 deletions
diff --git a/sys/arch/i386/include/bus.h b/sys/arch/i386/include/bus.h
index 3a2b312b9d3..73d65be45d7 100644
--- a/sys/arch/i386/include/bus.h
+++ b/sys/arch/i386/include/bus.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus.h,v 1.14 1999/01/31 14:56:01 espie Exp $ */
+/* $OpenBSD: bus.h,v 1.15 1999/03/09 15:39:07 mickey Exp $ */
/* $NetBSD: bus.h,v 1.6 1996/11/10 03:19:25 thorpej Exp $ */
/*-
@@ -151,7 +151,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
loop 1b" : \
"=D" (_addr), "=c" (_cnt) : \
"r" ((h) + (o)), "0" (_addr), "1" (_cnt) : \
- "%eax", "memory"); \
+ "%eax", "memory", "cc"); \
} \
} while (0)
@@ -166,7 +166,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
loop 1b" : \
"=D" (_addr), "=c" (_cnt) : \
"r" ((h) + (o)), "0" (_addr), "1" (_cnt) : \
- "%eax", "memory"); \
+ "%eax", "memory", "cc"); \
} \
} while (0)
@@ -181,7 +181,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
loop 1b" : \
"=D" (_addr), "=c" (_cnt) : \
"r" ((h) + (o)), "0" (_addr), "1" (_cnt) : \
- "%eax", "memory"); \
+ "%eax", "memory", "cc"); \
} \
} while (0)
@@ -544,62 +544,65 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
*/
#define bus_space_set_multi_1(t, h, o, v, c) do { \
+ int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
cld ; \
- 1: outb %%al,%w0 ; \
+ 1: outb %%al,%w1 ; \
loop 1b" : \
- : \
- "d" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edx", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "d" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
- 1: movb %%al,(%0) ; \
+ 1: movb %%al,(%1) ; \
loop 1b" : \
- : \
- "D" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edi", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "D" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} \
} while (0)
#define bus_space_set_multi_2(t, h, o, v, c) do { \
+ int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
cld ; \
- 1: outw %%ax,%w0 ; \
+ 1: outw %%ax,%w1 ; \
loop 1b" : \
- : \
- "d" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edx", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "d" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
- 1: movw %%ax,(%0) ; \
+ 1: movw %%ax,(%1) ; \
loop 1b" : \
- : \
- "D" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edi", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "D" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} \
} while (0)
#define bus_space_set_multi_4(t, h, o, v, c) do { \
+ int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
cld ; \
- 1: outl %%eax,%w0 ; \
+ 1: outl %%eax,%w1 ; \
loop 1b" : \
- : \
- "d" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edx", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "d" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
- 1: movl %%eax,(%0) ; \
+ 1: movl %%eax,(%1) ; \
loop 1b" : \
- : \
- "D" ((h) + (o)), "c" ((c)), "a" ((v)) : \
- "%edi", "%ecx", "%eax"); \
+ "=c" (_cnt) : \
+ "D" ((h) + (o)), "0" ((_cnt)), "a" ((v)) : \
+ "%eax", "cc"); \
} \
} while (0)
@@ -625,7 +628,8 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
incl %0 ; \
loop 1b" : \
"=d" (_port), "=c" (_cnt) : \
- "0" (_port), "1" (_cnt), "a" ((v))); \
+ "0" (_port), "1" (_cnt), "a" ((v)) : \
+ "cc"); \
} else { \
__asm __volatile(" \
cld ; \
@@ -633,7 +637,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
stosb" : \
"=D" (_port), "=c" (_cnt) : \
"0" (_port), "1" (_cnt), "a" ((v)) : \
- "memory"); \
+ "memory", "cc"); \
} \
} while (0)
@@ -645,7 +649,8 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
addl $2, %0 ; \
loop 1b" : \
"=d" (_port), "=c" (_cnt) : \
- "0" (_port), "1" (_cnt), "a" ((v))); \
+ "0" (_port), "1" (_cnt), "a" ((v)) : \
+ "cc"); \
} else { \
__asm __volatile(" \
cld ; \
@@ -653,7 +658,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
stosw" : \
"=D" (_port), "=c" (_cnt) : \
"0" (_port), "1" (_cnt), "a" ((v)) : \
- "memory"); \
+ "memory", "cc"); \
} \
} while (0)
@@ -665,7 +670,8 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
addl $4, %0 ; \
loop 1b" : \
"=d" (_port), "=c" (_cnt) : \
- "0" (_port), "1" (_cnt), "a" ((v))); \
+ "0" (_port), "1" (_cnt), "a" ((v)) : \
+ "cc"); \
} else { \
__asm __volatile(" \
cld ; \
@@ -673,7 +679,7 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
stosl" : \
"=D" (_port), "=c" (_cnt) : \
"0" (_port), "1" (_cnt), "a" ((v)) : \
- "memory"); \
+ "memory", "cc"); \
} \
} while (0)
@@ -693,30 +699,32 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
*/
#define bus_space_copy_1(t, h1, o1, h2, o2, c) do { \
+ int _port1 = (h1)+(o1); int _port2 = (h2)+(o2); int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
1: movl %w1,%%dx ; \
inb %%dx,%%al ; \
movl %w0,%%dx ; \
- outl %%al,%%dx ; \
+ outb %%al,%%dx ; \
incl %0 ; \
incl %1 ; \
loop 1b" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "%edx", "%eax", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "%edx", "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
repne ; \
movsb" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "memory", "cc"); \
} \
} while (0)
#define bus_space_copy_2(t, h1, o1, h2, o2, c) do { \
+ int _port1 = (h1)+(o1); int _port2 = (h2)+(o2); int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
1: movl %w1,%%dx ; \
@@ -726,21 +734,22 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
addl $2, %0 ; \
addl $2, %1 ; \
loop 1b" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "%edx", "%eax", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "%edx", "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
repne ; \
movsw" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "memory", "cc"); \
} \
} while (0)
#define bus_space_copy_4(t, h1, o1, h2, o2, c) do { \
+ int _port1 = (h1)+(o1); int _port2 = (h2)+(o2); int _cnt=(c); \
if ((t) == I386_BUS_SPACE_IO) { \
__asm __volatile(" \
1: movl %w1,%%dx ; \
@@ -750,17 +759,17 @@ void bus_space_free __P((bus_space_tag_t t, bus_space_handle_t bsh,
addl $4, %0 ; \
addl $4, %1 ; \
loop 1b" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "%edx", "%eax", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "%edx", "%eax", "cc"); \
} else { \
__asm __volatile(" \
cld ; \
repne ; \
movsl" : \
- : \
- "D" ((h2)+(o2)), "S" ((h1)+(o1)), "c" ((c)) : \
- "%edi", "%esi", "%ecx", "memory"); \
+ "=D" (_port2), "=S" (_port1), "=c" ((c)) : \
+ "0" (_port2), "1" (_port1), "2" ((c)) : \
+ "memory", "cc"); \
} \
} while (0)
diff --git a/sys/arch/i386/include/pio.h b/sys/arch/i386/include/pio.h
index eaabb04b296..d87fb84ea8e 100644
--- a/sys/arch/i386/include/pio.h
+++ b/sys/arch/i386/include/pio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pio.h,v 1.6 1999/01/31 14:56:01 espie Exp $ */
+/* $OpenBSD: pio.h,v 1.7 1999/03/09 15:39:08 mickey Exp $ */
/* $NetBSD: pio.h,v 1.13 1996/03/08 20:15:23 cgd Exp $ */
/*
@@ -79,7 +79,7 @@ insb(int port, void *addr, int cnt)
__asm __volatile("cld\n\trepne\n\tinsb" :
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
- "memory");
+ "memory", "cc");
}
#define inw(port) \
@@ -107,7 +107,7 @@ insw(int port, void *addr, int cnt)
__asm __volatile("cld\n\trepne\n\tinsw" :
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
- "memory");
+ "memory", "cc");
}
#define inl(port) \
@@ -135,7 +135,7 @@ insl(int port, void *addr, int cnt)
__asm __volatile("cld\n\trepne\n\tinsl" :
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
- "memory");
+ "memory", "cc");
}
#define outb(port, data) \
@@ -158,7 +158,8 @@ outsb(int port, const void *addr, int cnt)
{
__asm __volatile("cld\n\trepne\n\toutsb" :
"=S" (addr), "=c" (cnt) :
- "d" (port), "0" (addr), "1" (cnt));
+ "d" (port), "0" (addr), "1" (cnt) :
+ "cc");
}
#define outw(port, data) \
@@ -181,7 +182,8 @@ outsw(int port, const void *addr, int cnt)
{
__asm __volatile("cld\n\trepne\n\toutsw" :
"=S" (addr), "=c" (cnt) :
- "d" (port), "0" (addr), "1" (cnt));
+ "d" (port), "0" (addr), "1" (cnt) :
+ "cc");
}
#define outl(port, data) \
@@ -204,7 +206,8 @@ outsl(int port, const void *addr, int cnt)
{
__asm __volatile("cld\n\trepne\n\toutsl" :
"=S" (addr), "=c" (cnt) :
- "d" (port), "0" (addr), "1" (cnt));
+ "d" (port), "0" (addr), "1" (cnt) :
+ "cc");
}
#endif /* _I386_PIO_H_ */