aboutsummaryrefslogtreecommitdiff
path: root/pk/mentry.S
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-11-16 14:02:07 -0800
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-11-16 14:02:07 -0800
commit197a8b81e4bbf61c497c93c0ac4630a33ab11b1c (patch)
tree27b984cf55295258d9ab31294402c66f328b53a4 /pk/mentry.S
parent47f9e06fc2c696dfb1054d730cde888f1ac75d07 (diff)
downloadpk-197a8b81e4bbf61c497c93c0ac4630a33ab11b1c.zip
pk-197a8b81e4bbf61c497c93c0ac4630a33ab11b1c.tar.gz
pk-197a8b81e4bbf61c497c93c0ac4630a33ab11b1c.tar.bz2
Use IPIs to wake up harts
This has the side effect of testing the IPI mechanism. Still not sure this is the best approach to booting, but it works...
Diffstat (limited to 'pk/mentry.S')
-rw-r--r--pk/mentry.S23
1 files changed, 10 insertions, 13 deletions
diff --git a/pk/mentry.S b/pk/mentry.S
index f26e2dd..26ed83c 100644
--- a/pk/mentry.S
+++ b/pk/mentry.S
@@ -175,23 +175,20 @@ mentry:
csrr a0, mhartid
bnez a0, .LmultiHart
- # boot hart 0
csrw mscratch, sp
- j machine_init
+ j init_first_hart
.LmultiHart:
- # mhartid may not be contiguous, so generate a hart id using AMOs
- la a0, num_harts_booted
- la a1, 1
- amoadd.w a0, a1, (a0)
-
- # allocate stack
- sll t0, a0, RISCV_PGSHIFT
- add sp, sp, t0
- csrw mscratch, sp
- # boot this hart
- j machine_init
+ # wait for IPI to signal that it's time to boot
+ wfi
+ csrr a0, mip
+ andi a0, a0, MIP_MSIP
+ beqz a0, .LmultiHart
+
+ fence
+ csrr sp, mscratch
+ j init_other_hart
.Linterrupt:
sll a0, a0, 1 # discard MSB