David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 1 | #ifndef _UAPI_ASM_X86_SIGCONTEXT_H |
| 2 | #define _UAPI_ASM_X86_SIGCONTEXT_H |
| 3 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 4 | /* |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 5 | * Linux signal context definitions. The sigcontext includes a complex |
| 6 | * hierarchy of CPU and FPU state, available to user-space (on the stack) when |
| 7 | * a signal handler is executed. |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 8 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 9 | * As over the years this ABI grew from its very simple roots towards |
| 10 | * supporting more and more CPU state organically, some of the details (which |
| 11 | * were rather clever hacks back in the days) became a bit quirky by today. |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 12 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 13 | * The current ABI includes flexible provisions for future extensions, so we |
| 14 | * won't have to grow new quirks for quite some time. Promise! |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 17 | #include <linux/compiler.h> |
| 18 | #include <linux/types.h> |
| 19 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 20 | #define FP_XSTATE_MAGIC1 0x46505853U |
| 21 | #define FP_XSTATE_MAGIC2 0x46505845U |
| 22 | #define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2) |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 23 | |
| 24 | /* |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 25 | * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 26 | * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are |
| 27 | * used to extend the fpstate pointer in the sigcontext, which now includes the |
| 28 | * extended state information along with fpstate information. |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 29 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 30 | * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a |
| 31 | * sw_reserved.extended_size bytes large extended context area present. (The |
| 32 | * last 32-bit word of this extended area (at the |
| 33 | * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 34 | * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.) |
| 35 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 36 | * This extended area typically grows with newer CPUs that have larger and |
| 37 | * larger XSAVE areas. |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 38 | */ |
| 39 | struct _fpx_sw_bytes { |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 40 | /* |
| 41 | * If set to FP_XSTATE_MAGIC1 then this is an xstate context. |
| 42 | * 0 if a legacy frame. |
| 43 | */ |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 44 | __u32 magic1; |
| 45 | |
| 46 | /* |
| 47 | * Total size of the fpstate area: |
| 48 | * |
| 49 | * - if magic1 == 0 then it's sizeof(struct _fpstate) |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 50 | * - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate) |
| 51 | * plus extensions (if any) |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 52 | */ |
| 53 | __u32 extended_size; |
| 54 | |
| 55 | /* |
| 56 | * Feature bit mask (including FP/SSE/extended state) that is present |
| 57 | * in the memory layout: |
| 58 | */ |
| 59 | __u64 xfeatures; |
| 60 | |
| 61 | /* |
| 62 | * Actual XSAVE state size, based on the xfeatures saved in the layout. |
| 63 | * 'extended_size' is greater than 'xstate_size': |
| 64 | */ |
| 65 | __u32 xstate_size; |
| 66 | |
| 67 | /* For future use: */ |
| 68 | __u32 padding[7]; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 71 | /* |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 72 | * As documented in the iBCS2 standard: |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 73 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 74 | * The first part of "struct _fpstate" is just the normal i387 hardware setup, |
| 75 | * the extra "status" word is used to save the coprocessor status word before |
| 76 | * entering the handler. |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 77 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 78 | * The FPU state data structure has had to grow to accommodate the extended FPU |
| 79 | * state required by the Streaming SIMD Extensions. There is no documented |
| 80 | * standard to accomplish this at the moment. |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 81 | */ |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 82 | |
| 83 | /* 10-byte legacy floating point register: */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 84 | struct _fpreg { |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 85 | __u16 significand[4]; |
| 86 | __u16 exponent; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 87 | }; |
| 88 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 89 | /* 16-byte floating point register: */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 90 | struct _fpxreg { |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 91 | __u16 significand[4]; |
| 92 | __u16 exponent; |
| 93 | __u16 padding[3]; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 94 | }; |
| 95 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 96 | /* 16-byte XMM register: */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 97 | struct _xmmreg { |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 98 | __u32 element[4]; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 99 | }; |
| 100 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 101 | #define X86_FXSR_MAGIC 0x0000 |
| 102 | |
Ingo Molnar | 7bb0dc2 | 2015-09-05 09:32:35 +0200 | [diff] [blame] | 103 | /* |
| 104 | * The 32-bit FPU frame: |
| 105 | */ |
| 106 | struct _fpstate_32 { |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 107 | /* Legacy FPU environment: */ |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 108 | __u32 cw; |
| 109 | __u32 sw; |
| 110 | __u32 tag; |
| 111 | __u32 ipoff; |
| 112 | __u32 cssel; |
| 113 | __u32 dataoff; |
| 114 | __u32 datasel; |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 115 | struct _fpreg _st[8]; |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 116 | __u16 status; |
| 117 | __u16 magic; /* 0xffff: regular FPU data only */ |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 118 | /* 0x0000: FXSR FPU data */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 119 | |
| 120 | /* FXSR FPU environment */ |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 121 | __u32 _fxsr_env[6]; /* FXSR FPU env is ignored */ |
| 122 | __u32 mxcsr; |
| 123 | __u32 reserved; |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 124 | struct _fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ |
| 125 | struct _xmmreg _xmm[8]; /* First 8 XMM registers */ |
Ingo Molnar | 7bb0dc2 | 2015-09-05 09:32:35 +0200 | [diff] [blame] | 126 | union { |
| 127 | __u32 padding1[44]; /* Second 8 XMM registers plus padding */ |
| 128 | __u32 padding[44]; /* Alias name for old user-space */ |
| 129 | }; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 130 | |
| 131 | union { |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 132 | __u32 padding2[12]; |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 133 | struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 134 | }; |
| 135 | }; |
| 136 | |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 137 | /* |
Ingo Molnar | 7bb0dc2 | 2015-09-05 09:32:35 +0200 | [diff] [blame] | 138 | * The 64-bit FPU frame. (FXSAVE format and later) |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 139 | * |
| 140 | * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is |
| 141 | * larger: 'struct _xstate'. Note that 'struct _xstate' embedds |
| 142 | * 'struct _fpstate' so that you can always assume the _fpstate portion |
| 143 | * exists so that you can check the magic value. |
| 144 | * |
Peter Zijlstra | 0e2815d | 2015-09-09 09:12:44 +0200 | [diff] [blame] | 145 | * Note2: Reserved fields may someday contain valuable data. Always |
| 146 | * save/restore them when you change signal frames. |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 147 | */ |
Ingo Molnar | 7bb0dc2 | 2015-09-05 09:32:35 +0200 | [diff] [blame] | 148 | struct _fpstate_64 { |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 149 | __u16 cwd; |
| 150 | __u16 swd; |
| 151 | /* Note this is not the same as the 32-bit/x87/FSAVE twd: */ |
| 152 | __u16 twd; |
| 153 | __u16 fop; |
| 154 | __u64 rip; |
| 155 | __u64 rdp; |
| 156 | __u32 mxcsr; |
| 157 | __u32 mxcsr_mask; |
| 158 | __u32 st_space[32]; /* 8x FP registers, 16 bytes each */ |
| 159 | __u32 xmm_space[64]; /* 16x XMM registers, 16 bytes each */ |
| 160 | __u32 reserved2[12]; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 161 | union { |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 162 | __u32 reserved3[12]; |
| 163 | struct _fpx_sw_bytes sw_reserved; /* Potential extended state is encoded here */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 164 | }; |
| 165 | }; |
| 166 | |
Ingo Molnar | 7bb0dc2 | 2015-09-05 09:32:35 +0200 | [diff] [blame] | 167 | #ifdef __i386__ |
| 168 | # define _fpstate _fpstate_32 |
| 169 | #else |
| 170 | # define _fpstate _fpstate_64 |
| 171 | #endif |
| 172 | |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 173 | struct _header { |
| 174 | __u64 xfeatures; |
| 175 | __u64 reserved1[2]; |
| 176 | __u64 reserved2[5]; |
| 177 | }; |
| 178 | |
| 179 | struct _ymmh_state { |
| 180 | /* 16x YMM registers, 16 bytes each: */ |
| 181 | __u32 ymmh_space[64]; |
| 182 | }; |
| 183 | |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 184 | /* |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 185 | * Extended state pointed to by sigcontext::fpstate. |
| 186 | * |
| 187 | * In addition to the fpstate, information encoded in _xstate::xstate_hdr |
| 188 | * indicates the presence of other extended state information supported |
| 189 | * by the CPU and kernel: |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 190 | */ |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 191 | struct _xstate { |
| 192 | struct _fpstate fpstate; |
| 193 | struct _header xstate_hdr; |
| 194 | struct _ymmh_state ymmh; |
| 195 | /* New processor state extensions go here: */ |
| 196 | }; |
| 197 | |
Ingo Molnar | 8fcb346 | 2015-09-05 09:32:41 +0200 | [diff] [blame] | 198 | /* |
| 199 | * The 32-bit signal frame: |
| 200 | */ |
Ingo Molnar | f2c609b | 2015-09-05 09:32:38 +0200 | [diff] [blame] | 201 | struct sigcontext_32 { |
| 202 | __u16 gs, __gsh; |
| 203 | __u16 fs, __fsh; |
| 204 | __u16 es, __esh; |
| 205 | __u16 ds, __dsh; |
| 206 | __u32 di; |
| 207 | __u32 si; |
| 208 | __u32 bp; |
| 209 | __u32 sp; |
| 210 | __u32 bx; |
| 211 | __u32 dx; |
| 212 | __u32 cx; |
| 213 | __u32 ax; |
| 214 | __u32 trapno; |
| 215 | __u32 err; |
| 216 | __u32 ip; |
| 217 | __u16 cs, __csh; |
| 218 | __u32 flags; |
| 219 | __u32 sp_at_signal; |
| 220 | __u16 ss, __ssh; |
| 221 | |
| 222 | /* |
| 223 | * fpstate is really (struct _fpstate *) or (struct _xstate *) |
| 224 | * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved |
| 225 | * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end |
| 226 | * of extended memory layout. See comments at the definition of |
| 227 | * (struct _fpx_sw_bytes) |
| 228 | */ |
Ingo Molnar | 530e5c8 | 2015-09-05 09:32:39 +0200 | [diff] [blame] | 229 | __u32 fpstate; /* Zero when no FPU/extended context */ |
Ingo Molnar | f2c609b | 2015-09-05 09:32:38 +0200 | [diff] [blame] | 230 | __u32 oldmask; |
| 231 | __u32 cr2; |
| 232 | }; |
| 233 | |
Ingo Molnar | 8fcb346 | 2015-09-05 09:32:41 +0200 | [diff] [blame] | 234 | /* |
| 235 | * The 64-bit signal frame: |
| 236 | */ |
Ingo Molnar | f2c609b | 2015-09-05 09:32:38 +0200 | [diff] [blame] | 237 | struct sigcontext_64 { |
| 238 | __u64 r8; |
| 239 | __u64 r9; |
| 240 | __u64 r10; |
| 241 | __u64 r11; |
| 242 | __u64 r12; |
| 243 | __u64 r13; |
| 244 | __u64 r14; |
| 245 | __u64 r15; |
| 246 | __u64 di; |
| 247 | __u64 si; |
| 248 | __u64 bp; |
| 249 | __u64 bx; |
| 250 | __u64 dx; |
| 251 | __u64 ax; |
| 252 | __u64 cx; |
| 253 | __u64 sp; |
| 254 | __u64 ip; |
| 255 | __u64 flags; |
| 256 | __u16 cs; |
| 257 | __u16 gs; |
| 258 | __u16 fs; |
Andy Lutomirski | 6c25da5 | 2016-02-16 15:09:03 -0800 | [diff] [blame] | 259 | __u16 ss; |
Ingo Molnar | f2c609b | 2015-09-05 09:32:38 +0200 | [diff] [blame] | 260 | __u64 err; |
| 261 | __u64 trapno; |
| 262 | __u64 oldmask; |
| 263 | __u64 cr2; |
| 264 | |
| 265 | /* |
| 266 | * fpstate is really (struct _fpstate *) or (struct _xstate *) |
| 267 | * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved |
| 268 | * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end |
| 269 | * of extended memory layout. See comments at the definition of |
| 270 | * (struct _fpx_sw_bytes) |
| 271 | */ |
Ingo Molnar | 530e5c8 | 2015-09-05 09:32:39 +0200 | [diff] [blame] | 272 | __u64 fpstate; /* Zero when no FPU/extended context */ |
Ingo Molnar | f2c609b | 2015-09-05 09:32:38 +0200 | [diff] [blame] | 273 | __u64 reserved1[8]; |
| 274 | }; |
| 275 | |
| 276 | /* |
| 277 | * Create the real 'struct sigcontext' type: |
| 278 | */ |
| 279 | #ifdef __KERNEL__ |
| 280 | # ifdef __i386__ |
| 281 | # define sigcontext sigcontext_32 |
| 282 | # else |
| 283 | # define sigcontext sigcontext_64 |
| 284 | # endif |
| 285 | #endif |
| 286 | |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 287 | /* |
| 288 | * The old user-space sigcontext definition, just in case user-space still |
| 289 | * relies on it. The kernel definition (in asm/sigcontext.h) has unified |
| 290 | * field names but otherwise the same layout. |
| 291 | */ |
| 292 | #ifndef __KERNEL__ |
Ingo Molnar | 86e9fc3 | 2015-09-05 09:32:36 +0200 | [diff] [blame] | 293 | |
Ingo Molnar | 8fcb346 | 2015-09-05 09:32:41 +0200 | [diff] [blame] | 294 | #define _fpstate_ia32 _fpstate_32 |
| 295 | #define sigcontext_ia32 sigcontext_32 |
| 296 | |
Ingo Molnar | 86e9fc3 | 2015-09-05 09:32:36 +0200 | [diff] [blame] | 297 | |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 298 | # ifdef __i386__ |
| 299 | struct sigcontext { |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 300 | __u16 gs, __gsh; |
| 301 | __u16 fs, __fsh; |
| 302 | __u16 es, __esh; |
| 303 | __u16 ds, __dsh; |
| 304 | __u32 edi; |
| 305 | __u32 esi; |
| 306 | __u32 ebp; |
| 307 | __u32 esp; |
| 308 | __u32 ebx; |
| 309 | __u32 edx; |
| 310 | __u32 ecx; |
| 311 | __u32 eax; |
| 312 | __u32 trapno; |
| 313 | __u32 err; |
| 314 | __u32 eip; |
| 315 | __u16 cs, __csh; |
| 316 | __u32 eflags; |
| 317 | __u32 esp_at_signal; |
| 318 | __u16 ss, __ssh; |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 319 | struct _fpstate __user *fpstate; |
Ingo Molnar | 3f623a5 | 2015-09-05 09:32:33 +0200 | [diff] [blame] | 320 | __u32 oldmask; |
| 321 | __u32 cr2; |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 322 | }; |
| 323 | # else /* __x86_64__: */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 324 | struct sigcontext { |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 325 | __u64 r8; |
| 326 | __u64 r9; |
| 327 | __u64 r10; |
| 328 | __u64 r11; |
| 329 | __u64 r12; |
| 330 | __u64 r13; |
| 331 | __u64 r14; |
| 332 | __u64 r15; |
| 333 | __u64 rdi; |
| 334 | __u64 rsi; |
| 335 | __u64 rbp; |
| 336 | __u64 rbx; |
| 337 | __u64 rdx; |
| 338 | __u64 rax; |
| 339 | __u64 rcx; |
| 340 | __u64 rsp; |
| 341 | __u64 rip; |
| 342 | __u64 eflags; /* RFLAGS */ |
| 343 | __u16 cs; |
Andy Lutomirski | e54fdcc | 2016-02-16 15:09:01 -0800 | [diff] [blame] | 344 | |
| 345 | /* |
| 346 | * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"), |
| 347 | * Linux saved and restored fs and gs in these slots. This |
| 348 | * was counterproductive, as fsbase and gsbase were never |
| 349 | * saved, so arch_prctl was presumably unreliable. |
| 350 | * |
| 351 | * These slots should never be reused without extreme caution: |
| 352 | * |
| 353 | * - Some DOSEMU versions stash fs and gs in these slots manually, |
| 354 | * thus overwriting anything the kernel expects to be preserved |
| 355 | * in these slots. |
| 356 | * |
| 357 | * - If these slots are ever needed for any other purpose, |
| 358 | * there is some risk that very old 64-bit binaries could get |
| 359 | * confused. I doubt that many such binaries still work, |
| 360 | * though, since the same patch in 2.5.64 also removed the |
| 361 | * 64-bit set_thread_area syscall, so it appears that there |
| 362 | * is no TLS API beyond modify_ldt that works in both pre- |
| 363 | * and post-2.5.64 kernels. |
| 364 | * |
| 365 | * If the kernel ever adds explicit fs, gs, fsbase, and gsbase |
| 366 | * save/restore, it will most likely need to be opt-in and use |
| 367 | * different context slots. |
| 368 | */ |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 369 | __u16 gs; |
| 370 | __u16 fs; |
Andy Lutomirski | 6c25da5 | 2016-02-16 15:09:03 -0800 | [diff] [blame] | 371 | union { |
| 372 | __u16 ss; /* If UC_SIGCONTEXT_SS */ |
| 373 | __u16 __pad0; /* Alias name for old (!UC_SIGCONTEXT_SS) user-space */ |
| 374 | }; |
Ingo Molnar | cbf5f4f | 2015-09-05 09:32:31 +0200 | [diff] [blame] | 375 | __u64 err; |
| 376 | __u64 trapno; |
| 377 | __u64 oldmask; |
| 378 | __u64 cr2; |
| 379 | struct _fpstate __user *fpstate; /* Zero when no FPU context */ |
| 380 | # ifdef __ILP32__ |
| 381 | __u32 __fpstate_pad; |
| 382 | # endif |
| 383 | __u64 reserved1[8]; |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 384 | }; |
Ingo Molnar | 128f825 | 2015-09-05 09:32:32 +0200 | [diff] [blame] | 385 | # endif /* __x86_64__ */ |
| 386 | #endif /* !__KERNEL__ */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 387 | |
| 388 | #endif /* _UAPI_ASM_X86_SIGCONTEXT_H */ |