Not sure if this is the right sub-forum for this question...
Want to port my OS to the AArch64 architecture. I started with a simple bare-metal application, to learn this architecture
Now I want to implement interrupt support, but run into an issue with GAS/GCC:
The problem is, I can't access the ICC_x registers.
The code:
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
msr ICC_SRE_EL2, x0
ret
.end
Accessing CurrentEL and MPIDR_EL1 works. But on ICC_SRE_EL2 I get the following errors:
Code:
$ make
aarch64-none-elf-gcc -c -Wall -I ./include -ffreestanding -mcpu=cortex-a53 -Wa,-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 x0,ICC_SRE_EL2'
misc.S:44: Error: unknown or missing system register name at operand 1 -- `msr ICC_SRE_EL2,x0'
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 1 -- `msr ICC_SRE_EL2,x0'
Seems these registers are not implemented by GCC.
Can somebody explain me, what I'm doing wrong?
EDIT:- Fixed wrong code in function _cpu_set_icc_sre_el2_fiq()
_________________
Code:
/* Beware of bugs in the above code;
I have only proved it correct, not tried it. */
Original quote by Donald E. Knuth