X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/raggedstone/blobdiff_plain/a10e578285a0d47f60c93f5dc47762446f6e1061..f80858bad8da614b4a8d0acf454895f627aaa9ec:/dhwk/userland/dump_register.c diff --git a/dhwk/userland/dump_register.c b/dhwk/userland/dump_register.c new file mode 100644 index 0000000..9200b6d --- /dev/null +++ b/dhwk/userland/dump_register.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include +#include + +#define die(x) \ +{ \ + char buf[BUFSIZ]; \ + snprintf(buf, sizeof(buf), \ + "%s: %d: %s: %s", \ + __FILE__, (int) __LINE__, __FUNCTION__, x); \ + perror(buf); \ + exit(EXIT_FAILURE); \ +} + +int +main(void) +{ + int ret; + unsigned int word; + + ret = ioperm(0xe800,8,1); + if (ret < 0) { + die("ioperm"); + } + word = inw(0xe804); + printf("0x%04x\n", 0x0 | word); + + word = inw(0xe806); + printf("0x%04x\n", 0x0 | word); + + ret = ioperm(0xe800,8,0); + if (ret < 0) { + die("ioperm"); + } + + return(EXIT_SUCCESS); +} +