gcc: Use register r31 to call routines instead of r10

This commit is contained in:
Ry 2023-02-07 18:13:39 -08:00
parent 73651a0a1b
commit 6a790fc1e4

View File

@ -4,13 +4,13 @@
#define STR(x) STR2(x)
#define _call2(c, jt_addr) \
asm("li a0,ret_" #c "\n" \
asm("li t6,ret_" #c "\n" \
"addi sp,sp,-4\n" \
"sw a0,0(sp)\n" \
"li a0,[" STR(jt_addr) "]\n" \
"jr a0\n" \
"sw t6,0(sp)\n" \
"li t6,[" STR(jt_addr) "]\n" \
"jr t6\n" \
"ret_" #c ":" \
::: "a0" \
::: "t6" \
);
#define _call(c, jt_addr) _call2(c, jt_addr)
#define call(jt_addr) _call(__COUNTER__, jt_addr)