Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5eae56a in mainline for kernel/arch/ia32/src/context.S


Ignore:
Timestamp:
2014-09-03T20:50:12Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
4b334fd6
Parents:
e74b24f
Message:

Autogenerate ia32 kernel context_t and its offsets.

File:
1 edited

Legend:

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

    re74b24f r5eae56a  
    2727#
    2828
    29 #include <arch/context_offset.h>
     29#include <arch/context_struct.h>
    3030
    3131.text
     
    4141#
    4242context_save_arch:
    43         movl 0(%esp),%eax       # save pc value into eax       
    44         movl 4(%esp),%edx       # address of the context variable to save context to
     43        movl 0(%esp), %eax      # save pc value into eax       
     44        movl 4(%esp), %edx      # address of the context variable to save context to
    4545
    46                 # save registers to given structure
    47         CONTEXT_SAVE_ARCH_CORE %edx %eax
     46        # save registers to given structure
     47        movl %esp, CONTEXT_OFFSET_SP(%edx)      # %esp -> ctx->sp
     48        movl %eax, CONTEXT_OFFSET_PC(%edx)      # %eip -> ctx->pc
     49        movl %ebx, CONTEXT_OFFSET_EBX(%edx)     # %ebx -> ctx->ebx
     50        movl %esi, CONTEXT_OFFSET_ESI(%edx)     # %esi -> ctx->esi
     51        movl %edi, CONTEXT_OFFSET_EDI(%edx)     # %edi -> ctx->edi
     52        movl %ebp, CONTEXT_OFFSET_EBP(%edx)     # %ebp -> ctx->ebp
    4853
    49         xorl %eax,%eax          # context_save returns 1
     54        xorl %eax, %eax         # context_save returns 1
    5055        incl %eax
    5156        ret
     
    5863#
    5964context_restore_arch:
    60         movl 4(%esp),%eax       # address of the context variable to restore context from
     65        movl 4(%esp), %eax      # address of the context variable to restore context from
    6166
    62                 # restore registers from given structure
    63         CONTEXT_RESTORE_ARCH_CORE %eax %edx
     67        # restore registers from given structure
     68        movl CONTEXT_OFFSET_SP(%eax), %esp      # ctx->sp -> %esp
     69        movl CONTEXT_OFFSET_PC(%eax), %edx      # ctx->pc -> \pc
     70        movl CONTEXT_OFFSET_EBX(%eax), %ebx     # ctx->ebx -> %ebx
     71        movl CONTEXT_OFFSET_ESI(%eax), %esi     # ctx->esi -> %esi
     72        movl CONTEXT_OFFSET_EDI(%eax), %edi     # ctx->edi -> %edi
     73        movl CONTEXT_OFFSET_EBP(%eax), %ebp     # ctx->ebp -> %ebp
    6474
    65         movl %edx,0(%esp)       # put saved pc on stack
    66         xorl %eax,%eax          # context_restore returns 0
     75        movl %edx, 0(%esp)      # put saved pc on stack
     76        xorl %eax, %eax         # context_restore returns 0
    6777        ret
     78
Note: See TracChangeset for help on using the changeset viewer.