summaryrefslogtreecommitdiff
path: root/src/sp12.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp12.c')
-rw-r--r--src/sp12.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/sp12.c b/src/sp12.c
index ef4fd97..c415394 100644
--- a/src/sp12.c
+++ b/src/sp12.c
@@ -803,6 +803,9 @@ int main(int argc, char *argv[])
char *dataPtr; /* for separating address:data */
int exitFlag = 0;
char binary[9] = "76543210"; /* Stores conversion num to binary */
+#if defined(__OpenBSD__)
+ u_long iomap[32];
+#endif
device.initPerformed = 0;
flashPath[0] = '\0';
@@ -821,8 +824,23 @@ int main(int argc, char *argv[])
if (ioperm(0x378,3,1)) {perror("ioperm error at 0x378");exit(1);}
if (ioperm(0x3BC,3,1)) {perror("ioperm error at 0x3BC");exit(1);}
#elif defined(__OpenBSD__)
- if (i386_iopl(1) == -1) {
- perror("i386_iopl error");
+#define enable(a, i) do { \
+ ((a)[((i) + 0) >> 5] &= ~(1 << (((i) + 0) & 0x1F))); \
+ ((a)[((i) + 1) >> 5] &= ~(1 << (((i) + 1) & 0x1F))); \
+ ((a)[((i) + 2) >> 5] &= ~(1 << (((i) + 2) & 0x1F))); \
+} while (0)
+
+ if (i386_get_ioperm(iomap) != 0) {
+ perror("i386_get_ioperm error");
+ exit(1);
+ }
+
+ enable(iomap, 0x278);
+ enable(iomap, 0x378);
+ enable(iomap, 0x3BC);
+
+ if (i386_set_ioperm(iomap) != 0) {
+ perror("i386_set_ioperm error");
exit(1);
}
#endif