Changeset 5eae56a in mainline for kernel/arch/ia32/src/context.S
- Timestamp:
- 2014-09-03T20:50:12Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4b334fd6
- Parents:
- e74b24f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/context.S
re74b24f r5eae56a 27 27 # 28 28 29 #include <arch/context_ offset.h>29 #include <arch/context_struct.h> 30 30 31 31 .text … … 41 41 # 42 42 context_save_arch: 43 movl 0(%esp), %eax # save pc value into eax44 movl 4(%esp), %edx # address of the context variable to save context to43 movl 0(%esp), %eax # save pc value into eax 44 movl 4(%esp), %edx # address of the context variable to save context to 45 45 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 48 53 49 xorl %eax, %eax # context_save returns 154 xorl %eax, %eax # context_save returns 1 50 55 incl %eax 51 56 ret … … 58 63 # 59 64 context_restore_arch: 60 movl 4(%esp), %eax # address of the context variable to restore context from65 movl 4(%esp), %eax # address of the context variable to restore context from 61 66 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 64 74 65 movl %edx, 0(%esp) # put saved pc on stack66 xorl %eax, %eax # context_restore returns 075 movl %edx, 0(%esp) # put saved pc on stack 76 xorl %eax, %eax # context_restore returns 0 67 77 ret 78
Note:
See TracChangeset
for help on using the changeset viewer.