Changeset d5a89a3 in mainline for uspace/lib/c/arch/amd64
- Timestamp:
- 2019-02-11T22:31:04Z (6 years ago)
- Children:
- aaf9789c
- Parents:
- e3272101 (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. - Location:
- uspace/lib/c/arch/amd64
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/amd64/Makefile.common
re3272101 rd5a89a3 28 28 29 29 # TODO: We need to implement DWARF unwinding and get rid of this flag. 30 COMMON_CFLAGS += -fno-omit-frame-pointer 30 COMMON_CFLAGS += -fno-omit-frame-pointer -Wl,-z,max-page-size=0x1000 31 31 32 32 # XXX: This architecture requires unoptimized TLS pointer access, -
uspace/lib/c/arch/amd64/include/libarch/config.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_CONFIG_H_36 #define LIBC_amd64_CONFIG_H_35 #ifndef _LIBC_amd64_CONFIG_H_ 36 #define _LIBC_amd64_CONFIG_H_ 37 37 38 38 #define PAGE_WIDTH 12 -
uspace/lib/c/arch/amd64/include/libarch/elf_linux.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_ELF_LINUX_H_36 #define LIBC_amd64_ELF_LINUX_H_35 #ifndef _LIBC_amd64_ELF_LINUX_H_ 36 #define _LIBC_amd64_ELF_LINUX_H_ 37 37 38 38 #include <libarch/istate.h> -
uspace/lib/c/arch/amd64/include/libarch/faddr.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_FADDR_H_36 #define LIBC_amd64_FADDR_H_35 #ifndef _LIBC_amd64_FADDR_H_ 36 #define _LIBC_amd64_FADDR_H_ 37 37 38 38 #include <types/common.h> -
uspace/lib/c/arch/amd64/include/libarch/fibril.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_FIBRIL_H_36 #define LIBC_amd64_FIBRIL_H_35 #ifndef _LIBC_amd64_FIBRIL_H_ 36 #define _LIBC_amd64_FIBRIL_H_ 37 37 38 38 #include <libarch/fibril_context.h> -
uspace/lib/c/arch/amd64/include/libarch/fibril_context.h
re3272101 rd5a89a3 27 27 */ 28 28 29 #ifndef LIBC_ARCH_FIBRIL_CONTEXT_H_30 #define LIBC_ARCH_FIBRIL_CONTEXT_H_29 #ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_ 30 #define _LIBC_ARCH_FIBRIL_CONTEXT_H_ 31 31 32 #define CONTEXT_OFFSET_SP 0x0033 #define CONTEXT_OFFSET_PC 0x0834 #define CONTEXT_OFFSET_RBX 0x1035 #define CONTEXT_OFFSET_RBP 0x1836 #define CONTEXT_OFFSET_R12 0x2037 #define CONTEXT_OFFSET_R13 0x2838 #define CONTEXT_OFFSET_R14 0x3039 #define CONTEXT_OFFSET_R15 0x3840 #define CONTEXT_OFFSET_TLS 0x4041 #define CONTEXT_SIZE 0x4832 #define __CONTEXT_OFFSET_SP 0x00 33 #define __CONTEXT_OFFSET_PC 0x08 34 #define __CONTEXT_OFFSET_RBX 0x10 35 #define __CONTEXT_OFFSET_RBP 0x18 36 #define __CONTEXT_OFFSET_R12 0x20 37 #define __CONTEXT_OFFSET_R13 0x28 38 #define __CONTEXT_OFFSET_R14 0x30 39 #define __CONTEXT_OFFSET_R15 0x38 40 #define __CONTEXT_OFFSET_TLS 0x40 41 #define __CONTEXT_SIZE 0x48 42 42 43 43 #ifndef __ASSEMBLER__ … … 45 45 #include <stdint.h> 46 46 47 typedef struct context {47 typedef struct __context { 48 48 /* 49 49 * We include only registers that must be preserved … … 59 59 uint64_t r15; 60 60 uint64_t tls; 61 } context_t;61 } __context_t; 62 62 63 63 #endif -
uspace/lib/c/arch/amd64/include/libarch/rtld/dynamic.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_RTLD_DYNAMIC_H_36 #define LIBC_amd64_RTLD_DYNAMIC_H_35 #ifndef _LIBC_amd64_RTLD_DYNAMIC_H_ 36 #define _LIBC_amd64_RTLD_DYNAMIC_H_ 37 37 38 38 typedef struct { -
uspace/lib/c/arch/amd64/include/libarch/rtld/elf_dyn.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_RTLD_ELF_DYN_H_36 #define LIBC_amd64_RTLD_ELF_DYN_H_35 #ifndef _LIBC_amd64_RTLD_ELF_DYN_H_ 36 #define _LIBC_amd64_RTLD_ELF_DYN_H_ 37 37 38 38 #define R_X86_64_64 1 -
uspace/lib/c/arch/amd64/include/libarch/stackarg.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_STACKARG_H_36 #define LIBC_STACKARG_H_35 #ifndef _LIBC_STACKARG_H_ 36 #define _LIBC_STACKARG_H_ 37 37 38 38 #endif -
uspace/lib/c/arch/amd64/include/libarch/syscall.h
re3272101 rd5a89a3 34 34 */ 35 35 36 #ifndef LIBC_amd64_SYSCALL_H_37 #define LIBC_amd64_SYSCALL_H_36 #ifndef _LIBC_amd64_SYSCALL_H_ 37 #define _LIBC_amd64_SYSCALL_H_ 38 38 39 39 #define LIBARCH_SYSCALL_GENERIC -
uspace/lib/c/arch/amd64/include/libarch/thread.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_THREAD_H_36 #define LIBC_amd64_THREAD_H_35 #ifndef _LIBC_amd64_THREAD_H_ 36 #define _LIBC_amd64_THREAD_H_ 37 37 38 38 #endif -
uspace/lib/c/arch/amd64/include/libarch/tls.h
re3272101 rd5a89a3 33 33 */ 34 34 35 #ifndef LIBC_amd64_TLS_H_36 #define LIBC_amd64_TLS_H_35 #ifndef _LIBC_amd64_TLS_H_ 36 #define _LIBC_amd64_TLS_H_ 37 37 38 38 #define CONFIG_TLS_VARIANT_2 -
uspace/lib/c/arch/amd64/src/fibril.S
re3272101 rd5a89a3 37 37 # pointed by the 1st argument. Returns 0 in RAX. 38 38 # 39 FUNCTION_BEGIN(__ setjmp)39 FUNCTION_BEGIN(__context_save) 40 40 movq (%rsp), %rdx # the caller's return %eip 41 41 42 42 # in %rdi is passed 1st argument 43 movq %rdx, CONTEXT_OFFSET_PC(%rdi)44 movq %rsp, CONTEXT_OFFSET_SP(%rdi)43 movq %rdx, __CONTEXT_OFFSET_PC(%rdi) 44 movq %rsp, __CONTEXT_OFFSET_SP(%rdi) 45 45 46 movq %rbx, CONTEXT_OFFSET_RBX(%rdi)47 movq %rbp, CONTEXT_OFFSET_RBP(%rdi)48 movq %r12, CONTEXT_OFFSET_R12(%rdi)49 movq %r13, CONTEXT_OFFSET_R13(%rdi)50 movq %r14, CONTEXT_OFFSET_R14(%rdi)51 movq %r15, CONTEXT_OFFSET_R15(%rdi)46 movq %rbx, __CONTEXT_OFFSET_RBX(%rdi) 47 movq %rbp, __CONTEXT_OFFSET_RBP(%rdi) 48 movq %r12, __CONTEXT_OFFSET_R12(%rdi) 49 movq %r13, __CONTEXT_OFFSET_R13(%rdi) 50 movq %r14, __CONTEXT_OFFSET_R14(%rdi) 51 movq %r15, __CONTEXT_OFFSET_R15(%rdi) 52 52 53 53 movq %fs:0, %rax 54 movq %rax, CONTEXT_OFFSET_TLS(%rdi)54 movq %rax, __CONTEXT_OFFSET_TLS(%rdi) 55 55 56 xorq %rax, %rax # __ setjmpreturns 056 xorq %rax, %rax # __context_save returns 0 57 57 ret 58 FUNCTION_END(__ setjmp)58 FUNCTION_END(__context_save) 59 59 60 60 ## Restore current CPU context … … 63 63 # pointed by the 1st argument. Returns second argument in RAX. 64 64 # 65 FUNCTION_BEGIN(__ longjmp)66 movq CONTEXT_OFFSET_R15(%rdi), %r1567 movq CONTEXT_OFFSET_R14(%rdi), %r1468 movq CONTEXT_OFFSET_R13(%rdi), %r1369 movq CONTEXT_OFFSET_R12(%rdi), %r1270 movq CONTEXT_OFFSET_RBP(%rdi), %rbp71 movq CONTEXT_OFFSET_RBX(%rdi), %rbx65 FUNCTION_BEGIN(__context_restore) 66 movq __CONTEXT_OFFSET_R15(%rdi), %r15 67 movq __CONTEXT_OFFSET_R14(%rdi), %r14 68 movq __CONTEXT_OFFSET_R13(%rdi), %r13 69 movq __CONTEXT_OFFSET_R12(%rdi), %r12 70 movq __CONTEXT_OFFSET_RBP(%rdi), %rbp 71 movq __CONTEXT_OFFSET_RBX(%rdi), %rbx 72 72 73 movq CONTEXT_OFFSET_SP(%rdi), %rsp # ctx->sp -> %rsp73 movq __CONTEXT_OFFSET_SP(%rdi), %rsp # ctx->sp -> %rsp 74 74 75 movq CONTEXT_OFFSET_PC(%rdi), %rdx75 movq __CONTEXT_OFFSET_PC(%rdi), %rdx 76 76 77 77 movq %rdx,(%rsp) 78 78 79 movq CONTEXT_OFFSET_TLS(%rdi), %rdi79 movq __CONTEXT_OFFSET_TLS(%rdi), %rdi 80 80 movq %rdi, %fs:0 81 81 82 movq %rsi, %rax # __ longjmpreturns second argument82 movq %rsi, %rax # __context_restore returns second argument 83 83 ret 84 FUNCTION_END(__ longjmp)84 FUNCTION_END(__context_restore) 85 85 -
uspace/lib/c/arch/amd64/src/rtld/dynamic.c
re3272101 rd5a89a3 27 27 */ 28 28 29 /** @addtogroup libc ia3229 /** @addtogroup libcamd64 30 30 * @brief 31 31 * @{
Note:
See TracChangeset
for help on using the changeset viewer.