aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv/riscv
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2019-12-30 17:18:50 +0000
committerRuslan Bukin <br@FreeBSD.org>2019-12-30 17:18:50 +0000
commitc5ccc92c416a32ca6e0092b0c8113bd9309743b9 (patch)
treee7561353d3ada94ff2b4d7a6be00ee58c979e60b /sys/riscv/riscv
parentf930f30f60d479d8a1773571fc6426d01eeeef76 (diff)
downloadsrc-c5ccc92c416a32ca6e0092b0c8113bd9309743b9.tar.gz
src-c5ccc92c416a32ca6e0092b0c8113bd9309743b9.zip
Don't hard-code field offsets of struct riscv_bootparams.
Submitted by: James Clarke <jrtc27@jrtc27.com> Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22970
Notes
Notes: svn path=/head/; revision=356205
Diffstat (limited to 'sys/riscv/riscv')
-rw-r--r--sys/riscv/riscv/genassym.c6
-rw-r--r--sys/riscv/riscv/locore.S10
2 files changed, 11 insertions, 5 deletions
diff --git a/sys/riscv/riscv/genassym.c b/sys/riscv/riscv/genassym.c
index 319b7b67aa37..c0c93e5d785c 100644
--- a/sys/riscv/riscv/genassym.c
+++ b/sys/riscv/riscv/genassym.c
@@ -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));
diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S
index a1ec86243adf..55e09e5e061b 100644
--- a/sys/riscv/riscv/locore.S
+++ b/sys/riscv/riscv/locore.S
@@ -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 */