Index: configure.ac
===================================================================
RCS file: /cvsroot/strace/strace/configure.ac,v
retrieving revision 1.60
diff -u -r1.60 configure.ac
--- configure.ac	11 Feb 2009 03:03:28 -0000	1.60
+++ configure.ac	25 Feb 2009 13:02:06 -0000
@@ -107,6 +107,14 @@
 	arch=x86_64
 	AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.])
 	;;
+cris|crisv10)
+	arch=crisv10
+	AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
+	;;
+crisv32)
+	arch=crisv32
+	AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
+	;;
 *)
 	AC_MSG_RESULT([NO!])
 	AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
Index: process.c
===================================================================
RCS file: /cvsroot/strace/strace/process.c,v
retrieving revision 1.131
diff -u -r1.131 process.c
--- process.c	24 Feb 2009 15:17:53 -0000	1.131
+++ process.c	25 Feb 2009 13:02:07 -0000
@@ -604,7 +604,7 @@
 #  define ARG_PTID	(known_scno(tcp) == SYS_clone2 ? 3 : 2)
 #  define ARG_CTID	(known_scno(tcp) == SYS_clone2 ? 4 : 3)
 #  define ARG_TLS	(known_scno(tcp) == SYS_clone2 ? 5 : 4)
-# elif defined S390 || defined S390X
+# elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
 #  define ARG_STACK	0
 #  define ARG_FLAGS	1
 #  define ARG_PTID	2
@@ -765,6 +765,10 @@
 				0x100000 | new) < 0)
 		return -1;
 	return 0;
+#elif defined(CRISV10) || defined(CRISV32)
+	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_R9), new) < 0)
+		return -1;
+	return 0;
 #elif defined(ARM)
 	/* Some kernels support this, some (pre-2.6.16 or so) don't.  */
 # ifndef PTRACE_SET_SYSCALL
@@ -3059,8 +3063,77 @@
 	{ 69,			"fpcsr"					},
 	{ 70,			"fpeir"					},
 #   endif
