Ignore:
File:
1 edited

Legend:

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

    r5eae56a re98f1c3e  
    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
    57 
     59FUNCTION_END(context_save_arch)
    5860
    5961## Restore saved CPU context
     
    6264# pointed by the 1st argument. Returns 0 in EAX.
    6365#
    64 context_restore_arch:
     66FUNCTION_BEGIN(context_restore_arch)
    6567        movl 4(%esp), %eax      # address of the context variable to restore context from
    6668
     
    7476
    7577        movl %edx, 0(%esp)      # put saved pc on stack
     78
     79        mov vreg_ptr, %ecx
     80        movl CONTEXT_OFFSET_TP(%eax), %edx
     81        movl %edx, %gs:VREG_TP(%ecx)
     82
    7683        xorl %eax, %eax         # context_restore returns 0
    7784        ret
    78 
Note: See TracChangeset for help on using the changeset viewer.