Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 1998 23:22:20 GMT
From:      searle@longacre.demon.co.uk (Michael Searle)
To:        freebsd-questions@FreeBSD.ORG
Subject:   use of /dev/io
Message-ID:  <m2C127B69@longacre.demon.co.uk>

next in thread | raw e-mail | index | archive | help
I'm having problems doing direct IO with /dev/io - AFAIK, you just open this
device to change the memory permissions to allow access to IO addresses.
But I just get a segv, although the open succeeds. (I think the IO addresses
may have been remapped, as this port address is from DOS and man mem says
this has been done for the ISA space.) This is my code:

#include <stdio.h>
#include <fcntl.h>

void setperm(void) {
  if (open("/dev/io", O_RDONLY, 0) == -1) {
    fprintf(stderr,"Unable to open /dev/io\n");
    exit(2);
  }
  return;
}

void vsync(void) {
  register unsigned short *vi = (unsigned short *)0x3da;
  do { } while (((*vi) & 0x08) != 0);
  do { } while (((*vi) & 0x08) == 0);
  return;
}

int main(int argc, char **argv) {
setperm();
vsync();
exit(0);
}

The segv is at the first time vi is read through.


-- 
Michael Searle - csubl@csv.warwick.ac.uk

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m2C127B69>