summaryrefslogtreecommitdiff
path: root/dev-libs/libx86/files/libx86-1.1-x86emu.patch
blob: 685c7a9ff6de015aee8ce6ca09a38a3e65673075 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@
 ifeq ($(BACKEND),x86emu)
 	OBJECTS += thunk.o x86emu/decode.o x86emu/debug.o x86emu/fpu.o \
 	x86emu/ops.o x86emu/ops2.o x86emu/prim_ops.o x86emu/sys.o
+	CFLAGS += -DX86EMU
 else
 	OBJECTS += lrmi.o
 endif
--- a/thunk.c
+++ b/thunk.c
@@ -32,6 +32,7 @@
 #define TRUE 1
 #define FALSE 0
 
+#ifndef X86EMU
 #define __BUILDIO(bwl,bw,type) \
 static inline void out##bwl##_local(unsigned long port, unsigned type value) {        __asm__ __volatile__("out" #bwl " %" #bw "0, %w1" : : "a"(value), "Nd"(port)); \
 }\
@@ -44,6 +45,15 @@
 __BUILDIO(b,b,char)
 __BUILDIO(w,w,short)
 __BUILDIO(l,,int)
+#else
+/* use libc functions */
+#define inb_local inb
+#define inw_local inw
+#define inl_local inl
+#define outb_local outb
+#define outw_local outw
+#define outl_local outl
+#endif /* X86EMU */
 
 
 char *mmap_addr = SHMERRORPTR;