Changeset View
Changeset View
Standalone View
Standalone View
head/sys/riscv/riscv/locore.S
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | _start: | ||||
* a0 = hart id | * a0 = hart id | ||||
* a1 = dtbp | * a1 = dtbp | ||||
*/ | */ | ||||
/* Pick a hart to run the boot process. */ | /* Pick a hart to run the boot process. */ | ||||
la t0, hart_lottery | la t0, hart_lottery | ||||
li t1, 1 | li t1, 1 | ||||
amoadd.w t0, t1, 0(t0) | amoadd.w t0, t1, 0(t0) | ||||
bnez t0, mpentry | |||||
/* | /* | ||||
* Page tables | * We must jump to mpentry in the non-BSP case because the offset is | ||||
* too large to fit in a 12-bit branch immediate. | |||||
*/ | */ | ||||
beqz t0, 1f | |||||
j mpentry | |||||
/* | |||||
* Page tables | |||||
*/ | |||||
1: | |||||
/* Add L1 entry for kernel */ | /* Add L1 entry for kernel */ | ||||
la s1, pagetable_l1 | la s1, pagetable_l1 | ||||
la s2, pagetable_l2 /* Link to next level PN */ | la s2, pagetable_l2 /* Link to next level PN */ | ||||
srli s2, s2, PAGE_SHIFT | srli s2, s2, PAGE_SHIFT | ||||
li a5, KERNBASE | li a5, KERNBASE | ||||
srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ | srli a5, a5, L1_SHIFT /* >> L1_SHIFT */ | ||||
andi a5, a5, 0x1ff /* & 0x1ff */ | andi a5, a5, 0x1ff /* & 0x1ff */ | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |