Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/context.S

    r3eebe571 r0aee9b4  
    2727#
    2828
    29 #include <abi/asmtool.h>
     29.text
     30
     31.global context_save_arch
     32.global context_restore_arch
     33
    3034#include <arch/context_struct.h>
    31 #include <arch/vreg.h>
    32 
    33 .text
    3435
    3536## Save current CPU context
     
    3839# pointed by the 1st argument. Returns 1 in EAX.
    3940#
    40 FUNCTION_BEGIN(context_save_arch)
    41         movq (%rsp), %rdx     # the caller's return %rip
     41context_save_arch:
     42        movq (%rsp), %rdx     # the caller's return %eip
    4243       
     44        # 1st argument passed in %edi
    4345        movq %rdx, CONTEXT_OFFSET_PC(%rdi)
    4446        movq %rsp, CONTEXT_OFFSET_SP(%rdi)
     
    5052        movq %r14, CONTEXT_OFFSET_R14(%rdi)
    5153        movq %r15, CONTEXT_OFFSET_R15(%rdi)
    52 
    53         movq vreg_ptr, %rsi
    54         movq %fs:VREG_TP(%rsi), %rsi
    55         movq %rsi, CONTEXT_OFFSET_TP(%rdi)
    5654       
    5755        xorl %eax, %eax       # context_save returns 1
    5856        incl %eax
    5957        ret
    60 FUNCTION_END(context_save_arch)
    6158
    6259
     
    6663# pointed by the 1st argument. Returns 0 in EAX.
    6764#
    68 FUNCTION_BEGIN(context_restore_arch)
     65context_restore_arch:
    6966        movq CONTEXT_OFFSET_R15(%rdi), %r15
    7067        movq CONTEXT_OFFSET_R14(%rdi), %r14
     
    7471        movq CONTEXT_OFFSET_RBX(%rdi), %rbx
    7572       
    76         movq CONTEXT_OFFSET_SP(%rdi), %rsp
     73        movq CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
    7774       
    78         movq CONTEXT_OFFSET_PC(%rdi), %rdx
     75        movq CONTEXT_OFFSET_PC(%rdi), %rdx
     76       
    7977        movq %rdx, (%rsp)
    80 
    81         movq CONTEXT_OFFSET_TP(%rdi), %rcx
    82         movq vreg_ptr, %rsi
    83         movq %rcx, %fs:VREG_TP(%rsi)
    8478       
    8579        xorl %eax, %eax       # context_restore returns 0
    8680        ret
    87 FUNCTION_END(context_restore_arch)
    8881
Note: See TracChangeset for help on using the changeset viewer.