Date: Mon, 26 Mar 2012 21:47:06 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r233525 - head/sys/cddl/dev/dtrace/mips Message-ID: <201203262147.q2QLl6JE051617@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Mon Mar 26 21:47:06 2012 New Revision: 233525 URL: http://svn.freebsd.org/changeset/base/233525 Log: - For o32 ABI get arguments from the stack - Clear CPU_DTRACE_FAULT flag in userland backtrace routine. It just means we hit wrong memory region and should stop. Modified: head/sys/cddl/dev/dtrace/mips/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/mips/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/mips/dtrace_isa.c Mon Mar 26 21:31:57 2012 (r233524) +++ head/sys/cddl/dev/dtrace/mips/dtrace_isa.c Mon Mar 26 21:47:06 2012 (r233525) @@ -487,6 +487,19 @@ dtrace_next_frame(register_t *pc, regist *pc = ra; *sp += stksize; +#if defined(__mips_o32) + /* + * For MIPS32 fill out arguments 5..8 from the stack + */ + for (arg = 4; arg < 8; arg++) { + addr = (vm_offset_t)(*sp + arg*sizeof(register_t)); + if (args) + args[arg] = kdbpeekd((int *)addr); + if (valid_args) + valid_args[arg] = 1; + } +#endif + return (0); error: return (-1); @@ -501,6 +514,9 @@ dtrace_next_uframe(register_t *pc, regis int stksize; InstFmt i; + volatile uint16_t *flags = + (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; + registers_on_stack = 0; mask = 0; function_start = 0; @@ -510,6 +526,9 @@ dtrace_next_uframe(register_t *pc, regis while (offset < MAX_FUNCTION_SIZE) { opcode = dtrace_fuword32((void *)(vm_offset_t)(*pc - offset)); + if (*flags & CPU_DTRACE_FAULT) + goto fault; + /* [d]addiu sp, sp, -X*/ if (((opcode & 0xffff8000) == 0x27bd8000) || ((opcode & 0xffff8000) == 0x67bd8000)) { @@ -593,6 +612,9 @@ dtrace_next_uframe(register_t *pc, regis } offset += sizeof(int); + + if (*flags & CPU_DTRACE_FAULT) + goto fault; } } @@ -606,6 +628,12 @@ dtrace_next_uframe(register_t *pc, regis *sp += stksize; return (0); +fault: + /* + * We just got lost in backtrace, no big deal + */ + *flags &= ~CPU_DTRACE_FAULT; + return (-1); } static int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203262147.q2QLl6JE051617>