On Tue, 2011-07-05 at 09:44 +0100, Dave Martin wrote:
On Mon, Jul 04, 2011 at 05:52:03PM +0100, Tixy wrote:
[...]
Over the weekend I implemented functions to check various interworking behaviour, and run these when kprobes is first initialised. So I now have things all simulated correctly and I think I may as well leave things in there now.
Do you mean you check the CPU ID etc?
I'm not sure that experimentally running instructions to see what happens is entirely safe, but that may not be what you're suggesting.
For "add pc, pc, #3"
#if __LINUX_ARM_ARCH__ <= 5
Assume kernel can't be running on ARMv6 or so don't interwork.
#else
Execute "add pc, pc, #3" and see what happens.
#endif.
For the case of "ldr pc, [...]", you are right, trying to execute this on ARMv4 is UNPREDICTABLE, so I need to think again. Possibly just try a CLZ instruction and see if we get an undef abort, that would tell us we're on ARMv5?