- 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.
This commit is contained in:
parent
344214e344
commit
55173ef287
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/mips/; revision=198310
@ -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
|
||||
|
@ -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.
|
||||
|
@ -420,7 +420,7 @@ db_trace_thread(struct thread *thr, int count)
|
||||
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];
|
||||
}
|
||||
|
||||
|
@ -313,6 +313,10 @@ NON_LEAF(cpu_switch, STAND_FRAME_SIZE, ra)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user