]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / x86 / bits / sigcontext.h
CommitLineData
581c785b 1/* Copyright (C) 2002-2022 Free Software Foundation, Inc.
76d81302
AJ
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
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
76d81302
AJ
17
18#ifndef _BITS_SIGCONTEXT_H
19#define _BITS_SIGCONTEXT_H 1
20
21#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
22# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
23#endif
24
cfed8ece
JM
25#include <bits/types.h>
26
14adcbfc
L
27#define FP_XSTATE_MAGIC1 0x46505853U
28#define FP_XSTATE_MAGIC2 0x46505845U
c4f50205 29#define FP_XSTATE_MAGIC2_SIZE sizeof (FP_XSTATE_MAGIC2)
14adcbfc
L
30
31struct _fpx_sw_bytes
32{
33 __uint32_t magic1;
34 __uint32_t extended_size;
35 __uint64_t xstate_bv;
36 __uint32_t xstate_size;
fd9f30f6 37 __uint32_t __glibc_reserved1[7];
14adcbfc
L
38};
39
76d81302
AJ
40struct _fpreg
41{
42 unsigned short significand[4];
43 unsigned short exponent;
44};
45
46struct _fpxreg
47{
48 unsigned short significand[4];
49 unsigned short exponent;
fd9f30f6 50 unsigned short __glibc_reserved1[3];
76d81302
AJ
51};
52
53struct _xmmreg
54{
55 __uint32_t element[4];
56};
57
943b7261
AJ
58
59
553c7ea4 60#ifndef __x86_64__
943b7261 61
76d81302
AJ
62struct _fpstate
63{
64 /* Regular FPU environment. */
65 __uint32_t cw;
66 __uint32_t sw;
67 __uint32_t tag;
68 __uint32_t ipoff;
69 __uint32_t cssel;
70 __uint32_t dataoff;
71 __uint32_t datasel;
72 struct _fpreg _st[8];
73 unsigned short status;
74 unsigned short magic;
75
76 /* FXSR FPU environment. */
77 __uint32_t _fxsr_env[6];
78 __uint32_t mxcsr;
fd9f30f6 79 __uint32_t __glibc_reserved1;
0f8a3e95 80 struct _fpxreg _fxsr_st[8];
30ee7c7b 81 struct _xmmreg _xmm[8];
fd9f30f6 82 __uint32_t __glibc_reserved2[56];
76d81302
AJ
83};
84
437d7853
UD
85#ifndef sigcontext_struct
86/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
87 we need sigcontext. Some packages have come to rely on
88 sigcontext_struct being defined on 32-bit x86, so define this for
89 their benefit. */
90# define sigcontext_struct sigcontext
91#endif
92
14adcbfc
L
93#define X86_FXSR_MAGIC 0x0000
94
76d81302
AJ
95struct sigcontext
96{
97 unsigned short gs, __gsh;
98 unsigned short fs, __fsh;
99 unsigned short es, __esh;
100 unsigned short ds, __dsh;
101 unsigned long edi;
102 unsigned long esi;
103 unsigned long ebp;
104 unsigned long esp;
105 unsigned long ebx;
106 unsigned long edx;
107 unsigned long ecx;
108 unsigned long eax;
109 unsigned long trapno;
110 unsigned long err;
111 unsigned long eip;
112 unsigned short cs, __csh;
113 unsigned long eflags;
114 unsigned long esp_at_signal;
115 unsigned short ss, __ssh;
116 struct _fpstate * fpstate;
117 unsigned long oldmask;
118 unsigned long cr2;
119};
120
553c7ea4 121#else /* __x86_64__ */
76d81302 122
943b7261
AJ
123struct _fpstate
124{
3181d9d1 125 /* FPU environment matching the 64-bit FXSAVE layout. */
943b7261
AJ
126 __uint16_t cwd;
127 __uint16_t swd;
904e1ba9 128 __uint16_t ftw;
943b7261
AJ
129 __uint16_t fop;
130 __uint64_t rip;
131 __uint64_t rdp;
132 __uint32_t mxcsr;
133 __uint32_t mxcr_mask;
0f8a3e95 134 struct _fpxreg _st[8];
30ee7c7b 135 struct _xmmreg _xmm[16];
fd9f30f6 136 __uint32_t __glibc_reserved1[24];
943b7261
AJ
137};
138
76d81302
AJ
139struct sigcontext
140{
553c7ea4
L
141 __uint64_t r8;
142 __uint64_t r9;
143 __uint64_t r10;
144 __uint64_t r11;
145 __uint64_t r12;
146 __uint64_t r13;
147 __uint64_t r14;
148 __uint64_t r15;
149 __uint64_t rdi;
150 __uint64_t rsi;
151 __uint64_t rbp;
152 __uint64_t rbx;
153 __uint64_t rdx;
154 __uint64_t rax;
155 __uint64_t rcx;
156 __uint64_t rsp;
157 __uint64_t rip;
158 __uint64_t eflags;
46a1b875
AJ
159 unsigned short cs;
160 unsigned short gs;
161 unsigned short fs;
162 unsigned short __pad0;
553c7ea4
L
163 __uint64_t err;
164 __uint64_t trapno;
165 __uint64_t oldmask;
166 __uint64_t cr2;
167 __extension__ union
168 {
169 struct _fpstate * fpstate;
170 __uint64_t __fpstate_word;
171 };
172 __uint64_t __reserved1 [8];
76d81302
AJ
173};
174
553c7ea4 175#endif /* __x86_64__ */
76d81302 176
14adcbfc
L
177struct _xsave_hdr
178{
179 __uint64_t xstate_bv;
fd9f30f6
JM
180 __uint64_t __glibc_reserved1[2];
181 __uint64_t __glibc_reserved2[5];
14adcbfc
L
182};
183
184struct _ymmh_state
185{
186 __uint32_t ymmh_space[64];
187};
188
189struct _xstate
190{
191 struct _fpstate fpstate;
192 struct _xsave_hdr xstate_hdr;
193 struct _ymmh_state ymmh;
194};
195
76d81302 196#endif /* _BITS_SIGCONTEXT_H */