[kaffe] Porting KAFFE on XScale PXA255 - Found a bug???

Dalibor Topic robilad@kaffe.org
Wed Jan 14 09:53:02 2004


Salut Gerard, Hallo Helmer,

Gérard Basler wrote:
> Hi!
> 
> I disabled the jit now. And configured as follows:
> KAFFEH=/usr/local/kaffe/bin/kaffeh CC=arm-linux-gcc NM=arm-linux-nm
> AR=arm-linux-ar ../kaffe-1.1.3/configure --host=arm-linux
> --build=i686-linux --with-rt-jar=/tmp/rt.jar --enable-pure-java-math
> --with-threads=unix-jthreads --without-x --prefix=/mnt/cf/kaffe
> --enable-debug --with-engine=intrp
> 
> Then i tried to start the helloworld program but it crashed:
> 
> ~ # kaffe helloworld
> Internal error: caught an unexpected exception.
> Please check your CLASSPATH and your installation.
> java/lang/NullPointerException
> Aborted
> 
> I've found a post concerning the same problem:
> http://www.kaffe.org/pipermail/kaffe/2003-June/042740.html
> 
> I did as told:
> /mnt/cf # ./sp_offset
> #define SP_OFFSET       20
> 
> After I've recompiled kaffe with the modified constant (in
> /config/arm/linux/md.h) I could run the helloworld program!
> 
> I doubt that 20 is the correct value (shouldn't it be smaller).
> Anyway what's the meaning of this constant?

SP_OFFSET is used to denote the stack pointer offset, AFAIK.

Looking at the GNU Libc sources, I see two different values of stack 
offsets, 8 without a FPU and 20 with a FPU. It seems as if we need to 
differentiate between arms with a FPU and arms without an FPU in order 
to have SP_OFFSET defined properly in each case.

I have seen that Mono has such detection code in their CVS, so I'm 
inclined to grab it.

Another, apparently simpler alternative might be to compile and run 
developers/sp_offset.c during configure, and use that value instead of 
putting a value in stone into md.h for a platform.

cheers,
dalibor topic