From 3ace36ab03f40db05a7876013b7d814a3e5ca171 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 22 Jan 2022 23:18:22 -0700 Subject: Added SVC call for clean stack --- src/boot.S | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/boot.S') diff --git a/src/boot.S b/src/boot.S index 94de57f..aedc957 100644 --- a/src/boot.S +++ b/src/boot.S @@ -136,14 +136,25 @@ svc: // TODO: Make supervisor mode return to a specific location // (rather than to a user location) such as the kernel loop cmp r0, #0 - bne 2f + bne 3f cps #0x13 b 1f -2: +3: cmp r0, #2 - bne 1f + bne 2f ldmfd sp!, {r0-r12,lr} b schedule +2: + cmp r0, #3 + bne 1f + ldr r3, =scheduler + ldr r2, [r3, #0] + ldr r1, [r2, #8] // sp_base + cmp r1, #-1 + beq 1f + ldr r3, =stacks_table + mov r0, #0 + strb r0, [r3, r1] 1: ldmfd sp!, {r0-r12,pc}^ io_halt_prefetch: -- cgit v1.2.1