aboutsummaryrefslogtreecommitdiff
path: root/kernel/exceptions
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-25 23:59:05 -0700
committerChristian Cunningham <cc@localhost>2022-03-25 23:59:05 -0700
commit32ef93110fc993f24540bdcff6c3d88c47cd64c1 (patch)
tree0ac9b4fa0258b0f3c9f2506b5f42a19fffa0629e /kernel/exceptions
parente733d37ee2aee3a5f3850ab336d588f814bb134c (diff)
Don't schedule if you don't have to
Diffstat (limited to 'kernel/exceptions')
-rw-r--r--kernel/exceptions/svc.S12
1 files changed, 9 insertions, 3 deletions
diff --git a/kernel/exceptions/svc.S b/kernel/exceptions/svc.S
index 75a0cf1..452831a 100644
--- a/kernel/exceptions/svc.S
+++ b/kernel/exceptions/svc.S
@@ -72,9 +72,11 @@ svc_000005: // Release Lock
sev
// Awake any threads waiting for this lock
bl sched_mutex_resurrect
+ cmp r0, #0
+ beq 1f
ldmfd sp!, {r0-r12,lr}
b schedule
- b svc_exit
+1: b svc_exit
svc_000006: // Semaphore decrease
ldr r0, [sp, #0] // struct Semaphore* s
1: clrex
@@ -106,9 +108,11 @@ svc_000007: // Semaphore increase
bne svc_exit
mov r1, #1
bl sched_semaphore_resurrect
+ cmp r0, #0
+ beq 1f
ldmfd sp!, {r0-r12,lr}
b schedule
- b svc_exit
+1: b svc_exit
svc_000008: // Semaphore add #
ldr r0, [sp, #0] // struct Semaphore* s
ldr r3, [sp, #1] // unsigned long # times to increase
@@ -121,9 +125,11 @@ svc_000008: // Semaphore add #
dmb
mov r1, r3
bl sched_semaphore_resurrect
+ cmp r0, #0
+ beq 1f
ldmfd sp!, {r0-r12,lr}
b schedule
- b svc_exit
+1: b svc_exit
svc_000009: // SYS_TIME_2
mrc p15, 0, r0, c9, c13, 0
str r0, [sp, #0]