svn commit: r360856 - in stable/12/sys/riscv: include riscv

John Baldwin jhb at FreeBSD.org
Sat May 9 21:32:45 UTC 2020


Author: jhb
Date: Sat May  9 21:32:44 2020
New Revision: 360856
URL: https://svnweb.freebsd.org/changeset/base/360856

Log:
  MFC 357305: 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.

Modified:
  stable/12/sys/riscv/include/db_machdep.h
  stable/12/sys/riscv/include/pcb.h
  stable/12/sys/riscv/riscv/genassym.c
  stable/12/sys/riscv/riscv/machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/riscv/include/db_machdep.h
==============================================================================
--- stable/12/sys/riscv/include/db_machdep.h	Sat May  9 20:14:05 2020	(r360855)
+++ stable/12/sys/riscv/include/db_machdep.h	Sat May  9 21:32:44 2020	(r360856)
@@ -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: stable/12/sys/riscv/include/pcb.h
==============================================================================
--- stable/12/sys/riscv/include/pcb.h	Sat May  9 20:14:05 2020	(r360855)
+++ stable/12/sys/riscv/include/pcb.h	Sat May  9 21:32:44 2020	(r360856)
@@ -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: stable/12/sys/riscv/riscv/genassym.c
==============================================================================
--- stable/12/sys/riscv/riscv/genassym.c	Sat May  9 20:14:05 2020	(r360855)
+++ stable/12/sys/riscv/riscv/genassym.c	Sat May  9 21:32:44 2020	(r360856)
@@ -68,9 +68,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: stable/12/sys/riscv/riscv/machdep.c
==============================================================================
--- stable/12/sys/riscv/riscv/machdep.c	Sat May  9 20:14:05 2020	(r360855)
+++ stable/12/sys/riscv/riscv/machdep.c	Sat May  9 21:32:44 2020	(r360856)
@@ -556,15 +556,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


More information about the svn-src-stable mailing list