linux-user: fix segmentation fault passing with g2h(x) != x

When forwarding a segmentation fault into the guest process, we were passing
the host's address directly into the guest process's signal descriptor.

That obviously confused the guest process, since it didn't know what to make
of the (usually 32-bit truncated) address. Passing in g2h(address) makes the
guest process a lot happier.

This fixes java running in arm-linux-user for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
[AF: Rebased onto AREG0 fix for v1.2, squashed fixup by agraf]
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Alexander Graf
2012-06-25 19:02:32 +02:00
committed by Andreas Färber
parent bcef1d17e9
commit 8137fc352d

View File

@@ -98,6 +98,12 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
return 1; return 1;
} }
if (RESERVED_VA) {
/* Convert forcefully to guest address space, invalid addresses
are still valid segv ones */
address = address - GUEST_BASE;
}
/* see if it is an MMU fault */ /* see if it is an MMU fault */
ret = cpu_handle_mmu_fault(cpu_single_env, address, is_write, ret = cpu_handle_mmu_fault(cpu_single_env, address, is_write,
MMU_USER_IDX); MMU_USER_IDX);