Broken by PIE on i386, register clobbered by asm. We could disable PIE,
but there is alternative asm for MacOSX which avoids using this register
too, so the diff below switches to using this.

dosbox now builds again on i386 and works in very light testing but that
involves X forwarding over WAN links so I can't do any kind of detailed
test.. Can anyone test further? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/dosbox/Makefile,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile
--- Makefile    4 Jun 2013 18:41:41 -0000       1.27
+++ Makefile    8 Jan 2014 14:35:06 -0000
@@ -6,7 +6,7 @@ COMMENT=        x86 with DOS emulator targeted 
 BROKEN-hppa =  mpu401.cpp:42: error: expected identifier before numeric 
constant
 
 DISTNAME=      dosbox-0.74
-REVISION=      3
+REVISION=      4
 CATEGORIES=    games x11 emulators
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=dosbox/}
 
Index: patches/patch-src_cpu_core_dyn_x86_risc_x86_h
===================================================================
RCS file: patches/patch-src_cpu_core_dyn_x86_risc_x86_h
diff -N patches/patch-src_cpu_core_dyn_x86_risc_x86_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_cpu_core_dyn_x86_risc_x86_h       8 Jan 2014 14:35:06 
-0000
@@ -0,0 +1,75 @@
+$OpenBSD$
+--- src/cpu/core_dyn_x86/risc_x86.h.orig       Mon May 10 11:43:54 2010
++++ src/cpu/core_dyn_x86/risc_x86.h    Wed Jan  8 07:34:42 2014
+@@ -112,7 +112,7 @@ return_address:
+               pop             ebx
+               mov             [retval],eax
+       }
+-#elif defined (MACOSX)
++#elif defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+       register Bit32u tempflags=reg_flags & FMASK_TEST;
+       __asm__ volatile (
+               "pushl %%ebx                                            \n"
+@@ -752,7 +752,7 @@ static void gen_call_function(void * func,char const* 
+       if (ops) {
+               va_list params;
+               va_start(params,ops);
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+               Bitu stack_used=0;
+               bool free_flags=false;
+ #endif
+@@ -761,7 +761,7 @@ static void gen_call_function(void * func,char const* 
+                       if (*ops=='%') {
+                               pinfo[pindex].line=ops+1;
+                               pinfo[pindex].value=va_arg(params,Bitu);
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+                               const char * scan=pinfo[pindex].line;
+                               if ((*scan=='I') || (*scan=='D')) stack_used+=4;
+                               else if (*scan=='F') free_flags=true;
+@@ -771,7 +771,7 @@ static void gen_call_function(void * func,char const* 
+                       ops++;
+               }
+ 
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+               /* align stack */
+               stack_used+=4;                  // saving esp on stack as well
+ 
+@@ -846,7 +846,7 @@ static void gen_call_function(void * func,char const* 
+                               IllegalOption("gen_call_function unknown 
param");
+                       }
+               }
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+               if (free_flags) release_flags=false;
+       } else {
+               /* align stack */
+@@ -903,7 +903,7 @@ static void gen_call_function(void * func,char const* 
+       /* Restore EAX registers to be used again */
+       x86gen.regs[X86_REG_EAX]->notusable=false;
+ 
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+       /* restore stack */
+       cache_addb(0x5c);       // pop esp
+ #endif
+@@ -915,7 +915,7 @@ static void gen_call_write(DynReg * dr,Bit32u val,Bitu
+       x86gen.regs[X86_REG_EAX]->notusable=true;
+       gen_protectflags();
+ 
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+       /* align stack */
+       Bitu stack_used=12;
+ 
+@@ -952,7 +952,7 @@ static void gen_call_write(DynReg * dr,Bit32u val,Bitu
+       x86gen.regs[X86_REG_EAX]->notusable=false;
+       gen_releasereg(dr);
+ 
+-#if defined (MACOSX)
++#if defined (MACOSX) || (defined (__OpenBSD__) && defined(__i386__))
+       /* restore stack */
+       cache_addb(0x5c);       // pop esp
+ #endif

Reply via email to