hrydgard/ppsspp — pull request #6694 by ToadKing (2014-08-05 22:53:45+00:00)
Title: Try to allocate executable memory close to PPSSPP memory if not below 4GB

This tries to work around #1106 without having to remove RIP-relative addressing from the X64 emitter.

Both Windows and *nix follow a similar strategy: find the location of PPSSPP global variables in memory and try to find free memory areas below it. We don't search up because we could be at the upper-limit on usable memory in the process. On Windows we specifically query each memory region until we find one that is free. On *nix, we jump down 0.5GB in virtual memory and try allocating there, relying on the fact that mmap can search around if it can't use the exact address passed in. These new routines only happen if PPSSPP is in high memory (>0xFFFFFFFF) and if it's in low memory it falls back to the existing behavior for that.