Linux r9 ARM register

The "ARM Architecture Procedure Call Standard" (AAPCS / EABI) indicates (5.1.1) that

"The role of register r9 is platform specific." 

but

 "A virtual platform [...] may designate r9 as an additional callee-saved variable register, v6." 

The question is, does the Linux kernel use r9 for a specific purpose? Or is it used as a regular non-volatile register?

+6
source share
2 answers

An easy way to find out how the kernel uses it is to simply build the kernel ( CROSS_COMPILE=... ARCH=arm make vmlinux ) and then parse it all,

 ${CROSS_COMPILE}objdump -d vmlinux.o | grep 'sb|r9' 

to check (using the names r9 and sb , since it depends on your objdump, which is exactly output).

If you have ever found that it is used in prolog / epilogue code (in instructions like push {..., r9, ...} , stmfd sp!, {..., r9, ...} or their corresponding pop / ldmfd ), then he is saved. Otherwise, another scratch reg. The result may depend on your toolchain, kernel configuration settings, or ARM target.

However, if you compile the Thumb-2 kernel, it will not be saved. This is because Thumb-2 push / pop only works with lower registration (and lr / pc an additional way, push lr paired with pop pc ).

+1
source

I think register definitions are stored in include / asm-arm / ptrace.h

Not sure 100% though ...

0
source

Source: https://habr.com/ru/post/899978/


All Articles