-
-#   if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) && !defined(ALPHA) && !defined(IA64)
+#ifdef CRISV10
+	{ 4*PT_FRAMETYPE, "4*PT_FRAMETYPE" },
+	{ 4*PT_ORIG_R10, "4*PT_ORIG_R10" },
+	{ 4*PT_R13, "4*PT_R13" },
+	{ 4*PT_R12, "4*PT_R12" },
+	{ 4*PT_R11, "4*PT_R11" },
+	{ 4*PT_R10, "4*PT_R10" },
+	{ 4*PT_R9, "4*PT_R9" },
+	{ 4*PT_R8, "4*PT_R8" },
+	{ 4*PT_R7, "4*PT_R7" },
+	{ 4*PT_R6, "4*PT_R6" },
+	{ 4*PT_R5, "4*PT_R5" },
+	{ 4*PT_R4, "4*PT_R4" },
+	{ 4*PT_R3, "4*PT_R3" },
+	{ 4*PT_R2, "4*PT_R2" },
+	{ 4*PT_R1, "4*PT_R1" },
+	{ 4*PT_R0, "4*PT_R0" },
+	{ 4*PT_MOF, "4*PT_MOF" },
+	{ 4*PT_DCCR, "4*PT_DCCR" },
+	{ 4*PT_SRP, "4*PT_SRP" },
+	{ 4*PT_IRP, "4*PT_IRP" },
+	{ 4*PT_CSRINSTR, "4*PT_CSRINSTR" },
+	{ 4*PT_CSRADDR, "4*PT_CSRADDR" },
+	{ 4*PT_CSRDATA, "4*PT_CSRDATA" },
+	{ 4*PT_USP, "4*PT_USP" },
+#endif
+#ifdef CRISV32
+	{ 4*PT_ORIG_R10, "4*PT_ORIG_R10" },
+	{ 4*PT_R0, "4*PT_R0" },
+	{ 4*PT_R1, "4*PT_R1" },
+	{ 4*PT_R2, "4*PT_R2" },
+	{ 4*PT_R3, "4*PT_R3" },
+	{ 4*PT_R4, "4*PT_R4" },
+	{ 4*PT_R5, "4*PT_R5" },
+	{ 4*PT_R6, "4*PT_R6" },
+	{ 4*PT_R7, "4*PT_R7" },
+	{ 4*PT_R8, "4*PT_R8" },
+	{ 4*PT_R9, "4*PT_R9" },
+	{ 4*PT_R10, "4*PT_R10" },
+	{ 4*PT_R11, "4*PT_R11" },
+	{ 4*PT_R12, "4*PT_R12" },
+	{ 4*PT_R13, "4*PT_R13" },
+	{ 4*PT_ACR, "4*PT_ACR" },
+	{ 4*PT_SRS, "4*PT_SRS" },
+	{ 4*PT_MOF, "4*PT_MOF" },
+	{ 4*PT_SPC, "4*PT_SPC" },        
+	{ 4*PT_CCS, "4*PT_CCS" },
+	{ 4*PT_SRP, "4*PT_SRP" },
+	{ 4*PT_ERP, "4*PT_ERP" },
+	{ 4*PT_EXS, "4*PT_EXS" },
+	{ 4*PT_EDA, "4*PT_EDA" },
+	{ 4*PT_USP, "4*PT_USP" },
+	{ 4*PT_PPC, "4*PT_PPC" },
+	{ 4*PT_BP_CTRL, "4*PT_BP_CTRL" },
+	{ 4*PT_BP+4, "4*PT_BP+4" },
+	{ 4*PT_BP+8, "4*PT_BP+8" },
+	{ 4*PT_BP+12, "4*PT_BP+12" },
+	{ 4*PT_BP+16, "4*PT_BP+16" },
+	{ 4*PT_BP+20, "4*PT_BP+20" },
+	{ 4*PT_BP+24, "4*PT_BP+24" },
+	{ 4*PT_BP+28, "4*PT_BP+28" },
+	{ 4*PT_BP+32, "4*PT_BP+32" },
+	{ 4*PT_BP+36, "4*PT_BP+36" },
+	{ 4*PT_BP+40, "4*PT_BP+40" },
+	{ 4*PT_BP+44, "4*PT_BP+44" },
+	{ 4*PT_BP+48, "4*PT_BP+48" },
+	{ 4*PT_BP+52, "4*PT_BP+52" },
+	{ 4*PT_BP+56, "4*PT_BP+56" },
+#endif
+ 
+#   if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) && !defined(ALPHA) && !defined(IA64) && !defined(CRISV10) && !defined(CRISV32)
 #    if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(BFIN)
 	{ uoff(u_fpvalid),	"offsetof(struct user, u_fpvalid)"	},
 #    endif
@@ -3097,7 +3170,7 @@
 #    if defined(I386) || defined(X86_64)
 	{ uoff(u_debugreg),	"offsetof(struct user, u_debugreg)"	},
 #    endif
-#   endif /* !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) && !defined(ALPHA) && !defined(IA64) */
+#   endif /* !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) && !defined(ALPHA) && !defined(IA64) && !defined(CRISV10) && !defined(CRISV32) */
 
 #  endif /* LINUX */
 
Index: signal.c
===================================================================
RCS file: /cvsroot/strace/strace/signal.c,v
retrieving revision 1.75
diff -u -r1.75 signal.c
--- signal.c	24 Feb 2009 15:17:53 -0000	1.75
+++ signal.c	25 Feb 2009 13:02:07 -0000
@@ -1485,9 +1485,38 @@
 	}
 	return 0;
 #else
