$NetBSD: patch-ay,v 1.2 2003/07/31 15:12:40 bencollver Exp $

--- src/laguna.c.orig	Wed Oct 11 09:35:46 2000
+++ src/laguna.c
@@ -445,9 +445,20 @@ static int laguna_test(void)
 {
     int found;
     unsigned long buf[64];
+    int _ioperm=0;
     
+    if (getenv("IOPERM") == NULL) {
+	_ioperm=1;
+        if (iopl(3) < 0) {
+          printf("svgalib: cannot get I/O permissions\n");
+          exit(1);
+        }
+    }
+
     found=__svgalib_pci_find_vendor_vga(VENDOR_ID,buf,0);
     
+    if (_ioperm) iopl(0);
+
     if(!found&&
         ((((buf[0]>>16)&0xffff)==0x00d0)||
          (((buf[0]>>16)&0xffff)==0x00d4)||
