Subject: Re: StrongARM K bug
To: Nicholas Clark <nick@flirble.org>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 04/07/1999 10:59:07
nick@flirble.org said:
> > Don't forget you also need to fix up pointer-to-function calling,
> > which uses the sequence
> > mov lr, pc
> > ldr pc, [reg, ...]
> > For this it is important not to split the two instructions, so you
> > will need to align, do a padding nop and then emit the sequence.
> I had forgotten this. I had a thought - improved messy version is:
> add lr, pc, #4
> .align 3
> ldr pc, [...]
> .align 3
> which will become either
> add lr, pc, #4 ; return to .there
> andeq r0, r0, r0
> ldr pc, [...] .there
> or
> add lr, pc, #4 ; return to .there
> ldr pc, [...]
> andeq r0, r0, r0 .there
A neat idea. This will work fine when running in 32-bit mode, but,
unfortunately, won't work in 26-bit mode because the add will clobber the
PSR information in the link register.
> Hopefully from the DEC document I can figure out how to make the MMU
> work, I'll do my best to do that, as
> a) this is getting really messy.
Yep. Too many corner cases.
> b) I'd like to be able to reliably run anyone else's (legal) binaries
> without needing to recompile to get the bodges in.
Yep. Though for this, there is always the option of binary patching...
We await your conclusions with baited breath...
R.