cpu/vexriscv_smp: move smp_slave to crt0. Fixes bare metal demo compilation with VexRiscv-SMP.
This commit is contained in:
parent
4f6bc32a5a
commit
0cba91022e
|
@ -3,7 +3,6 @@
|
|||
.global smp_lottery_target
|
||||
.global smp_lottery_lock
|
||||
.global smp_lottery_args
|
||||
.global smp_slave
|
||||
|
||||
boot_helper:
|
||||
sw x10, smp_lottery_args , x14
|
||||
|
@ -14,16 +13,3 @@ boot_helper:
|
|||
li x15, 1
|
||||
sw x15, smp_lottery_lock, x14
|
||||
jr x13
|
||||
|
||||
smp_slave:
|
||||
lw a0, smp_lottery_lock
|
||||
beqz a0, smp_slave
|
||||
fence r, r
|
||||
|
||||
.word(0x100F) //i$ flush
|
||||
lw x10, smp_lottery_args
|
||||
lw x11, smp_lottery_args+4
|
||||
lw x12, smp_lottery_args+8
|
||||
lw x13, smp_lottery_target
|
||||
jr x13
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ trap_entry:
|
|||
addi sp,sp,16*4
|
||||
mret
|
||||
.text
|
||||
|
||||
|
||||
crt_init:
|
||||
la sp, _fstack + 4
|
||||
la a0, trap_entry
|
||||
csrw mtvec, a0
|
||||
sw x0, smp_lottery_lock, a1
|
||||
|
||||
|
||||
data_init:
|
||||
la a0, _fdata
|
||||
la a1, _edata
|
||||
|
@ -75,13 +75,23 @@ data_loop:
|
|||
add a2,a2,4
|
||||
j data_loop
|
||||
data_done:
|
||||
|
||||
|
||||
smp_tyranny:
|
||||
csrr a0, mhartid
|
||||
beqz a0, bss_init
|
||||
call smp_slave
|
||||
|
||||
smp_slave:
|
||||
lw a0, smp_lottery_lock
|
||||
beqz a0, smp_slave
|
||||
fence r, r
|
||||
|
||||
.word(0x100F) //i$ flush
|
||||
lw x10, smp_lottery_args
|
||||
lw x11, smp_lottery_args+4
|
||||
lw x12, smp_lottery_args+8
|
||||
lw x13, smp_lottery_target
|
||||
jr x13
|
||||
|
||||
bss_init:
|
||||
la a0, _fbss
|
||||
|
|
|
@ -18,7 +18,7 @@ demo.elf: $(OBJECTS)
|
|||
$(LD) $(LDFLAGS) \
|
||||
-T linker.ld \
|
||||
-N -o $@ \
|
||||
$(BUILD_DIR)/software/libbase/crt0.o \
|
||||
$(BUILD_DIR)/software/libbase/crt0.o \
|
||||
$(OBJECTS) \
|
||||
-L$(BUILD_DIR)/software/libbase \
|
||||
-L$(BUILD_DIR)/software/libcompiler_rt \
|
||||
|
|
Loading…
Reference in New Issue