Changeset 5eae56a in mainline
- Timestamp:
- 2014-09-03T20:50:12Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4b334fd6
- Parents:
- e74b24f
- Location:
- kernel/arch/ia32
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/Makefile.inc
re74b24f r5eae56a 107 107 108 108 ARCH_AUTOGENS_AG = \ 109 arch/$(KARCH)/include/arch/istate_struct.ag 109 arch/$(KARCH)/include/arch/istate_struct.ag \ 110 arch/$(KARCH)/include/arch/context_struct.ag 110 111 -
kernel/arch/ia32/include/arch/context.h
re74b24f r5eae56a 37 37 38 38 #include <typedefs.h> 39 #include <arch/context_struct.h> 39 40 40 41 #define STACK_ITEM_SIZE 4 … … 55 56 } while (0) 56 57 57 /*58 * Only save registers that must be preserved across59 * function calls.60 */61 typedef struct {62 uintptr_t sp;63 uintptr_t pc;64 uint32_t ebx;65 uint32_t esi;66 uint32_t edi;67 uint32_t ebp;68 ipl_t ipl;69 } __attribute__ ((packed)) context_t;70 71 58 #endif 72 59 -
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.