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.
Hey, I think the issue is with the CPU core=dynamic. It uses a cache and sets PROT_WRITE|PROT_EXEC on a region. The log message is found in the files: ./src/cpu/core_dynrec/cache.h: LOG_MSG("Setting excute permission on the code cache has failed"); ./src/cpu/core_dyn_x86/cache.h: LOG_MSG("Setting excute permission on the code cache has failed!"); and the code: if(mprotect(cache_code_link_blocks,CACHE_TOTAL+CACHE_MAXSIZE+PAGESIZE_TEMP,PROT_WRITE|PROT_READ|PROT_EXEC)) Log_MSG("Setting excute permission on the code cache has failed!"); To workaround this, but without requiring WXNEEDED: Change in the dosbox config: [cpu] core=dynamic cycles=auto to: [cpu] core=normal cycles=10000 I don't have the knowledge to patch core=dynamic, but hopefully this information helps in some way. -- Kind regards, Hiltjo