Remove unused fields from struct pcb.

cpu_switch/throw() and savectx() do not save or restore any values in
these fields which mostly held non-callee-save registers.

makectx() copied these fields from kdb_frame, but they weren't used
except for PC_REGS using pcb_sepc.  Change PC_REGS to use
kdb_frame->tf_sepc directly instead.

Reviewed by:	br
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23395
This commit is contained in:
John Baldwin 2020-01-30 19:15:27 +00:00
parent 9c7eb5ca62
commit 0317861660
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357305
4 changed files with 1 additions and 9 deletions

View File

@ -47,7 +47,7 @@
typedef vm_offset_t db_addr_t;
typedef long db_expr_t;
#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_sepc)
#define PC_REGS() ((db_addr_t)kdb_frame->tf_sepc)
#define BKPT_INST (0x00100073)
#define BKPT_SIZE (INSN_SIZE)

View File

@ -46,15 +46,12 @@ struct pcb {
uint64_t pcb_sp; /* Stack pointer */
uint64_t pcb_gp; /* Global pointer */
uint64_t pcb_tp; /* Thread pointer */
uint64_t pcb_t[7]; /* Temporary registers */
uint64_t pcb_s[12]; /* Saved registers */
uint64_t pcb_a[8]; /* Argument registers */
uint64_t pcb_x[32][2]; /* Floating point registers */
uint64_t pcb_fcsr; /* Floating point control reg */
uint64_t pcb_fpflags; /* Floating point flags */
#define PCB_FP_STARTED 0x1
#define PCB_FP_USERMASK 0x1
uint64_t pcb_sepc; /* Supervisor exception pc */
vm_offset_t pcb_onfault; /* Copyinout fault handler */
};

View File

@ -69,9 +69,7 @@ ASSYM(PCB_RA, offsetof(struct pcb, pcb_ra));
ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
ASSYM(PCB_GP, offsetof(struct pcb, pcb_gp));
ASSYM(PCB_TP, offsetof(struct pcb, pcb_tp));
ASSYM(PCB_T, offsetof(struct pcb, pcb_t));
ASSYM(PCB_S, offsetof(struct pcb, pcb_s));
ASSYM(PCB_A, offsetof(struct pcb, pcb_a));
ASSYM(PCB_X, offsetof(struct pcb, pcb_x));
ASSYM(PCB_FCSR, offsetof(struct pcb, pcb_fcsr));

View File

@ -558,15 +558,12 @@ void
makectx(struct trapframe *tf, struct pcb *pcb)
{
memcpy(pcb->pcb_t, tf->tf_t, sizeof(tf->tf_t));
memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s));
memcpy(pcb->pcb_a, tf->tf_a, sizeof(tf->tf_a));
pcb->pcb_ra = tf->tf_ra;
pcb->pcb_sp = tf->tf_sp;
pcb->pcb_gp = tf->tf_gp;
pcb->pcb_tp = tf->tf_tp;
pcb->pcb_sepc = tf->tf_sepc;
}
void