hi, group,
I am trying the risc v assembly language. I compiled the following code. The code is to read the hart id to t6.
.text
.globl _start
_start:
csrr t6, mhartid
add a0, x0, 22
li a7, 93
ecall
But it generates "Illegal instruction" error. I just write this file to a .s file. I used as + ld and generated an executable ELF. If i replace the "CSRR t6, mhartid" to other instruciton (e.g. addi t6, t6, 1), it's fine.
Does anyone know why CSRR is so special?
thanks.