diff --git a/code/os/05-traps/start.S b/code/os/05-traps/start.S index c7ad5e4fa7cf5d5055508a12a385d5571dae3f96..7c19fa8adb6078030d98f30964ecf74ef9b4dd73 100644 --- a/code/os/05-traps/start.S +++ b/code/os/05-traps/start.S @@ -30,12 +30,18 @@ _start: add sp, sp, t0 # move the current hart stack pointer # to its place in the stack space + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks diff --git a/code/os/06-interrupts/start.S b/code/os/06-interrupts/start.S index c7ad5e4fa7cf5d5055508a12a385d5571dae3f96..7c19fa8adb6078030d98f30964ecf74ef9b4dd73 100644 --- a/code/os/06-interrupts/start.S +++ b/code/os/06-interrupts/start.S @@ -30,12 +30,18 @@ _start: add sp, sp, t0 # move the current hart stack pointer # to its place in the stack space + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks diff --git a/code/os/07-hwtimer/start.S b/code/os/07-hwtimer/start.S index c7ad5e4fa7cf5d5055508a12a385d5571dae3f96..7c19fa8adb6078030d98f30964ecf74ef9b4dd73 100644 --- a/code/os/07-hwtimer/start.S +++ b/code/os/07-hwtimer/start.S @@ -30,12 +30,18 @@ _start: add sp, sp, t0 # move the current hart stack pointer # to its place in the stack space + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks diff --git a/code/os/08-preemptive/start.S b/code/os/08-preemptive/start.S index 0b730a9fe88869d4424e292f34584934d67a3b59..e127424fdaf974f9e6e705b879e9d21ceb1b0ffc 100644 --- a/code/os/08-preemptive/start.S +++ b/code/os/08-preemptive/start.S @@ -40,12 +40,18 @@ _start: or t0, t0, a1 csrw mstatus, t0 + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks diff --git a/code/os/09-lock/start.S b/code/os/09-lock/start.S index 0b730a9fe88869d4424e292f34584934d67a3b59..e127424fdaf974f9e6e705b879e9d21ceb1b0ffc 100644 --- a/code/os/09-lock/start.S +++ b/code/os/09-lock/start.S @@ -40,12 +40,18 @@ _start: or t0, t0, a1 csrw mstatus, t0 + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks diff --git a/code/os/10-swtimer/start.S b/code/os/10-swtimer/start.S index 0b730a9fe88869d4424e292f34584934d67a3b59..9a9e5fcbf62ba4a5c06d2783e8c9be011e317c4b 100644 --- a/code/os/10-swtimer/start.S +++ b/code/os/10-swtimer/start.S @@ -40,8 +40,14 @@ _start: or t0, t0, a1 csrw mstatus, t0 + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c +trap_stack: + .skip STACK_SIZE + park: wfi j park diff --git a/code/os/11-syscall/start.S b/code/os/11-syscall/start.S index ba34f12c77b58610b8dd7a0707e4a099af4d71ba..d595d7c1394b579718181dbc51e3c65088c3f5f6 100644 --- a/code/os/11-syscall/start.S +++ b/code/os/11-syscall/start.S @@ -64,12 +64,18 @@ _start: or t0, t0, a1 csrw mstatus, t0 + la t0, trap_stack + csrw mscratch, t0 + j start_kernel # hart 0 jump to c park: wfi j park +trap_stack: + .skip STACK_SIZE + stacks: .skip STACK_SIZE * MAXNUM_CPU # allocate space for all the harts stacks