summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-03-29 02:48:49 +0000
committerkato <kato@FreeBSD.org>1997-03-29 02:48:49 +0000
commitacc1b708c198fcaff62c716caea359a1cc7eb9d0 (patch)
tree88a4726cd75b9323105855325fb3c1a8170c4eef
parent9fee161999177e796c521041e661b63f08021846 (diff)
downloadFreeBSD-src-acc1b708c198fcaff62c716caea359a1cc7eb9d0.zip
FreeBSD-src-acc1b708c198fcaff62c716caea359a1cc7eb9d0.tar.gz
Synchronize with sys/i386/i386/machdep.c revision 1.233.
-rw-r--r--sys/pc98/i386/machdep.c48
-rw-r--r--sys/pc98/pc98/machdep.c48
2 files changed, 94 insertions, 2 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 02ee80d..204aa09 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.31 1997/03/24 12:29:14 bde Exp $
+ * $Id: machdep.c,v 1.32 1997/03/26 07:03:30 kato Exp $
*/
#include "npx.h"
@@ -1565,3 +1565,49 @@ bad:
bp->b_flags |= B_ERROR;
return(-1);
}
+
+#ifdef DDB
+
+/*
+ * Provide inb() and outb() as functions. They are normally only
+ * available as macros calling inlined functions, thus cannot be
+ * called inside DDB.
+ *
+ * The actual code is stolen from <machine/cpufunc.h>, and de-inlined.
+ */
+
+#undef inb
+#undef outb
+
+/* silence compiler warnings */
+u_char inb(u_int);
+void outb(u_int, u_char);
+
+u_char
+inb(u_int port)
+{
+ u_char data;
+ /*
+ * We use %%dx and not %1 here because i/o is done at %dx and not at
+ * %edx, while gcc generates inferior code (movw instead of movl)
+ * if we tell it to load (u_short) port.
+ */
+ __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
+ return (data);
+}
+
+void
+outb(u_int port, u_char data)
+{
+ u_char al;
+ /*
+ * Use an unnecessary assignment to help gcc's register allocator.
+ * This make a large difference for gcc-1.40 and a tiny difference
+ * for gcc-2.6.0. For gcc-1.40, al had to be ``asm("ax")'' for
+ * best results. gcc-2.6.0 can't handle this.
+ */
+ al = data;
+ __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
+}
+
+#endif /* DDB */
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 02ee80d..204aa09 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
- * $Id: machdep.c,v 1.31 1997/03/24 12:29:14 bde Exp $
+ * $Id: machdep.c,v 1.32 1997/03/26 07:03:30 kato Exp $
*/
#include "npx.h"
@@ -1565,3 +1565,49 @@ bad:
bp->b_flags |= B_ERROR;
return(-1);
}
+
+#ifdef DDB
+
+/*
+ * Provide inb() and outb() as functions. They are normally only
+ * available as macros calling inlined functions, thus cannot be
+ * called inside DDB.
+ *
+ * The actual code is stolen from <machine/cpufunc.h>, and de-inlined.
+ */
+
+#undef inb
+#undef outb
+
+/* silence compiler warnings */
+u_char inb(u_int);
+void outb(u_int, u_char);
+
+u_char
+inb(u_int port)
+{
+ u_char data;
+ /*
+ * We use %%dx and not %1 here because i/o is done at %dx and not at
+ * %edx, while gcc generates inferior code (movw instead of movl)
+ * if we tell it to load (u_short) port.
+ */
+ __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port));
+ return (data);
+}
+
+void
+outb(u_int port, u_char data)
+{
+ u_char al;
+ /*
+ * Use an unnecessary assignment to help gcc's register allocator.
+ * This make a large difference for gcc-1.40 and a tiny difference
+ * for gcc-2.6.0. For gcc-1.40, al had to be ``asm("ax")'' for
+ * best results. gcc-2.6.0 can't handle this.
+ */
+ al = data;
+ __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
+}
+
+#endif /* DDB */
OpenPOWER on IntegriCloud