+#if defined(CRISV10) || defined(CRISV32)
+	struct sigcontext sc;
+	
+	if (entering(tcp)) {
+		long regs[PT_MAX+1];
+		
+		tcp->u_arg[0] = 0;
+		
+		if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
+			perror("sigreturn: PTRACE_GETREGS");
+			return 0;
+		}
+		if (umove(tcp, regs[PT_USP], &sc) < 0)
+			return 0;
+		tcp->u_arg[0] = 1;
+		tcp->u_arg[1] = sc.oldmask;
+	} else {
+		sigset_t sigm;
+		long_to_sigset(tcp->u_arg[1], &sigm);
+		tcp->u_rval = tcp->u_error = 0;
+		
+		if (tcp->u_arg[0] == 0)
+			return 0;
+		tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
+		return RVAL_NONE | RVAL_STR;
+	}
+	return 0;
+#else
 #warning No sys_sigreturn() for this architecture
 #warning         (no problem, just a reminder :-)
 	return 0;
+#endif /* !CRISV10/!CRISV32 */
 #endif /* MIPS */
 #endif /* LINUX_MIPSN32 || LINUX_MIPSN64 */
 #endif /* SPARC || SPARC64 */
Index: syscall.c
===================================================================
RCS file: /cvsroot/strace/strace/syscall.c,v
retrieving revision 1.110
diff -u -r1.110 syscall.c
--- syscall.c	24 Feb 2009 15:17:53 -0000	1.110
+++ syscall.c	25 Feb 2009 13:02:07 -0000
@@ -774,6 +774,8 @@
 	static long r9;
 #elif defined(X86_64)
 	static long rax;
+#elif defined(CRISV10) || defined(CRISV32)
+	static long r10;
 #endif
 #endif /* LINUX */
 #ifdef FREEBSD
@@ -1295,6 +1297,9 @@
 			return 0;
 		}
 	}
+#elif defined(CRISV10) || defined(CRISV32)
+	if (upeek(tcp, 4*PT_R9, &scno) < 0)
+		return -1;
 #endif /* SH64 */
 #endif /* LINUX */
 #ifdef SUNOS4
@@ -1498,6 +1503,14 @@
 			fprintf(stderr, "stray syscall exit: r8 = %ld\n", r8);
 		return 0;
 	}
+#elif defined(CRISV10) || defined(CRISV32)
+	if (upeek(tcp->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;
@@ -1688,6 +1701,17 @@
 			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 */
@@ -2227,6 +2251,23 @@
 				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(tcp->pid, crisregs[i], &tcp->u_arg[i]) < 0)
+				return -1;
+		}
+	}
 #else /* Other architecture (like i386) (32bits specific) */
 	{
 		int i;
Index: util.c
===================================================================
RCS file: /cvsroot/strace/strace/util.c,v
retrieving revision 1.89
diff -u -r1.89 util.c
--- util.c	24 Feb 2009 15:17:53 -0000	1.89
+++ util.c	25 Feb 2009 13:02:07 -0000
@@ -1342,6 +1342,22 @@
 		return;
 	}
 	tprintf("[%08lx] ", pc);
+#elif defined(CRISV10)
+	long pc;
+	
+	if (upeek(tcp->pid, 4*PT_IRP, &pc) < 0) {
+		PRINTBADPC;
+		return;
+	}
+	tprintf("[%08lx] ", pc);
+#elif defined(CRISV32)
+	long pc;
+	
+	if (upeek(tcp->pid, 4*PT_ERP, &pc) < 0) {
+		PRINTBADPC;
+		return;
+	}
+	tprintf("[%08lx] ", pc);
 # endif /* architecture */
 #endif /* LINUX */
 
@@ -1545,6 +1561,13 @@
 #    define arg0_offset   (REG_OFFSET+16)
 #    define arg1_offset   (REG_OFFSET+24)
 #    define restore_arg0(tcp, state, val) 0
+#   elif defined CRISV10 || defined CRISV32
+#    define arg0_offset   (4*PT_R11)
+#    define arg1_offset   (4*PT_ORIG_R10)
+#    define restore_arg0(tcp, state, val) 0
+#    define restore_arg1(tcp, state, val) 0
+#    define arg0_index   1
+#    define arg1_index   0
 #   else
 #    define arg0_offset	0
 #    define arg1_offset	4
