longjmp() problem. help--please?

James ketrenoj at austin.rr.com
Tue Jul 11 22:05:22 PDT 2000

I believe I have found the cause of the problem.  I am unsure how to
'correctly' fix it though.  It appears that when running within Mozilla if
the Stack Pointer is set to point to data in the heap (0x80000000 range) vs.
the stack (0xBF000000 range) then the call to longjmp() just does random
things and hangs the process.  It works GREAT in my stand along
programs--just not within Mozilla.

So, for now I have hard coded a static buffer of 16 stacks that can be
allocated in the call to jthread_create().  So long as no more than 16
threads are created, everything is great.  Good enough for me to keep
working--I'm not dead in the water anymore.

However, my current hack is a band-aide.  I have not been able to figure out
what in Mozilla is setting it up so that the stack pointer is limited.

Does anyone know the function call to make to limit/restrict the SP?  I need
to figure out where in Mozilla this is being set up so I can patch it--but I
don't know what regexp to scan the mozilla source for.  Any pointers?

ketrenoj at austin.rr.com

----- Original Message -----
From: "James" <ketrenoj at austin.rr.com>
To: "Kaffe" <kaffe at rufus.w3.org>
Sent: Tuesday, July 11, 2000 6:01 PM
Subject: longjmp() problem. help--please?

> I have been working on creating an OJI plugin for Kaffe to run within
> Mozilla.
> Progress was going reasonably well until I started trying to create any
> of Window within the JVM loaded through Mozilla via JNI.  I have tracked
> symptom down into within jthread.c in the 'reschedule()' call of the VM.
> Basically, it core dumps when it tries to switch thread contexts.
> 'addNotify' results in 'startDispatch()' being called, which kicks off a
> thread, which in turn calls 'reschedule()'.  Then bad things happen (the
> Mozilla window hangs and I am returned to the shell prompt--no core dump,
> try()/catch() combo catches the crash).
> Looking through the code, I am suspecting something is not getting set up
> correctly with the thread context uses in the 'longjmp' call, as that is
> where it blows up.  I can't get any code to execute in any of the places
> following the previous calls to 'setjmp' (which occurs twice in
> This is all on Linux.  Has anyone seen a similar problem and have a
> solution?  I'm going to keep banging on it till I figure out what's wrong,
> but if anyone has any pointers I'd appreciate it.
> Thanks,
> James
> ketrenoj at austin.rr.com

More information about the kaffe mailing list