Add an explicit end of call stack for x86_64

This commit is contained in:
Zejun Zhao 2025-08-28 12:18:32 +08:00 committed by Junyang Zhang
parent 920ec7f521
commit aeaf103166
1 changed files with 4 additions and 2 deletions

View File

@ -31,6 +31,8 @@ first_context_switch: # (nxt: *const TaskContext)
mov r13, [rdi + 32]
mov r14, [rdi + 40]
mov r15, [rdi + 48]
mov rax, [rdi + 56] # restore return address
mov [rsp], rax # for stack balance, must use mov instead of push
mov rax, [rdi + 56]
# for stack balance, we have to use mov instead of push here
mov qword ptr [rsp + 8], 0 # kernel_task_entry's return address
mov [rsp], rax # first_context_switch's return address
ret