1
0

patch-syscall_c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
  2. --- strace-4.5.18.orig/syscall.c 2008-08-25 05:16:26.000000000 +0200
  3. +++ strace-4.5.18/syscall.c 2009-01-02 21:24:05.514097112 +0100
  4. @@ -772,6 +772,8 @@ internal_syscall(struct tcb *tcp)
  5. static long r9;
  6. #elif defined(X86_64)
  7. static long rax;
  8. +#elif defined(CRISV10) || defined(CRISV32)
  9. + static long r10;
  10. #endif
  11. #endif /* LINUX */
  12. #ifdef FREEBSD
  13. @@ -1273,7 +1275,10 @@ struct tcb *tcp;
  14. return 0;
  15. }
  16. }
  17. -#endif /* SH64 */
  18. +#elif defined(CRISV10) || defined(CRISV32)
  19. + if (upeek(pid, 4*PT_R9, &scno) < 0)
  20. + return -1;
  21. +#endif /* CRISV10/CRISV32 */
  22. #endif /* LINUX */
  23. #ifdef SUNOS4
  24. if (upeek(pid, uoff(u_arg[7]), &scno) < 0)
  25. @@ -1468,6 +1473,14 @@ struct tcb *tcp;
  26. fprintf(stderr, "stray syscall exit: r8 = %ld\n", r8);
  27. return 0;
  28. }
  29. +#elif defined(CRISV10) || defined(CRISV32)
  30. + if (upeek(pid, 4*PT_R10, &r10) < 0)
  31. + return -1;
  32. + if (r10 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) {
  33. + if (debug)
  34. + fprintf(stderr, "stray syscall exit: r10 = %ld\n", r10);
  35. + return 0;
  36. + }
  37. #endif
  38. #endif /* LINUX */
  39. return 1;
  40. @@ -1649,6 +1662,17 @@ struct tcb *tcp;
  41. tcp->u_rval = r9;
  42. u_error = 0;
  43. }
  44. +#else
  45. +#if defined(CRISV10) || defined(CRISV32)
  46. + if (r10 && (unsigned) -r10 < nerrnos) {
  47. + tcp->u_rval = -1;
  48. + u_error = -r10;
  49. + }
  50. + else {
  51. + tcp->u_rval = r10;
  52. + u_error = 0;
  53. + }
  54. +#endif /* CRISV10/CRISV32 */
  55. #endif /* SH64 */
  56. #endif /* SH */
  57. #endif /* HPPA */
  58. @@ -2169,6 +2193,23 @@ struct tcb *tcp;
  59. return -1;
  60. }
  61. }
  62. +#elif defined(CRISV10) || defined(CRISV32)
  63. + {
  64. + int i;
  65. + static const int crisregs[] = {
  66. + 4*PT_ORIG_R10, 4*PT_R11, 4*PT_R12,
  67. + 4*PT_R13, 4*PT_MOF, 4*PT_SRP
  68. + };
  69. +
  70. + if (tcp->scno >= 0 && tcp->scno < nsyscalls)
  71. + tcp->u_nargs = sysent[tcp->scno].nargs;
  72. + else
  73. + tcp->u_nargs = 0;
  74. + for (i = 0; i < tcp->u_nargs; i++) {
  75. + if (upeek(pid, crisregs[i], &tcp->u_arg[i]) < 0)
  76. + return -1;
  77. + }
  78. + }
  79. #else /* Other architecture (like i386) (32bits specific) */
  80. {
  81. int i;