View Single Post
Old 05-30-2012, 08:41 PM   #13
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,721
Default

Quote:
Originally Posted by liteon View Post
the glue code needs some more work, but at least it compiles/runs now.

there are some slight differences to x86, ppc, since in all places i directly modify the pc/link instead of branching ("b"). this should be technically slower, but gives a 32bit jump. the reason was that bx was giving me some strange results (thumb mode) and on the other hand gas translated "bl" to something similar, if i recall.

--

Very cool! I'm learning a lot reading this...

Unfortunately I think we'll need to do some more tweaks to the code calling the glue, to support storing the offset elsewhere (in a data block, perhaps), because this code:

Quote:
static const unsigned int GLUE_JMP_IF_P1_Z[]=
{
0x051ff004, // ldreq pc, [pc, #-4]
0x0, // offset goes here
};
...will try to execute the offset as an instruction (assuming the jump is not made), which would almost always be bad...
Justin is offline   Reply With Quote