Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add initial process, thread and scheduler #46

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions kernel/src/process/asm_helper.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
.global switch_context

switch_context:
// ldr r1, [r0, #16]
// msr cpsr, r1
; Set the CPSR register.
dsluijk marked this conversation as resolved.
Show resolved Hide resolved
ldr r1, [r0, #16]
msr cpsr, r1
; Load the stack pointer.
ldr sp, [r0, #52]

; Push all other registers on the stack.
ldr r1, [r0, #60]
push {r1}
ldr r1, [r0, #56]
push {r1}

ldr r1, [r0, #48]
push {r1}
ldr r1, [r0, #44]
Expand Down Expand Up @@ -38,7 +39,12 @@ switch_context:
ldr r1, [r0, #0]
push {r1}

// msr CPSR_c, #0x10
; TODO: Enter user space
; cps #16
; Or:
; msr CPSR_c, #0x10

; Load all register states.
; Loading the PC register effectively jumps into the user program
pop {r0-r12}
pop {r14-pc}