On 2017/03/26 16:50, Giannis Tsaraias wrote:
> On Sun, Mar 26, 2017 at 11:37:21AM +1100, Jonathan Gray wrote:
> > On Sat, Mar 25, 2017 at 06:51:32PM +0100, Hiltjo Posthuma wrote:
> > > On Sat, Mar 25, 2017 at 05:43:27PM +0200, Giannis Tsaraias wrote:
> > > > On Sat, Mar 25, 2017 at 03:24:26PM +0100, Benjamin Baier wrote:
> > > > > Patch to add wxneeded to dosbox. I got a application that otherwise
> > > > > crashes with the following dosbox error message.
> > > > > 
> > > > > >Setting excute permission on the code cache has failed
> > > > > >Exit to error: DRC64:Unhandled memory reference
> > > > > 
> > > > 
> > > > I saw the W^X violation too and had to do this, but forgot to send the 
> > > > diff.
> > > > FWIW, OK tsg@ if someone wants to commit.
> > > > 
> > > 
> > > Hey,
> > > 
> > > I noticed it too while playing Mortal Kombat 1 :)
> > > 
> > > Some other games (skiordi, stunts) don't crash.
> > 
> > Instead of blindly setting USE_WXNEEDED, I'd prefer if someone who has
> > a case that triggers this can try disabling the various cpu core options
> > in configure.
> 
> As Hiltjo mentioned, there are calls to mprotect asking for both write and
> execute in ./src/cpu/core_dynrec/cache.h and ./src/cpu/core_dyn_x86/cache.h.
> 
> Compiling with '--disable-dynamic-core', I tested a few executables on i386
> and amd64 without managing to trigger a violation. Didn't notice any 
> performance
> loss either. No need for wxneeded this way.
> 
> '--disable-dynrec' is not enough, as I got a violation on i386 using it.
> 

So..

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/dosbox/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile    25 Mar 2017 15:53:56 -0000      1.32
+++ Makefile    28 Mar 2017 10:41:21 -0000
@@ -1,12 +1,11 @@
 # $OpenBSD: Makefile,v 1.32 2017/03/25 15:53:56 landry Exp $
 
 ONLY_FOR_ARCHS=        ${GCC4_ARCHS}
-USE_WXNEEDED=  Yes
 
 COMMENT=       x86 with DOS emulator targeted at playing games
 
 DISTNAME=      dosbox-0.74
-REVISION=      7
+REVISION=      8
 CATEGORIES=    games x11 emulators
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=dosbox/}
 
@@ -34,6 +33,9 @@ CONFIGURE_STYLE= gnu
 CONFIGURE_ENV=CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include"
 CONFIGURE_ENV+=LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
 CONFIGURE_ARGS+=       --disable-alsatest
+
+# needs W+X memory
+CONFIGURE_ARGS+=       --disable-dynamic-core
 
 pre-configure:
        cp ${FILESDIR}/midi_sndio.h ${WRKSRC}/src/gui

Reply via email to