summaryrefslogtreecommitdiff
path: root/package/strace/patches/patch-syscall_c
diff options
context:
space:
mode:
authorwbx <wbx@hydrogenium.(none)>2009-05-17 14:41:34 +0200
committerwbx <wbx@hydrogenium.(none)>2009-05-17 14:41:34 +0200
commit219a6dab8995aad9ac4860cc1a84d6f3509a03a4 (patch)
treeb9c0f3c43aebba2fcfef777592d0add39f2072f4 /package/strace/patches/patch-syscall_c
Initial import
Diffstat (limited to 'package/strace/patches/patch-syscall_c')
-rw-r--r--package/strace/patches/patch-syscall_c81
1 files changed, 81 insertions, 0 deletions
diff --git a/package/strace/patches/patch-syscall_c b/package/strace/patches/patch-syscall_c
new file mode 100644
index 000000000..700d9be09
--- /dev/null
+++ b/package/strace/patches/patch-syscall_c
@@ -0,0 +1,81 @@
+$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
+--- strace-4.5.18.orig/syscall.c 2008-08-25 05:16:26.000000000 +0200
++++ strace-4.5.18/syscall.c 2009-01-02 21:24:05.514097112 +0100
+@@ -772,6 +772,8 @@ internal_syscall(struct tcb *tcp)
+ static long r9;
+ #elif defined(X86_64)
+ static long rax;
++#elif defined(CRISV10) || defined(CRISV32)
++ static long r10;
+ #endif
+ #endif /* LINUX */
+ #ifdef FREEBSD
+@@ -1273,7 +1275,10 @@ struct tcb *tcp;
+ return 0;
+ }
+ }
+-#endif /* SH64 */
++#elif defined(CRISV10) || defined(CRISV32)
++ if (upeek(pid, 4*PT_R9, &scno) < 0)
++ return -1;
++#endif /* CRISV10/CRISV32 */
+ #endif /* LINUX */
+ #ifdef SUNOS4
+ if (upeek(pid, uoff(u_arg[7]), &scno) < 0)
+@@ -1468,6 +1473,14 @@ struct tcb *tcp;
+ fprintf(stderr, "stray syscall exit: r8 = %ld\n", r8);
+ return 0;
+ }
++#elif defined(CRISV10) || defined(CRISV32)
++ if (upeek(pid, 4*PT_R10, &r10) < 0)
++ return -1;
++ if (r10 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
++ if (debug)
++ fprintf(stderr, "stray syscall exit: r10 = %ld\n", r10);
++ return 0;
++ }
+ #endif
+ #endif /* LINUX */
+ return 1;
+@@ -1649,6 +1662,17 @@ struct tcb *tcp;
+ tcp->u_rval = r9;
+ u_error = 0;
+ }
++#else
++#if defined(CRISV10) || defined(CRISV32)
++ if (r10 && (unsigned) -r10 < nerrnos) {
++ tcp->u_rval = -1;
++ u_error = -r10;
++ }
++ else {
++ tcp->u_rval = r10;
++ u_error = 0;
++ }
++#endif /* CRISV10/CRISV32 */
+ #endif /* SH64 */
+ #endif /* SH */
+ #endif /* HPPA */
+@@ -2169,6 +2193,23 @@ struct tcb *tcp;
+ return -1;
+ }
+ }
++#elif defined(CRISV10) || defined(CRISV32)
++ {
++ int i;
++ static const int crisregs[] = {
++ 4*PT_ORIG_R10, 4*PT_R11, 4*PT_R12,
++ 4*PT_R13, 4*PT_MOF, 4*PT_SRP
++ };
++
++ if (tcp->scno >= 0 && tcp->scno < nsyscalls)
++ tcp->u_nargs = sysent[tcp->scno].nargs;
++ else
++ tcp->u_nargs = 0;
++ for (i = 0; i < tcp->u_nargs; i++) {
++ if (upeek(pid, crisregs[i], &tcp->u_arg[i]) < 0)
++ return -1;
++ }
++ }
+ #else /* Other architecture (like i386) (32bits specific) */
+ {
+ int i;