16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2af170c50SDavid Howells #ifndef _UAPI_ASM_X86_SIGCONTEXT_H
3af170c50SDavid Howells #define _UAPI_ASM_X86_SIGCONTEXT_H
4af170c50SDavid Howells 
5cbf5f4fbSIngo Molnar /*
60e2815deSPeter Zijlstra  * Linux signal context definitions. The sigcontext includes a complex
70e2815deSPeter Zijlstra  * hierarchy of CPU and FPU state, available to user-space (on the stack) when
80e2815deSPeter Zijlstra  * a signal handler is executed.
9cbf5f4fbSIngo Molnar  *
100e2815deSPeter Zijlstra  * As over the years this ABI grew from its very simple roots towards
110e2815deSPeter Zijlstra  * supporting more and more CPU state organically, some of the details (which
120e2815deSPeter Zijlstra  * were rather clever hacks back in the days) became a bit quirky by today.
13cbf5f4fbSIngo Molnar  *
140e2815deSPeter Zijlstra  * The current ABI includes flexible provisions for future extensions, so we
150e2815deSPeter Zijlstra  * won't have to grow new quirks for quite some time. Promise!
16cbf5f4fbSIngo Molnar  */
17cbf5f4fbSIngo Molnar 
18af170c50SDavid Howells #include <linux/compiler.h>
19af170c50SDavid Howells #include <linux/types.h>
20af170c50SDavid Howells 
21af170c50SDavid Howells #define FP_XSTATE_MAGIC1		0x46505853U
22af170c50SDavid Howells #define FP_XSTATE_MAGIC2		0x46505845U
23af170c50SDavid Howells #define FP_XSTATE_MAGIC2_SIZE		sizeof(FP_XSTATE_MAGIC2)
24af170c50SDavid Howells 
25af170c50SDavid Howells /*
26cbf5f4fbSIngo Molnar  * Bytes 464..511 in the current 512-byte layout of the FXSAVE/FXRSTOR frame
270e2815deSPeter Zijlstra  * are reserved for SW usage. On CPUs supporting XSAVE/XRSTOR, these bytes are
280e2815deSPeter Zijlstra  * used to extend the fpstate pointer in the sigcontext, which now includes the
290e2815deSPeter Zijlstra  * extended state information along with fpstate information.
30af170c50SDavid Howells  *
310e2815deSPeter Zijlstra  * If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then there's a
320e2815deSPeter Zijlstra  * sw_reserved.extended_size bytes large extended context area present. (The
330e2815deSPeter Zijlstra  * last 32-bit word of this extended area (at the
340e2815deSPeter Zijlstra  * fpstate+extended_size-FP_XSTATE_MAGIC2_SIZE address) is set to
35cbf5f4fbSIngo Molnar  * FP_XSTATE_MAGIC2 so that you can sanity check your size calculations.)
36cbf5f4fbSIngo Molnar  *
370e2815deSPeter Zijlstra  * This extended area typically grows with newer CPUs that have larger and
380e2815deSPeter Zijlstra  * larger XSAVE areas.
39af170c50SDavid Howells  */
40af170c50SDavid Howells struct _fpx_sw_bytes {
410e2815deSPeter Zijlstra 	/*
420e2815deSPeter Zijlstra 	 * If set to FP_XSTATE_MAGIC1 then this is an xstate context.
430e2815deSPeter Zijlstra 	 * 0 if a legacy frame.
440e2815deSPeter Zijlstra 	 */
45cbf5f4fbSIngo Molnar 	__u32				magic1;
46cbf5f4fbSIngo Molnar 
47cbf5f4fbSIngo Molnar 	/*
48cbf5f4fbSIngo Molnar 	 * Total size of the fpstate area:
49cbf5f4fbSIngo Molnar 	 *
50cbf5f4fbSIngo Molnar 	 *  - if magic1 == 0 then it's sizeof(struct _fpstate)
510e2815deSPeter Zijlstra 	 *  - if magic1 == FP_XSTATE_MAGIC1 then it's sizeof(struct _xstate)
520e2815deSPeter Zijlstra 	 *    plus extensions (if any)
53cbf5f4fbSIngo Molnar 	 */
54cbf5f4fbSIngo Molnar 	__u32				extended_size;
55cbf5f4fbSIngo Molnar 
56cbf5f4fbSIngo Molnar 	/*
57cbf5f4fbSIngo Molnar 	 * Feature bit mask (including FP/SSE/extended state) that is present
58cbf5f4fbSIngo Molnar 	 * in the memory layout:
59af170c50SDavid Howells 	 */
60400e4b20SIngo Molnar 	__u64				xfeatures;
61cbf5f4fbSIngo Molnar 
62cbf5f4fbSIngo Molnar 	/*
63cbf5f4fbSIngo Molnar 	 * Actual XSAVE state size, based on the xfeatures saved in the layout.
64cbf5f4fbSIngo Molnar 	 * 'extended_size' is greater than 'xstate_size':
65af170c50SDavid Howells 	 */
66cbf5f4fbSIngo Molnar 	__u32				xstate_size;
67cbf5f4fbSIngo Molnar 
68cbf5f4fbSIngo Molnar 	/* For future use: */
69cbf5f4fbSIngo Molnar 	__u32				padding[7];
70af170c50SDavid Howells };
71af170c50SDavid Howells 
72af170c50SDavid Howells /*
73cbf5f4fbSIngo Molnar  * As documented in the iBCS2 standard:
74af170c50SDavid Howells  *
750e2815deSPeter Zijlstra  * The first part of "struct _fpstate" is just the normal i387 hardware setup,
760e2815deSPeter Zijlstra  * the extra "status" word is used to save the coprocessor status word before
770e2815deSPeter Zijlstra  * entering the handler.
78af170c50SDavid Howells  *
790e2815deSPeter Zijlstra  * The FPU state data structure has had to grow to accommodate the extended FPU
800e2815deSPeter Zijlstra  * state required by the Streaming SIMD Extensions.  There is no documented
810e2815deSPeter Zijlstra  * standard to accomplish this at the moment.
82af170c50SDavid Howells  */
83cbf5f4fbSIngo Molnar 
84cbf5f4fbSIngo Molnar /* 10-byte legacy floating point register: */
85af170c50SDavid Howells struct _fpreg {
863f623a5bSIngo Molnar 	__u16				significand[4];
873f623a5bSIngo Molnar 	__u16				exponent;
88af170c50SDavid Howells };
89af170c50SDavid Howells 
90cbf5f4fbSIngo Molnar /* 16-byte floating point register: */
91af170c50SDavid Howells struct _fpxreg {
923f623a5bSIngo Molnar 	__u16				significand[4];
933f623a5bSIngo Molnar 	__u16				exponent;
943f623a5bSIngo Molnar 	__u16				padding[3];
95af170c50SDavid Howells };
96af170c50SDavid Howells 
97cbf5f4fbSIngo Molnar /* 16-byte XMM register: */
98af170c50SDavid Howells struct _xmmreg {
993f623a5bSIngo Molnar 	__u32				element[4];
100af170c50SDavid Howells };
101af170c50SDavid Howells 
102cbf5f4fbSIngo Molnar #define X86_FXSR_MAGIC			0x0000
103cbf5f4fbSIngo Molnar 
1047bb0dc22SIngo Molnar /*
1057bb0dc22SIngo Molnar  * The 32-bit FPU frame:
1067bb0dc22SIngo Molnar  */
1077bb0dc22SIngo Molnar struct _fpstate_32 {
108cbf5f4fbSIngo Molnar 	/* Legacy FPU environment: */
1093f623a5bSIngo Molnar 	__u32				cw;
1103f623a5bSIngo Molnar 	__u32				sw;
1113f623a5bSIngo Molnar 	__u32				tag;
1123f623a5bSIngo Molnar 	__u32				ipoff;
1133f623a5bSIngo Molnar 	__u32				cssel;
1143f623a5bSIngo Molnar 	__u32				dataoff;
1153f623a5bSIngo Molnar 	__u32				datasel;
116af170c50SDavid Howells 	struct _fpreg			_st[8];
1173f623a5bSIngo Molnar 	__u16				status;
1183f623a5bSIngo Molnar 	__u16				magic;		/* 0xffff: regular FPU data only */
119cbf5f4fbSIngo Molnar 							/* 0x0000: FXSR FPU data */
120af170c50SDavid Howells 
121af170c50SDavid Howells 	/* FXSR FPU environment */
1223f623a5bSIngo Molnar 	__u32				_fxsr_env[6];	/* FXSR FPU env is ignored */
1233f623a5bSIngo Molnar 	__u32				mxcsr;
1243f623a5bSIngo Molnar 	__u32				reserved;
125af170c50SDavid Howells 	struct _fpxreg			_fxsr_st[8];	/* FXSR FPU reg data is ignored */
126cbf5f4fbSIngo Molnar 	struct _xmmreg			_xmm[8];	/* First 8 XMM registers */
1277bb0dc22SIngo Molnar 	union {
1283f623a5bSIngo Molnar 		__u32			padding1[44];	/* Second 8 XMM registers plus padding */
1297bb0dc22SIngo Molnar 		__u32			padding[44];	/* Alias name for old user-space */
1307bb0dc22SIngo Molnar 	};
131af170c50SDavid Howells 
132af170c50SDavid Howells 	union {
1333f623a5bSIngo Molnar 		__u32			padding2[12];
134cbf5f4fbSIngo Molnar 		struct _fpx_sw_bytes	sw_reserved;	/* Potential extended state is encoded here */
135af170c50SDavid Howells 	};
136af170c50SDavid Howells };
137af170c50SDavid Howells 
138cbf5f4fbSIngo Molnar /*
1397bb0dc22SIngo Molnar  * The 64-bit FPU frame. (FXSAVE format and later)
140cbf5f4fbSIngo Molnar  *
141cbf5f4fbSIngo Molnar  * Note1: If sw_reserved.magic1 == FP_XSTATE_MAGIC1 then the structure is
142*d9f6e12fSIngo Molnar  *        larger: 'struct _xstate'. Note that 'struct _xstate' embeds
143cbf5f4fbSIngo Molnar  *        'struct _fpstate' so that you can always assume the _fpstate portion
144cbf5f4fbSIngo Molnar  *        exists so that you can check the magic value.
145cbf5f4fbSIngo Molnar  *
1460e2815deSPeter Zijlstra  * Note2: Reserved fields may someday contain valuable data. Always
1470e2815deSPeter Zijlstra  *	  save/restore them when you change signal frames.
148cbf5f4fbSIngo Molnar  */
1497bb0dc22SIngo Molnar struct _fpstate_64 {
150af170c50SDavid Howells 	__u16				cwd;
151af170c50SDavid Howells 	__u16				swd;
152cbf5f4fbSIngo Molnar 	/* Note this is not the same as the 32-bit/x87/FSAVE twd: */
153cbf5f4fbSIngo Molnar 	__u16				twd;
154af170c50SDavid Howells 	__u16				fop;
155af170c50SDavid Howells 	__u64				rip;
156af170c50SDavid Howells 	__u64				rdp;
157af170c50SDavid Howells 	__u32				mxcsr;
158af170c50SDavid Howells 	__u32				mxcsr_mask;
159cbf5f4fbSIngo Molnar 	__u32				st_space[32];	/*  8x  FP registers, 16 bytes each */
160cbf5f4fbSIngo Molnar 	__u32				xmm_space[64];	/* 16x XMM registers, 16 bytes each */
161af170c50SDavid Howells 	__u32				reserved2[12];
162af170c50SDavid Howells 	union {
163af170c50SDavid Howells 		__u32			reserved3[12];
164cbf5f4fbSIngo Molnar 		struct _fpx_sw_bytes	sw_reserved;	/* Potential extended state is encoded here */
165af170c50SDavid Howells 	};
166af170c50SDavid Howells };
167af170c50SDavid Howells 
1687bb0dc22SIngo Molnar #ifdef __i386__
1697bb0dc22SIngo Molnar # define _fpstate _fpstate_32
1707bb0dc22SIngo Molnar #else
1717bb0dc22SIngo Molnar # define _fpstate _fpstate_64
1727bb0dc22SIngo Molnar #endif
1737bb0dc22SIngo Molnar 
174128f8257SIngo Molnar struct _header {
175128f8257SIngo Molnar 	__u64				xfeatures;
176128f8257SIngo Molnar 	__u64				reserved1[2];
177128f8257SIngo Molnar 	__u64				reserved2[5];
178128f8257SIngo Molnar };
179128f8257SIngo Molnar 
180128f8257SIngo Molnar struct _ymmh_state {
181128f8257SIngo Molnar 	/* 16x YMM registers, 16 bytes each: */
182128f8257SIngo Molnar 	__u32				ymmh_space[64];
183128f8257SIngo Molnar };
184128f8257SIngo Molnar 
185af170c50SDavid Howells /*
186128f8257SIngo Molnar  * Extended state pointed to by sigcontext::fpstate.
187128f8257SIngo Molnar  *
188128f8257SIngo Molnar  * In addition to the fpstate, information encoded in _xstate::xstate_hdr
189128f8257SIngo Molnar  * indicates the presence of other extended state information supported
190128f8257SIngo Molnar  * by the CPU and kernel:
191af170c50SDavid Howells  */
192128f8257SIngo Molnar struct _xstate {
193128f8257SIngo Molnar 	struct _fpstate			fpstate;
194128f8257SIngo Molnar 	struct _header			xstate_hdr;
195128f8257SIngo Molnar 	struct _ymmh_state		ymmh;
196128f8257SIngo Molnar 	/* New processor state extensions go here: */
197128f8257SIngo Molnar };
198128f8257SIngo Molnar 
1998fcb346bSIngo Molnar /*
2008fcb346bSIngo Molnar  * The 32-bit signal frame:
2018fcb346bSIngo Molnar  */
202f2c609bcSIngo Molnar struct sigcontext_32 {
203f2c609bcSIngo Molnar 	__u16				gs, __gsh;
204f2c609bcSIngo Molnar 	__u16				fs, __fsh;
205f2c609bcSIngo Molnar 	__u16				es, __esh;
206f2c609bcSIngo Molnar 	__u16				ds, __dsh;
207f2c609bcSIngo Molnar 	__u32				di;
208f2c609bcSIngo Molnar 	__u32				si;
209f2c609bcSIngo Molnar 	__u32				bp;
210f2c609bcSIngo Molnar 	__u32				sp;
211f2c609bcSIngo Molnar 	__u32				bx;
212f2c609bcSIngo Molnar 	__u32				dx;
213f2c609bcSIngo Molnar 	__u32				cx;
214f2c609bcSIngo Molnar 	__u32				ax;
215f2c609bcSIngo Molnar 	__u32				trapno;
216f2c609bcSIngo Molnar 	__u32				err;
217f2c609bcSIngo Molnar 	__u32				ip;
218f2c609bcSIngo Molnar 	__u16				cs, __csh;
219f2c609bcSIngo Molnar 	__u32				flags;
220f2c609bcSIngo Molnar 	__u32				sp_at_signal;
221f2c609bcSIngo Molnar 	__u16				ss, __ssh;
222f2c609bcSIngo Molnar 
223f2c609bcSIngo Molnar 	/*
224f2c609bcSIngo Molnar 	 * fpstate is really (struct _fpstate *) or (struct _xstate *)
225f2c609bcSIngo Molnar 	 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
226f2c609bcSIngo Molnar 	 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
227f2c609bcSIngo Molnar 	 * of extended memory layout. See comments at the definition of
228f2c609bcSIngo Molnar 	 * (struct _fpx_sw_bytes)
229f2c609bcSIngo Molnar 	 */
230530e5c82SIngo Molnar 	__u32				fpstate; /* Zero when no FPU/extended context */
231f2c609bcSIngo Molnar 	__u32				oldmask;
232f2c609bcSIngo Molnar 	__u32				cr2;
233f2c609bcSIngo Molnar };
234f2c609bcSIngo Molnar 
2358fcb346bSIngo Molnar /*
2368fcb346bSIngo Molnar  * The 64-bit signal frame:
2378fcb346bSIngo Molnar  */
238f2c609bcSIngo Molnar struct sigcontext_64 {
239f2c609bcSIngo Molnar 	__u64				r8;
240f2c609bcSIngo Molnar 	__u64				r9;
241f2c609bcSIngo Molnar 	__u64				r10;
242f2c609bcSIngo Molnar 	__u64				r11;
243f2c609bcSIngo Molnar 	__u64				r12;
244f2c609bcSIngo Molnar 	__u64				r13;
245f2c609bcSIngo Molnar 	__u64				r14;
246f2c609bcSIngo Molnar 	__u64				r15;
247f2c609bcSIngo Molnar 	__u64				di;
248f2c609bcSIngo Molnar 	__u64				si;
249f2c609bcSIngo Molnar 	__u64				bp;
250f2c609bcSIngo Molnar 	__u64				bx;
251f2c609bcSIngo Molnar 	__u64				dx;
252f2c609bcSIngo Molnar 	__u64				ax;
253f2c609bcSIngo Molnar 	__u64				cx;
254f2c609bcSIngo Molnar 	__u64				sp;
255f2c609bcSIngo Molnar 	__u64				ip;
256f2c609bcSIngo Molnar 	__u64				flags;
257f2c609bcSIngo Molnar 	__u16				cs;
258f2c609bcSIngo Molnar 	__u16				gs;
259f2c609bcSIngo Molnar 	__u16				fs;
2606c25da5aSAndy Lutomirski 	__u16				ss;
261f2c609bcSIngo Molnar 	__u64				err;
262f2c609bcSIngo Molnar 	__u64				trapno;
263f2c609bcSIngo Molnar 	__u64				oldmask;
264f2c609bcSIngo Molnar 	__u64				cr2;
265f2c609bcSIngo Molnar 
266f2c609bcSIngo Molnar 	/*
267f2c609bcSIngo Molnar 	 * fpstate is really (struct _fpstate *) or (struct _xstate *)
268f2c609bcSIngo Molnar 	 * depending on the FP_XSTATE_MAGIC1 encoded in the SW reserved
269f2c609bcSIngo Molnar 	 * bytes of (struct _fpstate) and FP_XSTATE_MAGIC2 present at the end
270f2c609bcSIngo Molnar 	 * of extended memory layout. See comments at the definition of
271f2c609bcSIngo Molnar 	 * (struct _fpx_sw_bytes)
272f2c609bcSIngo Molnar 	 */
273530e5c82SIngo Molnar 	__u64				fpstate; /* Zero when no FPU/extended context */
274f2c609bcSIngo Molnar 	__u64				reserved1[8];
275f2c609bcSIngo Molnar };
276f2c609bcSIngo Molnar 
277f2c609bcSIngo Molnar /*
278f2c609bcSIngo Molnar  * Create the real 'struct sigcontext' type:
279f2c609bcSIngo Molnar  */
280f2c609bcSIngo Molnar #ifdef __KERNEL__
281f2c609bcSIngo Molnar # ifdef __i386__
282f2c609bcSIngo Molnar #  define sigcontext sigcontext_32
283f2c609bcSIngo Molnar # else
284f2c609bcSIngo Molnar #  define sigcontext sigcontext_64
285f2c609bcSIngo Molnar # endif
286f2c609bcSIngo Molnar #endif
287f2c609bcSIngo Molnar 
288128f8257SIngo Molnar /*
289128f8257SIngo Molnar  * The old user-space sigcontext definition, just in case user-space still
290128f8257SIngo Molnar  * relies on it. The kernel definition (in asm/sigcontext.h) has unified
291128f8257SIngo Molnar  * field names but otherwise the same layout.
292128f8257SIngo Molnar  */
293128f8257SIngo Molnar #ifndef __KERNEL__
29486e9fc3aSIngo Molnar 
29586e9fc3aSIngo Molnar #define _fpstate_ia32			_fpstate_32
2968fcb346bSIngo Molnar #define sigcontext_ia32			sigcontext_32
2978fcb346bSIngo Molnar 
29886e9fc3aSIngo Molnar 
299128f8257SIngo Molnar # ifdef __i386__
300128f8257SIngo Molnar struct sigcontext {
3013f623a5bSIngo Molnar 	__u16				gs, __gsh;
3023f623a5bSIngo Molnar 	__u16				fs, __fsh;
3033f623a5bSIngo Molnar 	__u16				es, __esh;
3043f623a5bSIngo Molnar 	__u16				ds, __dsh;
3053f623a5bSIngo Molnar 	__u32				edi;
3063f623a5bSIngo Molnar 	__u32				esi;
3073f623a5bSIngo Molnar 	__u32				ebp;
3083f623a5bSIngo Molnar 	__u32				esp;
3093f623a5bSIngo Molnar 	__u32				ebx;
3103f623a5bSIngo Molnar 	__u32				edx;
3113f623a5bSIngo Molnar 	__u32				ecx;
3123f623a5bSIngo Molnar 	__u32				eax;
3133f623a5bSIngo Molnar 	__u32				trapno;
3143f623a5bSIngo Molnar 	__u32				err;
3153f623a5bSIngo Molnar 	__u32				eip;
3163f623a5bSIngo Molnar 	__u16				cs, __csh;
3173f623a5bSIngo Molnar 	__u32				eflags;
3183f623a5bSIngo Molnar 	__u32				esp_at_signal;
3193f623a5bSIngo Molnar 	__u16				ss, __ssh;
320128f8257SIngo Molnar 	struct _fpstate __user		*fpstate;
3213f623a5bSIngo Molnar 	__u32				oldmask;
3223f623a5bSIngo Molnar 	__u32				cr2;
323128f8257SIngo Molnar };
324128f8257SIngo Molnar # else /* __x86_64__: */
325af170c50SDavid Howells struct sigcontext {
326af170c50SDavid Howells 	__u64				r8;
327af170c50SDavid Howells 	__u64				r9;
328af170c50SDavid Howells 	__u64				r10;
329af170c50SDavid Howells 	__u64				r11;
330af170c50SDavid Howells 	__u64				r12;
331af170c50SDavid Howells 	__u64				r13;
332af170c50SDavid Howells 	__u64				r14;
333af170c50SDavid Howells 	__u64				r15;
334af170c50SDavid Howells 	__u64				rdi;
335af170c50SDavid Howells 	__u64				rsi;
336af170c50SDavid Howells 	__u64				rbp;
337af170c50SDavid Howells 	__u64				rbx;
338af170c50SDavid Howells 	__u64				rdx;
339af170c50SDavid Howells 	__u64				rax;
340af170c50SDavid Howells 	__u64				rcx;
341af170c50SDavid Howells 	__u64				rsp;
342af170c50SDavid Howells 	__u64				rip;
343af170c50SDavid Howells 	__u64				eflags;		/* RFLAGS */
344af170c50SDavid Howells 	__u16				cs;
345e54fdccaSAndy Lutomirski 
346e54fdccaSAndy Lutomirski 	/*
347e54fdccaSAndy Lutomirski 	 * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"),
348e54fdccaSAndy Lutomirski 	 * Linux saved and restored fs and gs in these slots.  This
349e54fdccaSAndy Lutomirski 	 * was counterproductive, as fsbase and gsbase were never
350e54fdccaSAndy Lutomirski 	 * saved, so arch_prctl was presumably unreliable.
351e54fdccaSAndy Lutomirski 	 *
352e54fdccaSAndy Lutomirski 	 * These slots should never be reused without extreme caution:
353e54fdccaSAndy Lutomirski 	 *
354e54fdccaSAndy Lutomirski 	 *  - Some DOSEMU versions stash fs and gs in these slots manually,
355e54fdccaSAndy Lutomirski 	 *    thus overwriting anything the kernel expects to be preserved
356e54fdccaSAndy Lutomirski 	 *    in these slots.
357e54fdccaSAndy Lutomirski 	 *
358e54fdccaSAndy Lutomirski 	 *  - If these slots are ever needed for any other purpose,
359e54fdccaSAndy Lutomirski 	 *    there is some risk that very old 64-bit binaries could get
360e54fdccaSAndy Lutomirski 	 *    confused.  I doubt that many such binaries still work,
361e54fdccaSAndy Lutomirski 	 *    though, since the same patch in 2.5.64 also removed the
362e54fdccaSAndy Lutomirski 	 *    64-bit set_thread_area syscall, so it appears that there
363e54fdccaSAndy Lutomirski 	 *    is no TLS API beyond modify_ldt that works in both pre-
364e54fdccaSAndy Lutomirski 	 *    and post-2.5.64 kernels.
365e54fdccaSAndy Lutomirski 	 *
366e54fdccaSAndy Lutomirski 	 * If the kernel ever adds explicit fs, gs, fsbase, and gsbase
367e54fdccaSAndy Lutomirski 	 * save/restore, it will most likely need to be opt-in and use
368e54fdccaSAndy Lutomirski 	 * different context slots.
369e54fdccaSAndy Lutomirski 	 */
370ed596cdeSLinus Torvalds 	__u16				gs;
371ed596cdeSLinus Torvalds 	__u16				fs;
3726c25da5aSAndy Lutomirski 	union {
3736c25da5aSAndy Lutomirski 		__u16			ss;	/* If UC_SIGCONTEXT_SS */
3746c25da5aSAndy Lutomirski 		__u16			__pad0;	/* Alias name for old (!UC_SIGCONTEXT_SS) user-space */
3756c25da5aSAndy Lutomirski 	};
376af170c50SDavid Howells 	__u64				err;
377af170c50SDavid Howells 	__u64				trapno;
378af170c50SDavid Howells 	__u64				oldmask;
379af170c50SDavid Howells 	__u64				cr2;
380cbf5f4fbSIngo Molnar 	struct _fpstate __user		*fpstate;	/* Zero when no FPU context */
381af170c50SDavid Howells #  ifdef __ILP32__
382af170c50SDavid Howells 	__u32				__fpstate_pad;
383af170c50SDavid Howells #  endif
384af170c50SDavid Howells 	__u64				reserved1[8];
385af170c50SDavid Howells };
386cbf5f4fbSIngo Molnar # endif /* __x86_64__ */
387128f8257SIngo Molnar #endif /* !__KERNEL__ */
388af170c50SDavid Howells 
389af170c50SDavid Howells #endif /* _UAPI_ASM_X86_SIGCONTEXT_H */
390