On 06/12/2012 09:08 AM, Richard Henderson wrote: > I think this is one of those cases where the -B or -R options > (or QEMU_GUEST_BASE and QEMU_RESERVED_VA env variables) are the best > way forward for whatever cpu you're emulating. That or a change to > the target's default ld script, not to link real executables quite so > low in the address space.
Per Richard's recommendation I experimented with -R for my use cases. It seems to mostly work, but for ARM GNU/Linux there is an issue that makes it awkward to work with. In particular, this commit [1] added validation for the guest base as a way to ensure that the kernel-provided user mode helper functions on ARM can be mapped. The validation function is invoked by 'probe_guest_base', but also in main.c:3456 whenever -R or -B is used: if (reserved_va || have_guest_base) { if (!guest_validate_base(guest_base)) { fprintf(stderr, "Guest base/Reserved VA rejected by guest code\n"); exit(1); } } Thus we might be able to allocate the reserved VA region, but it might fail the validation and exit. I had this actually happen on many test cases when testing '-R 128M' with portions of the GCC testsuite. To solve this issue I experimented with performing a similar probing in 'main' as in 'probe_guest_base' so that we can find a reserved VA region that also passes validation. If a region isn't found that can be validated, then QEMU gives up. Does this approach seem reasonable? [1] http://git.qemu.org/?p=qemu.git;a=commit;h=97cc75606aef406e90a243cdb25347039003e7f0 -- Meador Inge CodeSourcery / Mentor Embedded http://www.mentor.com/embedded-software