feat: TrueType (TTF) font rendering, many new desktop applications and DOOM support, among other improvements
This commit is contained in:
@@ -1,18 +1,30 @@
|
||||
;
|
||||
; Context.asm
|
||||
; Context switch: save/restore callee-saved registers, stack pointer, and CR3
|
||||
; Context switch: save/restore callee-saved registers, stack pointer, CR3, and FPU state
|
||||
; Copyright (c) 2025 Daniel Hammer
|
||||
;
|
||||
|
||||
[bits 64]
|
||||
section .text
|
||||
|
||||
; void SchedContextSwitch(uint64_t* oldRsp, uint64_t newRsp, uint64_t newCR3)
|
||||
; void SchedContextSwitch(uint64_t* oldRsp, uint64_t newRsp, uint64_t newCR3,
|
||||
; uint8_t* oldFpuArea, uint8_t* newFpuArea)
|
||||
; rdi = pointer to save old RSP
|
||||
; rsi = new RSP to restore
|
||||
; rdx = new PML4 physical address (for CR3)
|
||||
; rcx = old FPU state area (may be null)
|
||||
; r8 = new FPU state area (may be null)
|
||||
global SchedContextSwitch
|
||||
SchedContextSwitch:
|
||||
; Save FPU state before pushing registers (rcx/r8 are caller-saved)
|
||||
test rcx, rcx
|
||||
jz .skip_fxsave
|
||||
fxsave [rcx]
|
||||
.skip_fxsave:
|
||||
|
||||
; Stash r8 in r9 (callee-saved registers will clobber r8 slot on stack)
|
||||
mov r9, r8
|
||||
|
||||
; Save callee-saved registers on the current stack
|
||||
push rbp
|
||||
push rbx
|
||||
@@ -42,4 +54,10 @@ SchedContextSwitch:
|
||||
pop rbx
|
||||
pop rbp
|
||||
|
||||
; Restore FPU state
|
||||
test r9, r9
|
||||
jz .skip_fxrstor
|
||||
fxrstor [r9]
|
||||
.skip_fxrstor:
|
||||
|
||||
ret
|
||||
|
||||
Reference in New Issue
Block a user