Cleanup docs in assembly routines.

This commit is contained in:
Ali Mashtizadeh 2023-09-10 16:36:43 -04:00
parent 3a21b98358
commit b39acb2afd
2 changed files with 13 additions and 2 deletions

View File

@ -10,6 +10,7 @@
# %rdi: oldsp # %rdi: oldsp
# %rsi: newsp # %rsi: newsp
FUNC_BEGIN(switchstack) FUNC_BEGIN(switchstack)
# Save callee saved registers of old thread
pushq %rbp pushq %rbp
pushq %rdi pushq %rdi
pushq %rbx pushq %rbx
@ -18,10 +19,11 @@ FUNC_BEGIN(switchstack)
pushq %r14 pushq %r14
pushq %r15 pushq %r15
# Switch stack # Switch stack from old to new thread
movq %rsp, (%rdi) movq %rsp, (%rdi)
movq %rsi, %rsp movq %rsi, %rsp
# Restore callee saved registers of new thread
popq %r15 popq %r15
popq %r14 popq %r14
popq %r13 popq %r13

View File

@ -8,6 +8,7 @@
.macro TRAP_NOEC TRAPNUM .macro TRAP_NOEC TRAPNUM
trap\TRAPNUM: trap\TRAPNUM:
# Push top of the trap frame
pushq %rax pushq %rax
pushq $\TRAPNUM pushq $\TRAPNUM
pushq %rax pushq %rax
@ -19,6 +20,7 @@ trap\TRAPNUM:
.macro TRAP_EC TRAPNUM .macro TRAP_EC TRAPNUM
trap\TRAPNUM: trap\TRAPNUM:
# Push top of the trap frame
pushq $\TRAPNUM pushq $\TRAPNUM
pushq %rax pushq %rax
xorq %rax, %rax xorq %rax, %rax
@ -160,6 +162,7 @@ TRAP_NOEC 62
TRAP_NOEC 63 TRAP_NOEC 63
trap_common: trap_common:
# Create the rest of the trap frame
pushq %rbx pushq %rbx
pushq %rcx pushq %rcx
pushq %rdx pushq %rdx
@ -174,6 +177,8 @@ trap_common:
pushq %r13 pushq %r13
pushq %r14 pushq %r14
pushq %r15 pushq %r15
# Pass the trap frame as an argument to trap_entry
movq %rsp, %rdi movq %rsp, %rdi
call trap_entry call trap_entry
.globl trap_return .globl trap_return
@ -195,7 +200,11 @@ trap_return:
popq %rax popq %rax
movw %ax, %ds movw %ax, %ds
popq %rax popq %rax
addq $16, %rsp // Skip error code and vector number
# Skip error code and vector number
addq $16, %rsp
# Return to userspace
iretq iretq
.globl Trap_Pop .globl Trap_Pop