1 /* Linux-specific definitions: (these are the C library offsets and not the kernel ones) */ 2 3 /* Define various structure offsets to simplify cross-compilation. */ 4 5 /* Offsets for x86 Linux "ucontext_t": */ 6 7 #define LINUX_UC_FLAGS_OFF 0x00 8 #define LINUX_UC_LINK_OFF 0x04 9 #define LINUX_UC_STACK_OFF 0x08 10 #define LINUX_UC_MCONTEXT_OFF 0x14 11 #define LINUX_UC_SIGMASK_OFF 0x6c 12 // Bionic uses 8 bytes for sigmask (just like the kernel) whereas libunwind 13 // expects by default a glibc like sigmask (128 bytes). 14 #if defined(__ANDROID__) 15 #define LINUX_UC_FPREGS_MEM_OFF 0x74 16 #else 17 #define LINUX_UC_FPREGS_MEM_OFF 0xec 18 #endif 19 20 /* The struct sigcontext is located at an offset of 4 21 from the stack pointer in the signal frame. */ 22 23 /* Offsets for x86 Linux "struct sigcontext": */ 24 25 #define LINUX_SC_GS_OFF 0x00 26 #define LINUX_SC_GSH_OFF 0x02 27 #define LINUX_SC_FS_OFF 0x04 28 #define LINUX_SC_FSH_OFF 0x06 29 #define LINUX_SC_ES_OFF 0x08 30 #define LINUX_SC_ESH_OFF 0x0a 31 #define LINUX_SC_DS_OFF 0x0c 32 #define LINUX_SC_DSH_OFF 0x0e 33 #define LINUX_SC_EDI_OFF 0x10 34 #define LINUX_SC_ESI_OFF 0x14 35 #define LINUX_SC_EBP_OFF 0x18 36 #define LINUX_SC_ESP_OFF 0x1c 37 #define LINUX_SC_EBX_OFF 0x20 38 #define LINUX_SC_EDX_OFF 0x24 39 #define LINUX_SC_ECX_OFF 0x28 40 #define LINUX_SC_EAX_OFF 0x2c 41 #define LINUX_SC_TRAPNO_OFF 0x30 42 #define LINUX_SC_ERR_OFF 0x34 43 #define LINUX_SC_EIP_OFF 0x38 44 #define LINUX_SC_CS_OFF 0x3c 45 #define LINUX_SC_CSH_OFF 0x3e 46 #define LINUX_SC_EFLAGS_OFF 0x40 47 #define LINUX_SC_ESP_AT_SIGNAL_OFF 0x44 48 #define LINUX_SC_SS_OFF 0x48 49 #define LINUX_SC_SSH_OFF 0x4a 50 #define LINUX_SC_FPSTATE_OFF 0x4c 51 #define LINUX_SC_OLDMASK_OFF 0x50 52 #define LINUX_SC_CR2_OFF 0x54 53 54 /* Offsets for x86 Linux "struct _fpstate": */ 55 56 #define LINUX_FPSTATE_CW_OFF 0x000 57 #define LINUX_FPSTATE_SW_OFF 0x004 58 #define LINUX_FPSTATE_TAG_OFF 0x008 59 #define LINUX_FPSTATE_IPOFF_OFF 0x00c 60 #define LINUX_FPSTATE_CSSEL_OFF 0x010 61 #define LINUX_FPSTATE_DATAOFF_OFF 0x014 62 #define LINUX_FPSTATE_DATASEL_OFF 0x018 63 #define LINUX_FPSTATE_ST0_OFF 0x01c 64 #define LINUX_FPSTATE_ST1_OFF 0x026 65 #define LINUX_FPSTATE_ST2_OFF 0x030 66 #define LINUX_FPSTATE_ST3_OFF 0x03a 67 #define LINUX_FPSTATE_ST4_OFF 0x044 68 #define LINUX_FPSTATE_ST5_OFF 0x04e 69 #define LINUX_FPSTATE_ST6_OFF 0x058 70 #define LINUX_FPSTATE_ST7_OFF 0x062 71 #define LINUX_FPSTATE_STATUS_OFF 0x06c 72 #define LINUX_FPSTATE_MAGIC_OFF 0x06e 73 #define LINUX_FPSTATE_FXSR_ENV_OFF 0x070 74 #define LINUX_FPSTATE_MXCSR_OFF 0x088 75 #define LINUX_FPSTATE_FXSR_ST0_OFF 0x090 76 #define LINUX_FPSTATE_FXSR_ST1_OFF 0x0a0 77 #define LINUX_FPSTATE_FXSR_ST2_OFF 0x0b0 78 #define LINUX_FPSTATE_FXSR_ST3_OFF 0x0c0 79 #define LINUX_FPSTATE_FXSR_ST4_OFF 0x0d0 80 #define LINUX_FPSTATE_FXSR_ST5_OFF 0x0e0 81 #define LINUX_FPSTATE_FXSR_ST6_OFF 0x0f0 82 #define LINUX_FPSTATE_FXSR_ST7_OFF 0x100 83 #define LINUX_FPSTATE_XMM0_OFF 0x110 84 #define LINUX_FPSTATE_XMM1_OFF 0x120 85 #define LINUX_FPSTATE_XMM2_OFF 0x130 86 #define LINUX_FPSTATE_XMM3_OFF 0x140 87 #define LINUX_FPSTATE_XMM4_OFF 0x150 88 #define LINUX_FPSTATE_XMM5_OFF 0x160 89 #define LINUX_FPSTATE_XMM6_OFF 0x170 90 #define LINUX_FPSTATE_XMM7_OFF 0x180 91 92 /* FreeBSD-specific definitions: */ 93 94 #define FREEBSD_SC_UCONTEXT_OFF 0x20 95 #define FREEBSD_UC_MCONTEXT_OFF 0x10 96 97 #define FREEBSD_UC_MCONTEXT_GS_OFF 0x14 98 #define FREEBSD_UC_MCONTEXT_FS_OFF 0x18 99 #define FREEBSD_UC_MCONTEXT_ES_OFF 0x1c 100 #define FREEBSD_UC_MCONTEXT_DS_OFF 0x20 101 #define FREEBSD_UC_MCONTEXT_EDI_OFF 0x24 102 #define FREEBSD_UC_MCONTEXT_ESI_OFF 0x28 103 #define FREEBSD_UC_MCONTEXT_EBP_OFF 0x2c 104 #define FREEBSD_UC_MCONTEXT_EBX_OFF 0x34 105 #define FREEBSD_UC_MCONTEXT_EDX_OFF 0x38 106 #define FREEBSD_UC_MCONTEXT_ECX_OFF 0x3c 107 #define FREEBSD_UC_MCONTEXT_EAX_OFF 0x40 108 #define FREEBSD_UC_MCONTEXT_TRAPNO_OFF 0x44 109 #define FREEBSD_UC_MCONTEXT_EIP_OFF 0x4c 110 #define FREEBSD_UC_MCONTEXT_ESP_OFF 0x58 111 #define FREEBSD_UC_MCONTEXT_CS_OFF 0x50 112 #define FREEBSD_UC_MCONTEXT_EFLAGS_OFF 0x54 113 #define FREEBSD_UC_MCONTEXT_SS_OFF 0x5c 114 #define FREEBSD_UC_MCONTEXT_MC_LEN_OFF 0x60 115 #define FREEBSD_UC_MCONTEXT_FPFORMAT_OFF 0x64 116 #define FREEBSD_UC_MCONTEXT_OWNEDFP_OFF 0x68 117 #define FREEBSD_UC_MCONTEXT_FPSTATE_OFF 0x70 118 119 #define FREEBSD_UC_MCONTEXT_CW_OFF 0x70 120 #define FREEBSD_UC_MCONTEXT_SW_OFF 0x74 121 #define FREEBSD_UC_MCONTEXT_TAG_OFF 0x78 122 #define FREEBSD_UC_MCONTEXT_IPOFF_OFF 0x7c 123 #define FREEBSD_UC_MCONTEXT_CSSEL_OFF 0x80 124 #define FREEBSD_UC_MCONTEXT_DATAOFF_OFF 0x84 125 #define FREEBSD_US_MCONTEXT_DATASEL_OFF 0x88 126 #define FREEBSD_UC_MCONTEXT_ST0_OFF 0x8c 127 128 #define FREEBSD_UC_MCONTEXT_CW_XMM_OFF 0x70 129 #define FREEBSD_UC_MCONTEXT_SW_XMM_OFF 0x72 130 #define FREEBSD_UC_MCONTEXT_TAG_XMM_OFF 0x74 131 #define FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF 0x78 132 #define FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF 0x7c 133 #define FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF 0x80 134 #define FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF 0x84 135 #define FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF 0x88 136 #define FREEBSD_UC_MCONTEXT_ST0_XMM_OFF 0x90 137 #define FREEBSD_UC_MCONTEXT_XMM0_OFF 0x110 138 139 #define FREEBSD_UC_MCONTEXT_MC_LEN_VAL 0x280 140 #define FREEBSD_UC_MCONTEXT_FPFMT_NODEV 0x10000 141 #define FREEBSD_UC_MCONTEXT_FPFMT_387 0x10001 142 #define FREEBSD_UC_MCONTEXT_FPFMT_XMM 0x10002 143 #define FREEBSD_UC_MCONTEXT_FPOWNED_NONE 0x20000 144 #define FREEBSD_UC_MCONTEXT_FPOWNED_FPU 0x20001 145 #define FREEBSD_UC_MCONTEXT_FPOWNED_PCB 0x20002 146 147