aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-23 16:32:57 -0700
committerChristian Cunningham <cc@localhost>2022-01-23 16:32:57 -0700
commitd085707a1054df197a8695a3a822687dd1a16022 (patch)
tree0e4b045b60b2fccdf07c80aed4bf34be0bb62052
parent746d701c36bdbc5884af6ef9ba6ee65915b5891d (diff)
Fixed context switch bug
-rw-r--r--src/sys/schedule.S4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sys/schedule.S b/src/sys/schedule.S
index 8cfb238..c8dcaa2 100644
--- a/src/sys/schedule.S
+++ b/src/sys/schedule.S
@@ -36,7 +36,9 @@ schedule:
cmp r0, #0
beq 1f
// Replace LR with IRQ's LR
- mov lr, r0
+ ldr r3, =scheduler
+ ldr r2, [r3, #0] // struct Thread* rthread
+ str r0, [r2, #0] // svc_lr -> void* pc
// Clear IRQ's LR
mov r0, #0
str r0, [r1]