Commit 8b9bdab6 authored by Zhangjin Wu's avatar Zhangjin Wu Committed by Willy Tarreau

tools/nolibc: arch-mips.h: shrink with _NOLIBC_SYSCALL_CLOBBERLIST

my_syscall<N> share the same long clobber list, define a macro for them.
Signed-off-by: default avatarZhangjin Wu <falcon@tinylab.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 2dca615a
...@@ -57,6 +57,10 @@ struct sys_stat_struct { ...@@ -57,6 +57,10 @@ struct sys_stat_struct {
* don't have to experience issues with register constraints. * don't have to experience issues with register constraints.
*/ */
#define _NOLIBC_SYSCALL_CLOBBERLIST \
"memory", "cc", "at", "v1", "hi", "lo", \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9"
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
register long _num __asm__ ("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
...@@ -68,8 +72,7 @@ struct sys_stat_struct { ...@@ -68,8 +72,7 @@ struct sys_stat_struct {
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
: "=r"(_num), "=r"(_arg4) \ : "=r"(_num), "=r"(_arg4) \
: "r"(_num) \ : "r"(_num) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
...@@ -87,8 +90,7 @@ struct sys_stat_struct { ...@@ -87,8 +90,7 @@ struct sys_stat_struct {
: "=r"(_num), "=r"(_arg4) \ : "=r"(_num), "=r"(_arg4) \
: "0"(_num), \ : "0"(_num), \
"r"(_arg1) \ "r"(_arg1) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
...@@ -107,8 +109,7 @@ struct sys_stat_struct { ...@@ -107,8 +109,7 @@ struct sys_stat_struct {
: "=r"(_num), "=r"(_arg4) \ : "=r"(_num), "=r"(_arg4) \
: "0"(_num), \ : "0"(_num), \
"r"(_arg1), "r"(_arg2) \ "r"(_arg1), "r"(_arg2) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
...@@ -128,8 +129,7 @@ struct sys_stat_struct { ...@@ -128,8 +129,7 @@ struct sys_stat_struct {
: "=r"(_num), "=r"(_arg4) \ : "=r"(_num), "=r"(_arg4) \
: "0"(_num), \ : "0"(_num), \
"r"(_arg1), "r"(_arg2), "r"(_arg3) \ "r"(_arg1), "r"(_arg2), "r"(_arg3) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
...@@ -149,8 +149,7 @@ struct sys_stat_struct { ...@@ -149,8 +149,7 @@ struct sys_stat_struct {
: "=r" (_num), "=r"(_arg4) \ : "=r" (_num), "=r"(_arg4) \
: "0"(_num), \ : "0"(_num), \
"r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4) \ "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
...@@ -172,8 +171,7 @@ struct sys_stat_struct { ...@@ -172,8 +171,7 @@ struct sys_stat_struct {
: "=r" (_num), "=r"(_arg4) \ : "=r" (_num), "=r"(_arg4) \
: "0"(_num), \ : "0"(_num), \
"r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5) \ "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5) \
: "memory", "cc", "at", "v1", "hi", "lo", \ : _NOLIBC_SYSCALL_CLOBBERLIST \
"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" \
); \ ); \
_arg4 ? -_num : _num; \ _arg4 ? -_num : _num; \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment