simplify start.s

This commit is contained in:
ccckmit
2023-05-24 11:38:59 +08:00
parent b69981d0e1
commit 873150ceb9
9 changed files with 45 additions and 143 deletions

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,24 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #

View File

@@ -3,32 +3,14 @@
.global _start .global _start
_start: _start:
# setup stacks per hart csrr a0, mhartid #
csrr t0, mhartid # read current hart id bnez a0, park # 0 park
slli t0, t0, 10 # shift left the hart id by 1024 la sp, stacks + STACK_SIZE # 0
la sp, stacks + STACK_SIZE # set the initial stack pointer j os_main # 0 os_main
# to the end of the stack space
add sp, sp, t0 # move the current hart stack pointer
# to its place in the stack space
# park harts with id != 0
csrr a0, mhartid # read current hart id
bnez a0, park # if we're not on the hart 0
# li t0, 1 << 7
# li t0, 0xffffffff
# csrw pmpaddr0, t0
# li t0, 0xf
# csrw pmpcfg0, t0
# csrr a1, mstatus
# or t0, t0, a1
# csrw mstatus, t0
# we park the hart
j os_main # hart 0 jump to c
park: park:
wfi wfi
j park j park
stacks: stacks:
.skip STACK_SIZE * 4 # allocate space for the harts stacks .skip STACK_SIZE #