[quake3] Mac OS X Universal Binary (2nd try)

Ludwig Nussel ludwig.nussel at suse.de
Thu Jun 8 11:32:38 EDT 2006


On Thursday 08 June 2006 17:00, Tony J. White wrote:
> 4 is "illegal instruction" which I assumed was from trying to execute the
> vm code that had been been placed into memory which was reserved with
> malloc() (see vm_x86.c).  

I'd expect SIGILL if the code generator produces garbage. On Linux you'd get a
segfault if you try to execute memory that is not supposed to be executed.

> 10 is "bad memory access".  In the latest build it comes from trying to use
> the same mmap() mprotect() calls that the linux version uses to get around
> NX.

The purpose of mmap is to actually support NX rather than to get around it. The
writeable flag must be removed when the memory is marked executable. Changing
protection flags affects the whole page so you cannot use memory returned by
malloc().

> Specifically it crashes when we Com_Memcpy() the vm code into the memory
> reserved with:
> 
>   mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
> 
> I'm not sure why this is yet, or even if I'm on the write track with the
> reason for catching signal 4.

VM_X86_MMAP is only defined if __linux__ is. Did you change that?

cu
Ludwig

-- 
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/




More information about the quake3 mailing list