Commit 37d62758 authored by Ammar Faizi's avatar Ammar Faizi Committed by Paul E. McKenney

tools/nolibc: Replace `asm` with `__asm__`

Replace `asm` with `__asm__` to support compilation with -std flag.
Using `asm` with -std flag makes GCC think `asm()` is a function call
instead of an inline assembly.

GCC doc says:

  For the C language, the `asm` keyword is a GNU extension. When
  writing C code that can be compiled with `-ansi` and the `-std`
  options that select C dialects without GNU extensions, use
  `__asm__` instead of `asm`.

Link: https://gcc.gnu.org/onlinedocs/gcc/Basic-Asm.htmlReported-by: default avatarAlviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org>
Acked-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarAmmar Faizi <ammarfaizi2@gnuweeb.org>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 5312aaa5
...@@ -64,10 +64,10 @@ struct sys_stat_struct { ...@@ -64,10 +64,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0"); \ register long _arg1 __asm__ ("x0"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_num) \ : "r"(_num) \
...@@ -78,10 +78,10 @@ struct sys_stat_struct { ...@@ -78,10 +78,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), \ : "r"(_arg1), \
...@@ -93,11 +93,11 @@ struct sys_stat_struct { ...@@ -93,11 +93,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
register long _arg2 asm("x1") = (long)(arg2); \ register long _arg2 __asm__ ("x1") = (long)(arg2); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), \ : "r"(_arg1), "r"(_arg2), \
...@@ -109,12 +109,12 @@ struct sys_stat_struct { ...@@ -109,12 +109,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
register long _arg2 asm("x1") = (long)(arg2); \ register long _arg2 __asm__ ("x1") = (long)(arg2); \
register long _arg3 asm("x2") = (long)(arg3); \ register long _arg3 __asm__ ("x2") = (long)(arg3); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), \
...@@ -126,13 +126,13 @@ struct sys_stat_struct { ...@@ -126,13 +126,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
register long _arg2 asm("x1") = (long)(arg2); \ register long _arg2 __asm__ ("x1") = (long)(arg2); \
register long _arg3 asm("x2") = (long)(arg3); \ register long _arg3 __asm__ ("x2") = (long)(arg3); \
register long _arg4 asm("x3") = (long)(arg4); \ register long _arg4 __asm__ ("x3") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
...@@ -144,14 +144,14 @@ struct sys_stat_struct { ...@@ -144,14 +144,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
register long _arg2 asm("x1") = (long)(arg2); \ register long _arg2 __asm__ ("x1") = (long)(arg2); \
register long _arg3 asm("x2") = (long)(arg3); \ register long _arg3 __asm__ ("x2") = (long)(arg3); \
register long _arg4 asm("x3") = (long)(arg4); \ register long _arg4 __asm__ ("x3") = (long)(arg4); \
register long _arg5 asm("x4") = (long)(arg5); \ register long _arg5 __asm__ ("x4") = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r" (_arg1) \ : "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -163,15 +163,15 @@ struct sys_stat_struct { ...@@ -163,15 +163,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ #define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \ ({ \
register long _num asm("x8") = (num); \ register long _num __asm__ ("x8") = (num); \
register long _arg1 asm("x0") = (long)(arg1); \ register long _arg1 __asm__ ("x0") = (long)(arg1); \
register long _arg2 asm("x1") = (long)(arg2); \ register long _arg2 __asm__ ("x1") = (long)(arg2); \
register long _arg3 asm("x2") = (long)(arg3); \ register long _arg3 __asm__ ("x2") = (long)(arg3); \
register long _arg4 asm("x3") = (long)(arg4); \ register long _arg4 __asm__ ("x3") = (long)(arg4); \
register long _arg5 asm("x4") = (long)(arg5); \ register long _arg5 __asm__ ("x4") = (long)(arg5); \
register long _arg6 asm("x5") = (long)(arg6); \ register long _arg6 __asm__ ("x5") = (long)(arg6); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r" (_arg1) \ : "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -182,7 +182,7 @@ struct sys_stat_struct { ...@@ -182,7 +182,7 @@ struct sys_stat_struct {
}) })
/* startup code */ /* startup code */
asm(".section .text\n" __asm__ (".section .text\n"
".weak _start\n" ".weak _start\n"
".global _start\n" ".global _start\n"
"_start:\n" "_start:\n"
......
...@@ -77,10 +77,10 @@ struct sys_stat_struct { ...@@ -77,10 +77,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0"); \ register long _arg1 __asm__ ("r0"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_num) \ : "r"(_num) \
...@@ -91,10 +91,10 @@ struct sys_stat_struct { ...@@ -91,10 +91,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0") = (long)(arg1); \ register long _arg1 __asm__ ("r0") = (long)(arg1); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), \ : "r"(_arg1), \
...@@ -106,11 +106,11 @@ struct sys_stat_struct { ...@@ -106,11 +106,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0") = (long)(arg1); \ register long _arg1 __asm__ ("r0") = (long)(arg1); \
register long _arg2 asm("r1") = (long)(arg2); \ register long _arg2 __asm__ ("r1") = (long)(arg2); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), \ : "r"(_arg1), "r"(_arg2), \
...@@ -122,12 +122,12 @@ struct sys_stat_struct { ...@@ -122,12 +122,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0") = (long)(arg1); \ register long _arg1 __asm__ ("r0") = (long)(arg1); \
register long _arg2 asm("r1") = (long)(arg2); \ register long _arg2 __asm__ ("r1") = (long)(arg2); \
register long _arg3 asm("r2") = (long)(arg3); \ register long _arg3 __asm__ ("r2") = (long)(arg3); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), \
...@@ -139,13 +139,13 @@ struct sys_stat_struct { ...@@ -139,13 +139,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0") = (long)(arg1); \ register long _arg1 __asm__ ("r0") = (long)(arg1); \
register long _arg2 asm("r1") = (long)(arg2); \ register long _arg2 __asm__ ("r1") = (long)(arg2); \
register long _arg3 asm("r2") = (long)(arg3); \ register long _arg3 __asm__ ("r2") = (long)(arg3); \
register long _arg4 asm("r3") = (long)(arg4); \ register long _arg4 __asm__ ("r3") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
...@@ -157,14 +157,14 @@ struct sys_stat_struct { ...@@ -157,14 +157,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
register long _num asm("r7") = (num); \ register long _num __asm__ ("r7") = (num); \
register long _arg1 asm("r0") = (long)(arg1); \ register long _arg1 __asm__ ("r0") = (long)(arg1); \
register long _arg2 asm("r1") = (long)(arg2); \ register long _arg2 __asm__ ("r1") = (long)(arg2); \
register long _arg3 asm("r2") = (long)(arg3); \ register long _arg3 __asm__ ("r2") = (long)(arg3); \
register long _arg4 asm("r3") = (long)(arg4); \ register long _arg4 __asm__ ("r3") = (long)(arg4); \
register long _arg5 asm("r4") = (long)(arg5); \ register long _arg5 __asm__ ("r4") = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"svc #0\n" \ "svc #0\n" \
: "=r" (_arg1) \ : "=r" (_arg1) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -175,7 +175,7 @@ struct sys_stat_struct { ...@@ -175,7 +175,7 @@ struct sys_stat_struct {
}) })
/* startup code */ /* startup code */
asm(".section .text\n" __asm__ (".section .text\n"
".weak _start\n" ".weak _start\n"
".global _start\n" ".global _start\n"
"_start:\n" "_start:\n"
......
...@@ -66,9 +66,9 @@ struct sys_stat_struct { ...@@ -66,9 +66,9 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "0"(_num) \ : "0"(_num) \
...@@ -80,10 +80,10 @@ struct sys_stat_struct { ...@@ -80,10 +80,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
register long _arg1 asm("ebx") = (long)(arg1); \ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "r"(_arg1), \ : "r"(_arg1), \
...@@ -96,11 +96,11 @@ struct sys_stat_struct { ...@@ -96,11 +96,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
register long _arg1 asm("ebx") = (long)(arg1); \ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
register long _arg2 asm("ecx") = (long)(arg2); \ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), \ : "r"(_arg1), "r"(_arg2), \
...@@ -113,12 +113,12 @@ struct sys_stat_struct { ...@@ -113,12 +113,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
register long _arg1 asm("ebx") = (long)(arg1); \ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
register long _arg2 asm("ecx") = (long)(arg2); \ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
register long _arg3 asm("edx") = (long)(arg3); \ register long _arg3 __asm__ ("edx") = (long)(arg3); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), \
...@@ -131,13 +131,13 @@ struct sys_stat_struct { ...@@ -131,13 +131,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
register long _arg1 asm("ebx") = (long)(arg1); \ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
register long _arg2 asm("ecx") = (long)(arg2); \ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
register long _arg3 asm("edx") = (long)(arg3); \ register long _arg3 __asm__ ("edx") = (long)(arg3); \
register long _arg4 asm("esi") = (long)(arg4); \ register long _arg4 __asm__ ("esi") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
...@@ -150,14 +150,14 @@ struct sys_stat_struct { ...@@ -150,14 +150,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("eax") = (num); \ register long _num __asm__ ("eax") = (num); \
register long _arg1 asm("ebx") = (long)(arg1); \ register long _arg1 __asm__ ("ebx") = (long)(arg1); \
register long _arg2 asm("ecx") = (long)(arg2); \ register long _arg2 __asm__ ("ecx") = (long)(arg2); \
register long _arg3 asm("edx") = (long)(arg3); \ register long _arg3 __asm__ ("edx") = (long)(arg3); \
register long _arg4 asm("esi") = (long)(arg4); \ register long _arg4 __asm__ ("esi") = (long)(arg4); \
register long _arg5 asm("edi") = (long)(arg5); \ register long _arg5 __asm__ ("edi") = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"int $0x80\n" \ "int $0x80\n" \
: "=a" (_ret) \ : "=a" (_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -174,7 +174,7 @@ struct sys_stat_struct { ...@@ -174,7 +174,7 @@ struct sys_stat_struct {
* 2) The deepest stack frame should be set to zero * 2) The deepest stack frame should be set to zero
* *
*/ */
asm(".section .text\n" __asm__ (".section .text\n"
".weak _start\n" ".weak _start\n"
".global _start\n" ".global _start\n"
"_start:\n" "_start:\n"
......
...@@ -69,10 +69,10 @@ struct sys_stat_struct { ...@@ -69,10 +69,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg4 asm("a3"); \ register long _arg4 __asm__ ("a3"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"syscall\n" \ "syscall\n" \
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
...@@ -86,11 +86,11 @@ struct sys_stat_struct { ...@@ -86,11 +86,11 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg4 asm("a3"); \ register long _arg4 __asm__ ("a3"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"syscall\n" \ "syscall\n" \
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
...@@ -105,12 +105,12 @@ struct sys_stat_struct { ...@@ -105,12 +105,12 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg4 asm("a3"); \ register long _arg4 __asm__ ("a3"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"syscall\n" \ "syscall\n" \
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
...@@ -125,13 +125,13 @@ struct sys_stat_struct { ...@@ -125,13 +125,13 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3"); \ register long _arg4 __asm__ ("a3"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"syscall\n" \ "syscall\n" \
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
...@@ -146,13 +146,13 @@ struct sys_stat_struct { ...@@ -146,13 +146,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3") = (long)(arg4); \ register long _arg4 __asm__ ("a3") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"syscall\n" \ "syscall\n" \
"addiu $sp, $sp, 32\n" \ "addiu $sp, $sp, 32\n" \
...@@ -167,14 +167,14 @@ struct sys_stat_struct { ...@@ -167,14 +167,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
register long _num asm("v0") = (num); \ register long _num __asm__ ("v0") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3") = (long)(arg4); \ register long _arg4 __asm__ ("a3") = (long)(arg4); \
register long _arg5 = (long)(arg5); \ register long _arg5 = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"addiu $sp, $sp, -32\n" \ "addiu $sp, $sp, -32\n" \
"sw %7, 16($sp)\n" \ "sw %7, 16($sp)\n" \
"syscall\n " \ "syscall\n " \
...@@ -189,7 +189,7 @@ struct sys_stat_struct { ...@@ -189,7 +189,7 @@ struct sys_stat_struct {
}) })
/* startup code, note that it's called __start on MIPS */ /* startup code, note that it's called __start on MIPS */
asm(".section .text\n" __asm__ (".section .text\n"
".weak __start\n" ".weak __start\n"
".set nomips16\n" ".set nomips16\n"
".global __start\n" ".global __start\n"
......
...@@ -66,10 +66,10 @@ struct sys_stat_struct { ...@@ -66,10 +66,10 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0"); \ register long _arg1 __asm__ ("a0"); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n\t" \ "ecall\n\t" \
: "=r"(_arg1) \ : "=r"(_arg1) \
: "r"(_num) \ : "r"(_num) \
...@@ -80,10 +80,10 @@ struct sys_stat_struct { ...@@ -80,10 +80,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n" \ "ecall\n" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_num) \ : "r"(_num) \
...@@ -94,11 +94,11 @@ struct sys_stat_struct { ...@@ -94,11 +94,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n" \ "ecall\n" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_arg2), \ : "r"(_arg2), \
...@@ -110,12 +110,12 @@ struct sys_stat_struct { ...@@ -110,12 +110,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n\t" \ "ecall\n\t" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), \ : "r"(_arg2), "r"(_arg3), \
...@@ -127,13 +127,13 @@ struct sys_stat_struct { ...@@ -127,13 +127,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3") = (long)(arg4); \ register long _arg4 __asm__ ("a3") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n" \ "ecall\n" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), \ : "r"(_arg2), "r"(_arg3), "r"(_arg4), \
...@@ -145,14 +145,14 @@ struct sys_stat_struct { ...@@ -145,14 +145,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3") = (long)(arg4); \ register long _arg4 __asm__ ("a3") = (long)(arg4); \
register long _arg5 asm("a4") = (long)(arg5); \ register long _arg5 __asm__ ("a4") = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n" \ "ecall\n" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -164,15 +164,15 @@ struct sys_stat_struct { ...@@ -164,15 +164,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ #define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \ ({ \
register long _num asm("a7") = (num); \ register long _num __asm__ ("a7") = (num); \
register long _arg1 asm("a0") = (long)(arg1); \ register long _arg1 __asm__ ("a0") = (long)(arg1); \
register long _arg2 asm("a1") = (long)(arg2); \ register long _arg2 __asm__ ("a1") = (long)(arg2); \
register long _arg3 asm("a2") = (long)(arg3); \ register long _arg3 __asm__ ("a2") = (long)(arg3); \
register long _arg4 asm("a3") = (long)(arg4); \ register long _arg4 __asm__ ("a3") = (long)(arg4); \
register long _arg5 asm("a4") = (long)(arg5); \ register long _arg5 __asm__ ("a4") = (long)(arg5); \
register long _arg6 asm("a5") = (long)(arg6); \ register long _arg6 __asm__ ("a5") = (long)(arg6); \
\ \
asm volatile ( \ __asm__ volatile ( \
"ecall\n" \ "ecall\n" \
: "+r"(_arg1) \ : "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), "r"(_arg6), \ : "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), "r"(_arg6), \
...@@ -183,7 +183,7 @@ struct sys_stat_struct { ...@@ -183,7 +183,7 @@ struct sys_stat_struct {
}) })
/* startup code */ /* startup code */
asm(".section .text\n" __asm__ (".section .text\n"
".weak _start\n" ".weak _start\n"
".global _start\n" ".global _start\n"
"_start:\n" "_start:\n"
......
...@@ -68,9 +68,9 @@ struct sys_stat_struct { ...@@ -68,9 +68,9 @@ struct sys_stat_struct {
#define my_syscall0(num) \ #define my_syscall0(num) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "0"(_num) \ : "0"(_num) \
...@@ -82,10 +82,10 @@ struct sys_stat_struct { ...@@ -82,10 +82,10 @@ struct sys_stat_struct {
#define my_syscall1(num, arg1) \ #define my_syscall1(num, arg1) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), \ : "r"(_arg1), \
...@@ -98,11 +98,11 @@ struct sys_stat_struct { ...@@ -98,11 +98,11 @@ struct sys_stat_struct {
#define my_syscall2(num, arg1, arg2) \ #define my_syscall2(num, arg1, arg2) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
register long _arg2 asm("rsi") = (long)(arg2); \ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), \ : "r"(_arg1), "r"(_arg2), \
...@@ -115,12 +115,12 @@ struct sys_stat_struct { ...@@ -115,12 +115,12 @@ struct sys_stat_struct {
#define my_syscall3(num, arg1, arg2, arg3) \ #define my_syscall3(num, arg1, arg2, arg3) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
register long _arg2 asm("rsi") = (long)(arg2); \ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
register long _arg3 asm("rdx") = (long)(arg3); \ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), \
...@@ -133,13 +133,13 @@ struct sys_stat_struct { ...@@ -133,13 +133,13 @@ struct sys_stat_struct {
#define my_syscall4(num, arg1, arg2, arg3, arg4) \ #define my_syscall4(num, arg1, arg2, arg3, arg4) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
register long _arg2 asm("rsi") = (long)(arg2); \ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
register long _arg3 asm("rdx") = (long)(arg3); \ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
register long _arg4 asm("r10") = (long)(arg4); \ register long _arg4 __asm__ ("r10") = (long)(arg4); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), \
...@@ -152,14 +152,14 @@ struct sys_stat_struct { ...@@ -152,14 +152,14 @@ struct sys_stat_struct {
#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \ #define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
register long _arg2 asm("rsi") = (long)(arg2); \ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
register long _arg3 asm("rdx") = (long)(arg3); \ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
register long _arg4 asm("r10") = (long)(arg4); \ register long _arg4 __asm__ ("r10") = (long)(arg4); \
register long _arg5 asm("r8") = (long)(arg5); \ register long _arg5 __asm__ ("r8") = (long)(arg5); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -172,15 +172,15 @@ struct sys_stat_struct { ...@@ -172,15 +172,15 @@ struct sys_stat_struct {
#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \ #define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) \
({ \ ({ \
long _ret; \ long _ret; \
register long _num asm("rax") = (num); \ register long _num __asm__ ("rax") = (num); \
register long _arg1 asm("rdi") = (long)(arg1); \ register long _arg1 __asm__ ("rdi") = (long)(arg1); \
register long _arg2 asm("rsi") = (long)(arg2); \ register long _arg2 __asm__ ("rsi") = (long)(arg2); \
register long _arg3 asm("rdx") = (long)(arg3); \ register long _arg3 __asm__ ("rdx") = (long)(arg3); \
register long _arg4 asm("r10") = (long)(arg4); \ register long _arg4 __asm__ ("r10") = (long)(arg4); \
register long _arg5 asm("r8") = (long)(arg5); \ register long _arg5 __asm__ ("r8") = (long)(arg5); \
register long _arg6 asm("r9") = (long)(arg6); \ register long _arg6 __asm__ ("r9") = (long)(arg6); \
\ \
asm volatile ( \ __asm__ volatile ( \
"syscall\n" \ "syscall\n" \
: "=a"(_ret) \ : "=a"(_ret) \
: "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ : "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \
...@@ -197,7 +197,7 @@ struct sys_stat_struct { ...@@ -197,7 +197,7 @@ struct sys_stat_struct {
* 2) The deepest stack frame should be zero (the %rbp). * 2) The deepest stack frame should be zero (the %rbp).
* *
*/ */
asm(".section .text\n" __asm__ (".section .text\n"
".weak _start\n" ".weak _start\n"
".global _start\n" ".global _start\n"
"_start:\n" "_start:\n"
......
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