- 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.
This commit is contained in:
gonzo 2012-03-26 21:47:06 +00:00
parent 1a1c878591
commit 1aa843503d

View File

@ -487,6 +487,19 @@ dtrace_next_frame(register_t *pc, register_t *sp,
*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, register_t *sp, register_t *ra)
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, register_t *sp, register_t *ra)
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, register_t *sp, register_t *ra)
}
offset += sizeof(int);
if (*flags & CPU_DTRACE_FAULT)
goto fault;
}
}
@ -606,6 +628,12 @@ dtrace_next_uframe(register_t *pc, register_t *sp, register_t *ra)
*sp += stksize;
return (0);
fault:
/*
* We just got lost in backtrace, no big deal
*/
*flags &= ~CPU_DTRACE_FAULT;
return (-1);
}
static int