Subject: Re: 32 bit linux java works
To: Christos Zoulas <christos@astron.com>
From: Arto Huusko <arto.huusko@pp2.inet.fi>
List: port-amd64
Date: 11/22/2007 22:29:34
Christos Zoulas wrote:
>>  - for some reason JVM inspects the fault address from cr2 field
>>    of mcontext of ucontext (instead of si_addr of sigcontext)
>>
>>    see JVM_handle_linux_signal in
>> 	hotspot/src/os_cpu/linux_i486/os_linux_i486.cpp
>>
>>  - NetBSD linux32 emul does not set this field
>>
>>    see linux32_save_sigcontext in
>> 	sys/compat/linux32/arch/amd64/linux32_machdep.c
>>    in revision 1.12, on line 389:
>>
>> 	/* sc->sc_cr2 = l->l_addr->u_pcb.pcb_cr2; */ /* XXX */

[snip patch]

Thanks for the patch, but you also need the patch below to make
it go; at least a simple javac job finally finished succesfully.

Without this patch, linux32 sendsig calls sendsig_reset() before
saving current signal mask, and we end up restoring to wrong mask
after the signal returns.


Index: compat/linux32/arch/amd64/linux32_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/arch/amd64/linux32_machdep.c,v
retrieving revision 1.12
diff -r1.12 linux32_machdep.c
248a249
 >       linux32_save_ucontext(l, tf, mask, sas, &frame.sf_uc);
251c252,256
<       linux32_save_ucontext(l, tf, mask, sas, &frame.sf_uc);



I'm also using linux_trapsignal for linux32 emul, no idea if it
is actually needed:

Index: compat/linux32/common/linux32_exec.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_exec.c,v
retrieving revision 1.7
diff -r1.7 linux32_exec.c
111c111
<       trapsignal,
---
 >       linux_trapsignal,