$NetBSD: patch-aa,v 1.1.1.1 2002/07/23 12:07:45 agc Exp $
--- src/iopl.c	Tue May  8 15:14:21 2001
+++ src/iopl.c	Mon Jul 22 07:46:37 2002
@@ -61,10 +61,17 @@
    */
   ret = iopl(3);
 #else
+#if defined(__NetBSD__) && defined(HAVE_LIBI386)
+  /*
+   * Have to get unrestricted access to io ports, as WRITE_DATA port > 0x3ff
+   */
+  ret = i386_iopl(3);
+#else
 #ifdef HAVE_IOPERM
   /* ALPHA only has ioperm, apparently, so cover all with one permission */
   ret = ioperm(MIN_READ_ADDR, WRITEDATA_ADDR - MIN_READ_ADDR + 1, 1);
 #endif /* HAVE_IOPERM */
+#endif /* !(__NetBSD__ && HAVE_LIBI386) */
 #endif /* !HAVE_IOPL */
 
   if (ret < 0) {
@@ -85,9 +92,13 @@
 #ifdef HAVE_IOPL
   ret = iopl(0);
 #else
+#if defined(__NetBSD__) && defined(HAVE_LIBI386)
+  ret = i386_iopl(0);
+#else
 #ifdef HAVE_IOPERM
   ret = ioperm(MIN_READ_ADDR, WRITEDATA_ADDR - MIN_READ_ADDR + 1, 0);
 #endif /* HAVE_IOPERM */
+#endif /* !(__NetBSD__ && HAVE_LIBI386) */
 #endif /* !HAVE_IOPL */
 
   if (ret < 0) {
