Changeset ab936440 in mainline for uspace/lib/c/arch/ia32/src/fibril.S
- Timestamp:
- 2019-02-12T20:42:42Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f31ca47
- Parents:
- 7f7817a9 (diff), 4805495 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ia32/src/fibril.S
r7f7817a9 rab936440 37 37 # pointed by the 1st argument. Returns 0 in EAX. 38 38 # 39 FUNCTION_BEGIN(__ setjmp)39 FUNCTION_BEGIN(__context_save) 40 40 movl 0(%esp), %eax # the caller's return %eip 41 41 movl 4(%esp), %edx # address of the context variable to save context to 42 42 43 43 # save registers to the context structure 44 movl %esp, CONTEXT_OFFSET_SP(%edx) # %esp -> ctx->sp45 movl %eax, CONTEXT_OFFSET_PC(%edx) # %eip -> ctx->pc46 movl %ebx, CONTEXT_OFFSET_EBX(%edx) # %ebx -> ctx->ebx47 movl %esi, CONTEXT_OFFSET_ESI(%edx) # %esi -> ctx->esi48 movl %edi, CONTEXT_OFFSET_EDI(%edx) # %edi -> ctx->edi49 movl %ebp, CONTEXT_OFFSET_EBP(%edx) # %ebp -> ctx->ebp44 movl %esp, __CONTEXT_OFFSET_SP(%edx) # %esp -> ctx->sp 45 movl %eax, __CONTEXT_OFFSET_PC(%edx) # %eip -> ctx->pc 46 movl %ebx, __CONTEXT_OFFSET_EBX(%edx) # %ebx -> ctx->ebx 47 movl %esi, __CONTEXT_OFFSET_ESI(%edx) # %esi -> ctx->esi 48 movl %edi, __CONTEXT_OFFSET_EDI(%edx) # %edi -> ctx->edi 49 movl %ebp, __CONTEXT_OFFSET_EBP(%edx) # %ebp -> ctx->ebp 50 50 51 51 # save TLS 52 52 movl %gs:0, %eax 53 movl %eax, CONTEXT_OFFSET_TLS(%edx) # tls -> ctx->tls53 movl %eax, __CONTEXT_OFFSET_TLS(%edx) # tls -> ctx->tls 54 54 55 xorl %eax, %eax # __ setjmpreturns 055 xorl %eax, %eax # __context_save returns 0 56 56 ret 57 FUNCTION_END(__ setjmp)57 FUNCTION_END(__context_save) 58 58 59 59 ## Restore saved CPU context … … 62 62 # pointed by the 1st argument. Returns second argument in EAX. 63 63 # 64 FUNCTION_BEGIN(__ longjmp)64 FUNCTION_BEGIN(__context_restore) 65 65 movl 4(%esp), %eax # address of the context variable to restore context from 66 66 movl 8(%esp), %ecx # return value 67 67 68 68 # restore registers from the context structure 69 movl CONTEXT_OFFSET_SP(%eax),%esp # ctx->sp -> %esp70 movl CONTEXT_OFFSET_PC(%eax),%edx # ctx->pc -> \pc71 movl CONTEXT_OFFSET_EBX(%eax),%ebx # ctx->ebx -> %ebx72 movl CONTEXT_OFFSET_ESI(%eax),%esi # ctx->esi -> %esi73 movl CONTEXT_OFFSET_EDI(%eax),%edi # ctx->edi -> %edi74 movl CONTEXT_OFFSET_EBP(%eax),%ebp # ctx->ebp -> %ebp69 movl __CONTEXT_OFFSET_SP(%eax),%esp # ctx->sp -> %esp 70 movl __CONTEXT_OFFSET_PC(%eax),%edx # ctx->pc -> \pc 71 movl __CONTEXT_OFFSET_EBX(%eax),%ebx # ctx->ebx -> %ebx 72 movl __CONTEXT_OFFSET_ESI(%eax),%esi # ctx->esi -> %esi 73 movl __CONTEXT_OFFSET_EDI(%eax),%edi # ctx->edi -> %edi 74 movl __CONTEXT_OFFSET_EBP(%eax),%ebp # ctx->ebp -> %ebp 75 75 76 76 movl %edx, 0(%esp) # ctx->pc -> saver's return %eip 77 77 78 78 # set thread local storage 79 movl CONTEXT_OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr79 movl __CONTEXT_OFFSET_TLS(%eax), %edx # Set arg1 to TLS addr 80 80 movl %edx, %gs:0 81 81 82 82 movl %ecx, %eax 83 83 ret 84 FUNCTION_END(__ longjmp)84 FUNCTION_END(__context_restore) 85 85
Note:
See TracChangeset
for help on using the changeset viewer.