1    	/* Copyright (C) 2002 Free Software Foundation, Inc.
2    	   This file is part of the GNU C Library.
3    	
4    	   The GNU C Library is free software; you can redistribute it and/or
5    	   modify it under the terms of the GNU Lesser General Public
6    	   License as published by the Free Software Foundation; either
7    	   version 2.1 of the License, or (at your option) any later version.
8    	
9    	   The GNU C Library is distributed in the hope that it will be useful,
10   	   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   	   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
12   	   Lesser General Public License for more details.
13   	
14   	   You should have received a copy of the GNU Lesser General Public
15   	   License along with the GNU C Library; if not, write to the Free
16   	   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17   	   02111-1307 USA.  */
18   	
19   	#ifndef _BITS_SIGCONTEXT_H
20   	#define _BITS_SIGCONTEXT_H  1
21   	
22   	#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
23   	# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
24   	#endif
25   	
26   	#include <bits/wordsize.h>
27   	
28   	struct _fpreg
29   	{
30   	  unsigned short significand[4];
31   	  unsigned short exponent;
32   	};
33   	
34   	struct _fpxreg
35   	{
36   	  unsigned short significand[4];
37   	  unsigned short exponent;
38   	  unsigned short padding[3];
39   	};
40   	
41   	struct _xmmreg
42   	{
43   	  __uint32_t	element[4];
44   	};
45   	
46   	
47   	
48   	#if __WORDSIZE == 32
49   	
50   	struct _fpstate
51   	{
52   	  /* Regular FPU environment.  */
53   	  __uint32_t	cw;
54   	  __uint32_t		sw;
55   	  __uint32_t		tag;
56   	  __uint32_t		ipoff;
57   	  __uint32_t		cssel;
58   	  __uint32_t		dataoff;
59   	  __uint32_t		datasel;
60   	  struct _fpreg	_st[8];
61   	  unsigned short status;
62   	  unsigned short magic;
63   	
64   	  /* FXSR FPU environment.  */
65   	  __uint32_t		_fxsr_env[6];
66   	  __uint32_t		mxcsr;
67   	  __uint32_t		reserved;
68   	  struct _fpxreg	_fxsr_st[8];
69   	  struct _xmmreg	_xmm[8];
70   	  __uint32_t		padding[56];
71   	};
72   	
73   	#ifndef sigcontext_struct
74   	/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
75   	   we need sigcontext.  Some packages have come to rely on
76   	   sigcontext_struct being defined on 32-bit x86, so define this for
77   	   their benefit.  */
78   	# define sigcontext_struct sigcontext
79   	#endif
80   	
81   	struct sigcontext
82   	{
83   	  unsigned short gs, __gsh;
84   	  unsigned short fs, __fsh;
85   	  unsigned short es, __esh;
86   	  unsigned short ds, __dsh;
87   	  unsigned long edi;
88   	  unsigned long esi;
89   	  unsigned long ebp;
90   	  unsigned long esp;
91   	  unsigned long ebx;
92   	  unsigned long edx;
93   	  unsigned long ecx;
94   	  unsigned long eax;
95   	  unsigned long trapno;
96   	  unsigned long err;
97   	  unsigned long eip;
98   	  unsigned short cs, __csh;
99   	  unsigned long eflags;
100  	  unsigned long esp_at_signal;
101  	  unsigned short ss, __ssh;
102  	  struct _fpstate * fpstate;
103  	  unsigned long oldmask;
104  	  unsigned long cr2;
105  	};
106  	
107  	#else /* __WORDSIZE == 64 */
108  	
109  	struct _fpstate
110  	{
111  	  /* FPU environment matching the 64-bit FXSAVE layout.  */
112  	  __uint16_t		cwd;
113  	  __uint16_t		swd;
114  	  __uint16_t		ftw;
115  	  __uint16_t		fop;
116  	  __uint64_t		rip;
117  	  __uint64_t		rdp;
118  	  __uint32_t		mxcsr;
119  	  __uint32_t		mxcr_mask;
120  	  struct _fpxreg	_st[8];
121  	  struct _xmmreg	_xmm[16];
122  	  __uint32_t		padding[24];
123  	};
124  	
125  	struct sigcontext
126  	{
127  	  unsigned long r8;
128  	  unsigned long r9;
129  	  unsigned long r10;
130  	  unsigned long r11;
131  	  unsigned long r12;
132  	  unsigned long r13;
133  	  unsigned long r14;
134  	  unsigned long r15;
135  	  unsigned long rdi;
136  	  unsigned long rsi;
137  	  unsigned long rbp;
138  	  unsigned long rbx;
139  	  unsigned long rdx;
140  	  unsigned long rax;
141  	  unsigned long rcx;
142  	  unsigned long rsp;
143  	  unsigned long rip;
144  	  unsigned long eflags;
145  	  unsigned short cs;
146  	  unsigned short gs;
147  	  unsigned short fs;
148  	  unsigned short __pad0;
149  	  unsigned long err;
150  	  unsigned long trapno;
151  	  unsigned long oldmask;
152  	  unsigned long cr2;
153  	  struct _fpstate * fpstate;
154  	  unsigned long __reserved1 [8];
155  	};
156  	
157  	#endif /* __WORDSIZE == 64 */
158  	
159  	#endif /* _BITS_SIGCONTEXT_H */
160