aboutsummaryrefslogtreecommitdiff
path: root/src/exceptions
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-01 20:36:30 -0700
committerChristian Cunningham <cc@localhost>2022-02-01 20:36:30 -0700
commit7d3884b5cfc282dbdfe5d9a22d8b2b343280b8af (patch)
treea3e5e5376c35cce48d1e2d907720646448c5e2ba /src/exceptions
parent98793badc1c1d3e4bfd735fdecd3d2d731701ab3 (diff)
Thread yield control to any other threads
Diffstat (limited to 'src/exceptions')
-rw-r--r--src/exceptions/svc.S13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/exceptions/svc.S b/src/exceptions/svc.S
index 51c6479..7e6a327 100644
--- a/src/exceptions/svc.S
+++ b/src/exceptions/svc.S
@@ -12,12 +12,13 @@ svc:
beq svc_000002
cmp r0, #1
beq svc_000001
- cmp r0, #1
+ cmp r0, #0
beq svc_000000
svc_000000:
- cps #0x13
- b svc_exit
-svc_000001:
+ bl yield
+ ldmfd sp!, {r0-r12,lr}
+ b schedule
+svc_000001: // Get time
mov r2, #0x3004
movt r2, #0x3F00
ldr r0, [r2, #4] // <- SYS_TIMER_CLO
@@ -25,10 +26,10 @@ svc_000001:
str r0, [sp] // Return value
str r1, [sp, #4] // Return value hi
b svc_exit
-svc_000002:
+svc_000002: // Run Schedule
ldmfd sp!, {r0-r12,lr}
b schedule
-svc_000003:
+svc_000003: // Clean task stack
ldr r3, =scheduler
ldr r2, [r3, #0] // struct Thread* rthread
ldr r1, [r2, #8] // sp_base