Subject: java-1.4.2 status on current
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: current-users
Date: 08/09/2003 10:17:44
Hello,

I finally chased down the problem that was causing the linux/x86 emulated
java-1.4.x not to work properly. To recap, the issue was that any
java program that was throwing a NullPointerException, or other exceptions
that are causing segmentation violations in hotspot, and are handled
from the signal handler were failing. For example, this simple java program:

class HangTest {
    public int[] arrInts;
    public void hanghard() { 
        System.out.println(arrInts.length);
    }
    public static void main(String[] args)
        throws Exception
    {
        HangTest H = new HangTest();
        H.hanghard();
    }
}

did not work properly. This problem has been fixed in NetBSD current for
all versions of 1.4.x. Versions earlier than 1.4.2, hard-code the stack
address for linux processes at 0xc0000000, which is where we traditionally
load the kernel on i386. Our stack then ends up a bit lower (at 0xbfbf0000)
which confuses java. To overcome this limitation, you'll need to load
your kernel higher by specifying:

makeoptions	TEXTADDR=d0100000
options	KERNBASE_LOCORE=0xd0000000

in your kernel config file. Make sure you start with a clean build, because
the dependency mechanism will not understand that you've changed KERNBASE.

Versions 1.4.2 and presumably higher, determine the stack address
from /proc/<pid>/stat, which you get when you mount procfs with -o
linux. There was a bug with that, so make sure that you have revision
1.12 of procfs_linux.c. This means that you don't need to do anything
special with the kernel, and standard versions of the current kernel
will just work.

I believe that with those fixes, jdk-1.4.x will run as well on NetBSD as
it does on Linux.

Enjoy,

christos