+#include <stdio.h>
+#include <sys/io.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define BASE 0xe800
+
+#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(BASE,8,1);
+ if (ret < 0) {
+ die("ioperm");
+ }
+ word = inl(BASE);
+ printf("0x%08x\n", 0x0 | word);
+
+#if 0
+ outl(0x00, BASE);
+ outl(0xFFFFFFFF, BASE);
+
+ word = inl(BASE);
+ printf("0x%08x\n", 0x0 | word);
+#endif
+
+ ret = ioperm(BASE,8,0);
+ if (ret < 0) {
+ die("ioperm");
+ }
+
+ return(EXIT_SUCCESS);
+}