Author: jhb Date: Thu Jan 30 19:15:27 2020 New Revision: 357305 URL: https://svnweb.freebsd.org/changeset/base/357305
Log: 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 Modified: head/sys/riscv/include/db_machdep.h head/sys/riscv/include/pcb.h head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/include/db_machdep.h ============================================================================== --- head/sys/riscv/include/db_machdep.h Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/include/db_machdep.h Thu Jan 30 19:15:27 2020 (r357305) @@ -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) Modified: head/sys/riscv/include/pcb.h ============================================================================== --- head/sys/riscv/include/pcb.h Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/include/pcb.h Thu Jan 30 19:15:27 2020 (r357305) @@ -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 */ }; Modified: head/sys/riscv/riscv/genassym.c ============================================================================== --- head/sys/riscv/riscv/genassym.c Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/riscv/genassym.c Thu Jan 30 19:15:27 2020 (r357305) @@ -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)); Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Thu Jan 30 18:49:19 2020 (r357304) +++ head/sys/riscv/riscv/machdep.c Thu Jan 30 19:15:27 2020 (r357305) @@ -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 _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"