Changes in uspace/lib/c/arch/amd64/src/fibril.S [9d58539:4dc7a84] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/amd64/src/fibril.S
r9d58539 r4dc7a84 32 32 .global context_restore 33 33 34 #include <libarch/ context_offset.h>34 #include <libarch/fibril_context.h> 35 35 36 36 ## Save current CPU context … … 42 42 movq (%rsp), %rdx # the caller's return %eip 43 43 44 # In %edi is passed 1st argument 45 CONTEXT_SAVE_ARCH_CORE %rdi %rdx 44 # in %rdi is passed 1st argument 45 movq %rdx, CONTEXT_OFFSET_PC(%rdi) 46 movq %rsp, CONTEXT_OFFSET_SP(%rdi) 46 47 47 # Save TLS 48 movq %rbx, CONTEXT_OFFSET_RBX(%rdi) 49 movq %rbp, CONTEXT_OFFSET_RBP(%rdi) 50 movq %r12, CONTEXT_OFFSET_R12(%rdi) 51 movq %r13, CONTEXT_OFFSET_R13(%rdi) 52 movq %r14, CONTEXT_OFFSET_R14(%rdi) 53 movq %r15, CONTEXT_OFFSET_R15(%rdi) 54 55 # save TLS 48 56 movq %fs:0, %rax 49 movq %rax, OFFSET_TLS(%rdi)50 51 xorl %eax, %eax 57 movq %rax, CONTEXT_OFFSET_TLS(%rdi) 58 59 xorl %eax, %eax # context_save returns 1 52 60 incl %eax 53 61 ret 54 55 62 56 63 ## Restore current CPU context … … 61 68 context_restore: 62 69 63 CONTEXT_RESTORE_ARCH_CORE %rdi %rdx 70 movq CONTEXT_OFFSET_R15(%rdi), %r15 71 movq CONTEXT_OFFSET_R14(%rdi), %r14 72 movq CONTEXT_OFFSET_R13(%rdi), %r13 73 movq CONTEXT_OFFSET_R12(%rdi), %r12 74 movq CONTEXT_OFFSET_RBP(%rdi), %rbp 75 movq CONTEXT_OFFSET_RBX(%rdi), %rbx 76 77 movq CONTEXT_OFFSET_SP(%rdi), %rsp # ctx->sp -> %rsp 78 79 movq CONTEXT_OFFSET_PC(%rdi), %rdx 64 80 65 81 movq %rdx,(%rsp) 82 83 # Set thread local storage 84 movq CONTEXT_OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr 85 movl $1, %eax # SYS_TLS_SET 86 syscall 87 88 xorl %eax, %eax # context_restore returns 0 89 ret 66 90 67 # Set thread local storage68 movq OFFSET_TLS(%rdi), %rdi # Set arg1 to TLS addr69 movl $1, %eax # SYS_TLS_SET70 syscall71 72 xorl %eax, %eax # context_restore returns 073 ret
Note:
See TracChangeset
for help on using the changeset viewer.