[maemo-developers] Java acceleration/Jazelle

From: Simon Pickering S.G.Pickering at bath.ac.uk
Date: Sun Jul 1 01:36:23 EEST 2007
Hi all,

Firstly my apologies for starting a new thread, I'm on webmail and the 
previous emails are not available to me here to reply to.

Anyway, I was looking at the source code kindly provided in the 
presentation by Sebastian Mancke.

I had a look around for some more information and found the patent for 
Jazelle: US patent number 7089539.

Google link here (with figures, which makes understanding it far 
easier): http://www.google.com/patents?id=iMt6AAAAEBAJ&dq=7089539

Hopefully this will give us enough of an idea about what the registers 
are doing to have a go at using Jazelle.

The next question is how to implement the undefined instruction 
exception handler. Is 0x00000004 (or optionally 0xFFFF0004) writable (I 
need to write some test code really) from a user program? Assuming it 
is, then it should be reasonably straightforward to write an exception 
handler and to use this to branch to some code to handle the 
un-implemented Java instructions. If it's not possible to write to this 
memory, how do programs like gdb hook exceptions? Have I missed some 
unseen stumbling-block here?

I seem to remember seeing a list of those instructions that are handled 
by the hardware, does anyone have a link? (though obviously writing a 
piece of code to interate through and see which cause exceptions is 
quite possible).

The Jazelle patent (as far as I've read at least) explains how the 
particular piece of code that implements an un-implemented bytecode's 
function should move the address of the next bytecode into R14 and load 
a pointer to the code to handle this bytecode into R12 (this is 
software emulation code - the patent points out that all 256 Java 
bytecodes might be implemented to allow debugging of the hardware, 
etc.). After the code has finished running, Fig.3 (box 34) says thay it 
should then run "BXJ R12", but this implies a branch to Java 
instruction branching to non-Java code (the software emulation code)...

The text says it should run "BXJ R14" which effectively returns control 
to the next instruction of the Java program, which is what one would 
assume. Fig.3 also shows a check on whether Java hw interpretation is 
available, and it is this check that determines whether a normal branch 
is made to the address in R12 (to emulate the next instruction) or a 
branch to Java to R14 (to continue hw interpretation). This makes 
sense, so I think that box 34 is simply wrong.

Sorry for the long email,



More information about the maemo-developers mailing list