arch:rv64:add memory clobber to inline asm for syscall.

Signed-off-by: hotislandn <hotislandn@hotmail.com>
This commit is contained in:
hotislandn 2021-04-03 11:08:14 +08:00 committed by Xiang Xiao
parent 18f88c35fc
commit b4b175cb7f

View File

@ -158,6 +158,7 @@ static inline uintptr_t sys_call0(unsigned int nbr)
(
"ecall"
:: "r"(r0)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -182,6 +183,7 @@ static inline uintptr_t sys_call1(unsigned int nbr, uintptr_t parm1)
(
"ecall"
:: "r"(r0), "r"(r1)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -208,6 +210,7 @@ static inline uintptr_t sys_call2(unsigned int nbr, uintptr_t parm1,
(
"ecall"
:: "r"(r0), "r"(r1), "r"(r2)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -235,6 +238,7 @@ static inline uintptr_t sys_call3(unsigned int nbr, uintptr_t parm1,
(
"ecall"
:: "r"(r0), "r"(r1), "r"(r2), "r"(r3)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -264,6 +268,7 @@ static inline uintptr_t sys_call4(unsigned int nbr, uintptr_t parm1,
(
"ecall"
:: "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -294,6 +299,7 @@ static inline uintptr_t sys_call5(unsigned int nbr, uintptr_t parm1,
(
"ecall"
:: "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5)
: "memory"
);
asm volatile("nop" : "=r"(r0));
@ -326,6 +332,7 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
(
"ecall"
:: "r"(r0), "r"(r1), "r"(r2), "r"(r3), "r"(r4), "r"(r5), "r"(r6)
: "memory"
);
asm volatile("nop" : "=r"(r0));