From b4b175cb7f8273d84107dbc9ca85e70da2edc6f6 Mon Sep 17 00:00:00 2001 From: hotislandn Date: Sat, 3 Apr 2021 11:08:14 +0800 Subject: [PATCH] arch:rv64:add memory clobber to inline asm for syscall. Signed-off-by: hotislandn --- arch/risc-v/include/rv64gc/syscall.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/risc-v/include/rv64gc/syscall.h b/arch/risc-v/include/rv64gc/syscall.h index f6f3d710634..d35280990cc 100644 --- a/arch/risc-v/include/rv64gc/syscall.h +++ b/arch/risc-v/include/rv64gc/syscall.h @@ -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));