patch-2.4.27 linux-2.4.27/include/asm-sh64/unistd.h
Next file: linux-2.4.27/include/asm-sparc64/mmu_context.h
Previous file: linux-2.4.27/include/asm-sh64/registers.h
Back to the patch index
Back to the overall index
- Lines: 108
- Date:
2004-08-07 16:26:06.166408906 -0700
- Orig file:
linux-2.4.26/include/asm-sh64/unistd.h
- Orig date:
2003-08-25 04:44:44.000000000 -0700
diff -urN linux-2.4.26/include/asm-sh64/unistd.h linux-2.4.27/include/asm-sh64/unistd.h
@@ -287,20 +287,31 @@
type name(void) \
{ \
register unsigned long __sc0 __asm__ ("r9") = ((0x10 << 16) | __NR_##name); \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "()" \
: "=r" (__sc0) \
: "r" (__sc0) ); \
__syscall_return(type,__sc0); \
}
+ /*
+ * The apparent spurious "dummy" assembler comment is *needed*,
+ * as without it, the compiler treats the arg<n> variables
+ * as no longer live just before the asm. The compiler can
+ * then optimize the storage into any registers it wishes.
+ * The additional dummy statement forces the compiler to put
+ * the arguments into the correct registers before the TRAPA.
+ */
#define _syscall1(type,name,type1,arg1) \
type name(type1 arg1) \
{ \
register unsigned long __sc0 __asm__ ("r9") = ((0x11 << 16) | __NR_##name); \
register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2)" \
: "=r" (__sc0) \
: "r" (__sc0), "r" (__sc2)); \
+__asm__ __volatile__ ("!dummy %0 %1" \
+ : \
+ : "r" (__sc0), "r" (__sc2)); \
__syscall_return(type,__sc0); \
}
@@ -310,9 +321,12 @@
register unsigned long __sc0 __asm__ ("r9") = ((0x12 << 16) | __NR_##name); \
register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3)" \
: "=r" (__sc0) \
: "r" (__sc0), "r" (__sc2), "r" (__sc3) ); \
+__asm__ __volatile__ ("!dummy %0 %1 %2" \
+ : \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3) ); \
__syscall_return(type,__sc0); \
}
@@ -323,9 +337,12 @@
register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4)" \
: "=r" (__sc0) \
: "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); \
+__asm__ __volatile__ ("!dummy %0 %1 %2 %3" \
+ : \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); \
__syscall_return(type,__sc0); \
}
@@ -337,9 +354,12 @@
register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5)" \
: "=r" (__sc0) \
: "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5) );\
+__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4" \
+ : \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5) );\
__syscall_return(type,__sc0); \
}
@@ -352,9 +372,13 @@
register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5,%6)" \
: "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
+ "r" (__sc6)); \
+__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4 %5" \
+ : \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
"r" (__sc6)); \
__syscall_return(type,__sc0); \
}
@@ -369,9 +393,13 @@
register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
register unsigned long __sc7 __asm__ ("r7") = (unsigned long) arg6; \
-__asm__ __volatile__ ("trapa %1" \
+__asm__ __volatile__ ("trapa %1 !\t\t\t" #name "(%2,%3,%4,%5,%6,%7)" \
: "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
+ "r" (__sc6), "r" (__sc7)); \
+__asm__ __volatile__ ("!dummy %0 %1 %2 %3 %4 %5 %6" \
+ : \
+ : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
"r" (__sc6), "r" (__sc7)); \
__syscall_return(type,__sc0); \
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)