svn commit: r356205 - head/sys/riscv/riscv

Ruslan Bukin br at FreeBSD.org
Mon Dec 30 17:18:51 UTC 2019


Author: br
Date: Mon Dec 30 17:18:50 2019
New Revision: 356205
URL: https://svnweb.freebsd.org/changeset/base/356205

Log:
  Don't hard-code field offsets of struct riscv_bootparams.
  
  Submitted by:	James Clarke <jrtc27 at jrtc27.com>
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D22970

Modified:
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/locore.S

Modified: head/sys/riscv/riscv/genassym.c
==============================================================================
--- head/sys/riscv/riscv/genassym.c	Mon Dec 30 15:54:36 2019	(r356204)
+++ head/sys/riscv/riscv/genassym.c	Mon Dec 30 17:18:50 2019	(r356205)
@@ -101,3 +101,9 @@ ASSYM(TF_SCAUSE, offsetof(struct trapframe, tf_scause)
 ASSYM(TF_SSTATUS, offsetof(struct trapframe, tf_sstatus));
 
 ASSYM(RISCV_BOOTPARAMS_SIZE, sizeof(struct riscv_bootparams));
+ASSYM(RISCV_BOOTPARAMS_KERN_L1PT, offsetof(struct riscv_bootparams, kern_l1pt));
+ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct riscv_bootparams, kern_phys));
+ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams,
+    kern_stack));
+ASSYM(RISCV_BOOTPARAMS_DTBP_VIRT, offsetof(struct riscv_bootparams, dtbp_virt));
+ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, dtbp_phys));

Modified: head/sys/riscv/riscv/locore.S
==============================================================================
--- head/sys/riscv/riscv/locore.S	Mon Dec 30 15:54:36 2019	(r356204)
+++ head/sys/riscv/riscv/locore.S	Mon Dec 30 17:18:50 2019	(r356205)
@@ -206,15 +206,15 @@ va:
 
 	/* Fill riscv_bootparams */
 	la	t0, pagetable_l1
-	sd	t0, 0(sp) /* kern_l1pt */
-	sd	s9, 8(sp) /* kern_phys */
+	sd	t0, RISCV_BOOTPARAMS_KERN_L1PT(sp)
+	sd	s9, RISCV_BOOTPARAMS_KERN_PHYS(sp)
 
 	la	t0, initstack
-	sd	t0, 16(sp) /* kern_stack */
+	sd	t0, RISCV_BOOTPARAMS_KERN_STACK(sp)
 
 	li	t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE)
-	sd	t0, 24(sp) /* dtbp_virt */
-	sd	a1, 32(sp) /* dtbp_phys */
+	sd	t0, RISCV_BOOTPARAMS_DTBP_VIRT(sp)
+	sd	a1, RISCV_BOOTPARAMS_DTBP_PHYS(sp)
 
 	mv	a0, sp
 	call	_C_LABEL(initriscv)	/* Off we go */


More information about the svn-src-head mailing list