strace for powerpc

Peter Grehan grehan at freebsd.org
Wed Nov 30 05:47:24 GMT 2005


Hi Arun,

> Couple of things that I noticed aren't working well:
> 
> - when a system call fails, the return value and the error code are wrong.

  You may want to test for the presence of the high bit in the CR rather 
than equality

i.e.

+#elif defined(POWERPC)
+		if ((regs.cr & 0x10000000) == 0x10000000) {
+ 		        tcp->u_rval = -1;
+		        u_error = regs.fixreg[FIRSTARG];

  Also, the value should be OR'd to the CR instead of assigned:

+	if (error) {
+		regs.cr |= 0x10000000;
+		regs.fixreg[FIRSTARG] = error;

> - I'm not sure if frame.lr is the equivalent of regs.r_eip on i386. From 
> the powerpc manuals, it looks like SRR0 contains the address where the 
> syscall would return to.

  Yep, that's correct for the syscall exception.

later,

Peter.


More information about the freebsd-ppc mailing list