aboutsummaryrefslogtreecommitdiff
path: root/tests/common/arch/riscv64/syscall.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 18:50:51 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-30 18:50:51 +0300
commit712a15ce6c5fdf9c5156a5954cd6c3551547037c (patch)
tree11b3736a6569e8408af7fbd11fa716bb3d6e87f9 /tests/common/arch/riscv64/syscall.h
parentcb1fd73f6b76c2297772f6faccb9b46b99f55e2c (diff)
downloadkmi-712a15ce6c5fdf9c5156a5954cd6c3551547037c.tar.gz
kmi-712a15ce6c5fdf9c5156a5954cd6c3551547037c.zip
speed up ipc_resp a bit
+ Skip unwinding stack and just jump directly to userspace
Diffstat (limited to 'tests/common/arch/riscv64/syscall.h')
-rw-r--r--tests/common/arch/riscv64/syscall.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/common/arch/riscv64/syscall.h b/tests/common/arch/riscv64/syscall.h
index aafda82..993d9a7 100644
--- a/tests/common/arch/riscv64/syscall.h
+++ b/tests/common/arch/riscv64/syscall.h
@@ -16,31 +16,37 @@ static inline struct sys_ret syscall(size_t n,
register long a4 __asm__ ("a4") = arg4;
register long a5 __asm__ ("a5") = arg5;
-#define OUTPUTS "+r" (a0), "=r" (a1), "=r" (a2), "=r" (a3), "=r" (a4), "=r" (a5)
+#define OUTPUTS "=r" (a0), "=r" (a1), "=r" (a2), "=r" (a3), "=r" (a4), "=r" (a5)
+#define CLOBBERS \
+ "a6", "a7", \
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", \
+ "memory"
if (n == 1)
- __asm__ volatile ("ecall" : OUTPUTS : "r" (a0));
+ __asm__ volatile ("ecall" : OUTPUTS : "r" (a0) : CLOBBERS);
else if (n == 2)
- __asm__ volatile ("ecall" : OUTPUTS : "r" (a0), "r" (a1));
+ __asm__ volatile ("ecall" : OUTPUTS : "r" (a0), "r" (a1) : CLOBBERS);
else if (n == 3)
- __asm__ volatile ("ecall" : OUTPUTS : "r" (a0), "r" (a1),
- "r" (a2));
+ __asm__ volatile ("ecall" : OUTPUTS
+ : "r" (a0), "r" (a1), "r" (a2)
+ : CLOBBERS);
else if (n == 4)
__asm__ volatile ("ecall" : OUTPUTS
- : "r" (a0), "r" (a1), "r" (a2), "r" (a3));
+ : "r" (a0), "r" (a1), "r" (a2), "r" (a3)
+ : CLOBBERS);
else if (n == 5)
__asm__ volatile ("ecall" : OUTPUTS
- : "r" (a0), "r" (a1), "r" (a2), "r" (a3),
- "r" (a4));
+ : "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (a4)
+ : CLOBBERS);
else if (n == 6)
__asm__ volatile ("ecall" : OUTPUTS
- : "r" (a0), "r" (a1), "r" (a2), "r" (a3),
- "r" (a4), "r" (a5));
+ : "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5)
+ : CLOBBERS);
#undef OUTPUTS