Ignore:
File:
1 edited

Legend:

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

    r5eae56a rd6f9fff  
    2727#
    2828
     29#include <abi/asmtool.h>
    2930#include <arch/context_struct.h>
     31#include <arch/vreg.h>
    3032
    3133.text
    32 
    33 .global context_save_arch
    34 .global context_restore_arch
    35 
    3634
    3735## Save current CPU context
     
    4038# pointed by the 1st argument. Returns 1 in EAX.
    4139#
    42 context_save_arch:
     40FUNCTION_BEGIN(context_save_arch)
    4341        movl 0(%esp), %eax      # save pc value into eax       
    4442        movl 4(%esp), %edx      # address of the context variable to save context to
     
    5250        movl %ebp, CONTEXT_OFFSET_EBP(%edx)     # %ebp -> ctx->ebp
    5351
     52        mov vreg_ptr, %ecx
     53        movl %gs:VREG_TP(%ecx), %ecx
     54        movl %ecx, CONTEXT_OFFSET_TP(%edx)
     55
    5456        xorl %eax, %eax         # context_save returns 1
    5557        incl %eax
    5658        ret
     59FUNCTION_END(context_save_arch)
    5760
    5861
     
    6265# pointed by the 1st argument. Returns 0 in EAX.
    6366#
    64 context_restore_arch:
     67FUNCTION_BEGIN(context_restore_arch)
    6568        movl 4(%esp), %eax      # address of the context variable to restore context from
    6669
     
    7477
    7578        movl %edx, 0(%esp)      # put saved pc on stack
     79
     80        mov vreg_ptr, %ecx
     81        movl CONTEXT_OFFSET_TP(%eax), %edx
     82        movl %edx, %gs:VREG_TP(%ecx)
     83
    7684        xorl %eax, %eax         # context_restore returns 0
    7785        ret
    78 
Note: See TracChangeset for help on using the changeset viewer.