I'm trying to work out what compile time checks I can do determine which ARM architecture the kernel binary may be run on.
Is __LINUX_ARM_ARCH__ the architecture that the kernel is being built to support, or is it the instruction set being used by the compiler? (If these aren't always the same.)
Also, when a kernel is built for ARMv6 and ARMv7, I assume that __LINUX_ARM_ARCH__ == 6 ?
Finally, is it safe to assume that a single kernel binary will never support both v5 and v6 hardware? What about v4 and v5?
My ultimate goal is to correctly simulate ARM instructions which behave differently on different architectures, for this, there will also need to be some runtime checking. I can do this by running some test code at boot time, but does the kernel already have some CPU architecture or feature detection that I can make use of?
I was also looking at the Instruction Set Attribute Register in CP15, these give me the exact information I want, but I suspect that determining their availability will be as difficult as writing code to probe the features I'm interested in (ARM/Thumb interworking).