Determining an ARM CPU's architecture
dave.martin at linaro.org
Mon Jul 4 16:16:49 UTC 2011
On Sat, Jul 02, 2011 at 12:28:01PM +0100, Tixy wrote:
> On Fri, 2011-07-01 at 19:26 +0100, Dave Martin wrote:
> > The interworking behaviour is uniform for ARMv5(T) and above, but since
> > kernels built in Thumb cannot run on pre-v7, and kernels built in ARM
> > cannot (or certainly should not) contain any Thumb code, these niceties
> > may not matter.
> Interworking in different on v7, ARM mode ALU instructions now
> interwork, e.g. "sub pc, pc, #3" will switch from ARM to Thumb.
OK, I was just thinking about Thumb, but this is a fair distinction.
Alternatively, would it make sense to oops instead if we discover when
simulating the branch that it would try to switch to ARM?
I believe that the CPU Main ID register is sufficient to confirm whether
the CPUID registers are there, but I'm not sure whether there's any precise
indication of whether you're running on v7 as such. If you've not already
done so, you might want to look in detail at the CPUID feature bits
documented in the ARM ARM, to see whether the necessary clues are there.
> When doing doing the kprobes bug fixes it was decided that we should
> avoid writes to PC which produce unpredictable results, even though such
> instructions aren't legal and won't occur in normal code. So I believe
> it follows that we should implement interworking correctly, even
> on kernels not built for Thumb.
I'm not sure I understand your argument here.
> Before I started my work, the kprobes code already had a partial
> simulation of interworking, so someone else must have thought it worth
> while. Though it would obviously be a lot simpler if I could just wrap
> all interworking stuff up in #ifdef CONFIG_THUMB2_KERNEL.
Is it worth pinging the original committer to get his views on the rationale
More information about the linaro-kernel