I have started a simple bare-metal project for the Cortex-A53. Now I want to implement interrupt handling, but run into an issue with the toolchain.
Want to read out and write into the ICC_x registers, but get the following error message from GAS:
$ make aarch64-suse-linux-gcc -c -Wall -I ./include -ffreestanding -mcpu=cortex-a53 misc.S -o misc.o misc.S: Assembler messages: misc.S:38: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2' misc.S:42: Error: unknown or missing system register name at operand 2 -- `mrs w0,ICC_SRE_EL2' misc.S:44: Error: unknown or missing system register name at operand 1 -- `msr ICC_SRE_EL2,w0' misc.S:48: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2' misc.S:50: Error: unknown or missing system register name at operand 2 -- `mrs x0,ICC_SRE_EL2'
The code:
#include <asm.h> #define ICC_SRE_EL2_FIQ 0x2 #define ICC_SRE_EL2_IRQ 0x4 .text FUNCTION(_cpu_get_el) mrs x0, CurrentEL and x0, x0, #0xC asr x0, x0, #2 ret FUNCTION(_cpu_get_id) mrs x0, MPIDR_EL1 and x0, x0, #0x3 ret FUNCTION(_cpu_get_icc_sre_el2) mrs x0, ICC_SRE_EL2 ret FUNCTION(_cpu_set_icc_sre_el2_irq) mrs x0, ICC_SRE_EL2 orr x0, x0, #ICC_SRE_EL2_IRQ msr ICC_SRE_EL2, x0 ret FUNCTION(_cpu_set_icc_sre_el2_fiq) mrs x0, ICC_SRE_EL2 orr x0, x0, #ICC_SRE_EL2_FIQ mrs x0, ICC_SRE_EL2 ret .end
Is something missing?
I compile with the folllowing options.
-Wall -I ./include -ffreestanding -mcpu=cortex-a53 -Wa,-mcpu=cortex-a53
-Wall -I ./include -ffreestanding -mcpu=cortex-a53
I have found the solution.
Seems GNU Assembler doesn't recognize some of the system registers.
To access these registers a special encoding must be used.
s<op0>_<op1>_c<CRn>_c<CRm>_<op2>
As example for the ICC_SRE_EL2 register, following works:
mrs x0, s3_4_c12_c9_5
The correct values for <op0>, <op1>, <CRn>, <CRm> and <op2> can be found on DDI0595 (AArch64 System Registers).
krjdev said:I have found the solution
Excellent!
No problem.
I'm wondering why there is no official list for the implemented registers. So it's a "Trial and Error" method.
Haven't found a list at least.