Changeset e74b24f in mainline
- Timestamp:
- 2014-09-03T20:35:31Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5eae56a
- Parents:
- 41f9802
- Location:
- uspace/lib/c/arch/ia32
- Files:
-
- 1 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ia32/Makefile.inc
r41f9802 re74b24f 39 39 arch/$(UARCH)/src/rtld/reloc.c 40 40 41 ARCH_AUTOGENS_AG = \ 42 arch/$(UARCH)/include/libarch/fibril_context.ag 43 41 44 .PRECIOUS: arch/$(UARCH)/src/entry.o -
uspace/lib/c/arch/ia32/include/libarch/fibril.h
r41f9802 re74b24f 37 37 38 38 #include <sys/types.h> 39 #include <libarch/fibril_context.h> 39 40 40 41 /* … … 53 54 } while (0) 54 55 55 /*56 * We include only registers that must be preserved57 * during function call58 */59 typedef struct {60 uint32_t sp;61 uint32_t pc;62 63 uint32_t ebx;64 uint32_t esi;65 uint32_t edi;66 uint32_t ebp;67 68 uint32_t tls;69 } context_t;70 71 56 static inline uintptr_t context_get_fp(context_t *ctx) 72 57 { -
uspace/lib/c/arch/ia32/src/fibril.S
r41f9802 re74b24f 27 27 # 28 28 29 #include <libarch/ context_offset.h>29 #include <libarch/fibril_context.h> 30 30 31 31 .text … … 44 44 45 45 # save registers to the context structure 46 CONTEXT_SAVE_ARCH_CORE %edx %eax 46 movl %esp, CONTEXT_OFFSET_SP(%edx) # %esp -> ctx->sp 47 movl %eax, CONTEXT_OFFSET_PC(%edx) # %eip -> ctx->pc 48 movl %ebx, CONTEXT_OFFSET_EBX(%edx) # %ebx -> ctx->ebx 49 movl %esi, CONTEXT_OFFSET_ESI(%edx) # %esi -> ctx->esi 50 movl %edi, CONTEXT_OFFSET_EDI(%edx) # %edi -> ctx->edi 51 movl %ebp, CONTEXT_OFFSET_EBP(%edx) # %ebp -> ctx->ebp 47 52 48 53 # save TLS 49 54 movl %gs:0, %eax 50 movl %eax, OFFSET_TLS(%edx)# tls -> ctx->tls55 movl %eax, CONTEXT_OFFSET_TLS(%edx) # tls -> ctx->tls 51 56 52 xorl %eax, %eax 57 xorl %eax, %eax # context_save returns 1 53 58 incl %eax 54 59 ret … … 63 68 64 69 # restore registers from the context structure 65 CONTEXT_RESTORE_ARCH_CORE %eax %edx 70 movl CONTEXT_OFFSET_SP(%eax),%esp # ctx->sp -> %esp 71 movl CONTEXT_OFFSET_PC(%eax),%edx # ctx->pc -> \pc 72 movl CONTEXT_OFFSET_EBX(%eax),%ebx # ctx->ebx -> %ebx 73 movl CONTEXT_OFFSET_ESI(%eax),%esi # ctx->esi -> %esi 74 movl CONTEXT_OFFSET_EDI(%eax),%edi # ctx->edi -> %edi 75 movl CONTEXT_OFFSET_EBP(%eax),%ebp # ctx->ebp -> %ebp 66 76 67 77 movl %edx, 0(%esp) # ctx->pc -> saver's return %eip … … 69 79 # set thread local storage 70 80 pushl %edx 71 movl OFFSET_TLS(%eax), %edx# Set arg1 to TLS addr72 movl $1, %eax 81 movl CONTEXT_OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr 82 movl $1, %eax # Syscall SYS_TLS_SET 73 83 int $0x30 74 84 popl %edx 75 85 76 xorl %eax, %eax 86 xorl %eax, %eax # context_restore returns 0 77 87 ret 88
Note:
See TracChangeset
for help on using the changeset viewer.