Date: Tue, 20 Oct 2009 23:13:08 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r198310 - in projects/mips/sys/mips: include mips Message-ID: <200910202313.n9KND8G0081111@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Tue Oct 20 23:13:08 2009 New Revision: 198310 URL: http://svn.freebsd.org/changeset/base/198310 Log: - Commit missing part of "bt" fix: store PC register in pcb_context struct in cpu_switch and use it in stack_trace function later. pcb_regs contains state of the process stored by exception handler and therefor is not valid for sleeping processes. Modified: projects/mips/sys/mips/include/pcb.h projects/mips/sys/mips/include/regnum.h projects/mips/sys/mips/mips/db_trace.c projects/mips/sys/mips/mips/swtch.S Modified: projects/mips/sys/mips/include/pcb.h ============================================================================== --- projects/mips/sys/mips/include/pcb.h Tue Oct 20 22:11:17 2009 (r198309) +++ projects/mips/sys/mips/include/pcb.h Tue Oct 20 23:13:08 2009 (r198310) @@ -50,7 +50,7 @@ struct pcb { struct trapframe pcb_regs; /* saved CPU and registers */ - __register_t pcb_context[13]; /* kernel context for resume */ + __register_t pcb_context[14]; /* kernel context for resume */ int pcb_onfault; /* for copyin/copyout faults */ }; @@ -70,6 +70,7 @@ struct pcb #define PCB_REG_RA 10 #define PCB_REG_SR 11 #define PCB_REG_GP 12 +#define PCB_REG_PC 13 #ifdef _KERNEL Modified: projects/mips/sys/mips/include/regnum.h ============================================================================== --- projects/mips/sys/mips/include/regnum.h Tue Oct 20 22:11:17 2009 (r198309) +++ projects/mips/sys/mips/include/regnum.h Tue Oct 20 23:13:08 2009 (r198310) @@ -63,8 +63,7 @@ #define PREG_RA 10 #define PREG_SR 11 #define PREG_GP 12 - - +#define PREG_PC 13 /* * Location of the saved registers relative to ZERO. Modified: projects/mips/sys/mips/mips/db_trace.c ============================================================================== --- projects/mips/sys/mips/mips/db_trace.c Tue Oct 20 22:11:17 2009 (r198309) +++ projects/mips/sys/mips/mips/db_trace.c Tue Oct 20 23:13:08 2009 (r198310) @@ -420,7 +420,7 @@ db_trace_thread(struct thread *thr, int else { ctx = thr->td_pcb; sp = (register_t)ctx->pcb_context[PREG_SP]; - pc = (register_t)ctx->pcb_regs.pc; + pc = (register_t)ctx->pcb_context[PREG_PC]; ra = (register_t)ctx->pcb_context[PREG_RA]; } Modified: projects/mips/sys/mips/mips/swtch.S ============================================================================== --- projects/mips/sys/mips/mips/swtch.S Tue Oct 20 22:11:17 2009 (r198309) +++ projects/mips/sys/mips/mips/swtch.S Tue Oct 20 23:13:08 2009 (r198310) @@ -313,6 +313,10 @@ NON_LEAF(cpu_switch, STAND_FRAME_SIZE, r SAVE_U_PCB_CONTEXT(ra, PREG_RA, a0) # save return address SAVE_U_PCB_CONTEXT(t0, PREG_SR, a0) # save status register SAVE_U_PCB_CONTEXT(gp, PREG_GP, a0) + jal getpc + nop +getpc: + SAVE_U_PCB_CONTEXT(ra, PREG_PC, a0) # save return address /* * FREEBSD_DEVELOPERS_FIXME: * In case there are CPU-specific registers that need
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910202313.n9KND8G0081111>