Definitey a bug in NestedVM. Could you post the binary ("babel") you're
trying to compile? I'll look into it.
As a work around you might try to compile via java source code:
java org.ibex.nestedvm.Compiler -outformat java -outfile Babel.java Babel babel
since the bug appears to be in the bytecode compiler. Another possible
workaround would be to turn off optimization when compiling with gcc.
This might avoid generating whatever instruction sequence is triggering
the bug.
-Brian
Thanks for the detail instructions. I was able to reproduce the
problem.
It was actually kind of interesting to track down. Simplifying things
significantly (ignoring delay slots, etc), basically the last
instruction in the entire program was the instruction to call a
function (JAL). Control returns to the instruction following the JAL
after the method returns, but since this was the last instruction,
there is nowhere to return too. If this function were to actually
return a real machine would segfault.
This is buried in some exception handling code (which I don't
understand at all). It might be perfectly safe (maybe the function
never returns) or it might be an indication of a bug in the original
program or gcc. Either way, NestedVM will now handle it at runtime the
same way a real machine would, by crashing.
This patch fixes the bug (do a darcs pull, then make):
Tue Nov 20 14:51:29 EST 2007 br...@brianweb.net
* fix boundary case where last instructin in .text does a link
> > As a work around you might try to compile via java source code:
This actually would've worked too. The java source code compiler
doesn't have the same bug. In general, you don't want to use the java
source compiler though, it is slower and is bitrotting.
-Brian