Dr Andrew Scott G7VAV

My photo
 
May 2024
Mo Tu We Th Fr Sa Su
29 30 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2
3 4 5 6 7 8 9


ucontext.h
001: /* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
002:    This file is part of the GNU C Library.
003: 
004:    The GNU C Library is free software; you can redistribute it and/or
005:    modify it under the terms of the GNU Lesser General Public
006:    License as published by the Free Software Foundation; either
007:    version 2.1 of the License, or (at your option) any later version.
008: 
009:    The GNU C Library is distributed in the hope that it will be useful,
010:    but WITHOUT ANY WARRANTY; without even the implied warranty of
011:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:    Lesser General Public License for more details.
013: 
014:    You should have received a copy of the GNU Lesser General Public
015:    License along with the GNU C Library; if not, write to the Free
016:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
017:    02111-1307 USA.  */
018: 
019: #ifndef _SYS_UCONTEXT_H
020: #define _SYS_UCONTEXT_H 1
021: 
022: #include <features.h>
023: #include <signal.h>
024: #include <bits/wordsize.h>
025: 
026: /* We need the signal context definitions even if they are not used
027:    included in <signal.h>.  */
028: #include <bits/sigcontext.h>
029: 
030: #if __WORDSIZE == 64
031: 
032: /* Type for general register.  */
033: typedef long int greg_t;
034: 
035: /* Number of general registers.  */
036: #define NGREG   23
037: 
038: /* Container for all general registers.  */
039: typedef greg_t gregset_t[NGREG];
040: 
041: #ifdef __USE_GNU
042: /* Number of each register in the `gregset_t' array.  */
043: enum
044: {
045:   REG_R8 = 0,
046: # define REG_R8         REG_R8
047:   REG_R9,
048: # define REG_R9         REG_R9
049:   REG_R10,
050: # define REG_R10        REG_R10
051:   REG_R11,
052: # define REG_R11        REG_R11
053:   REG_R12,
054: # define REG_R12        REG_R12
055:   REG_R13,
056: # define REG_R13        REG_R13
057:   REG_R14,
058: # define REG_R14        REG_R14
059:   REG_R15,
060: # define REG_R15        REG_R15
061:   REG_RDI,
062: # define REG_RDI        REG_RDI
063:   REG_RSI,
064: # define REG_RSI        REG_RSI
065:   REG_RBP,
066: # define REG_RBP        REG_RBP
067:   REG_RBX,
068: # define REG_RBX        REG_RBX
069:   REG_RDX,
070: # define REG_RDX        REG_RDX
071:   REG_RAX,
072: # define REG_RAX        REG_RAX
073:   REG_RCX,
074: # define REG_RCX        REG_RCX
075:   REG_RSP,
076: # define REG_RSP        REG_RSP
077:   REG_RIP,
078: # define REG_RIP        REG_RIP
079:   REG_EFL,
080: # define REG_EFL        REG_EFL
081:   REG_CSGSFS,           /* Actually short cs, gs, fs, __pad0.  */
082: # define REG_CSGSFS     REG_CSGSFS
083:   REG_ERR,
084: # define REG_ERR        REG_ERR
085:   REG_TRAPNO,
086: # define REG_TRAPNO     REG_TRAPNO
087:   REG_OLDMASK,
088: # define REG_OLDMASK    REG_OLDMASK
089:   REG_CR2
090: # define REG_CR2        REG_CR2
091: };
092: #endif
093: 
094: struct _libc_fpxreg
095: {
096:   unsigned short int significand[4];
097:   unsigned short int exponent;
098:   unsigned short int padding[3];
099: };
100: 
101: struct _libc_xmmreg
102: {
103:   __uint32_t    element[4];
104: };
105: 
106: struct _libc_fpstate
107: {
108:   /* 64-bit FXSAVE format.  */
109:   __uint16_t            cwd;
110:   __uint16_t            swd;
111:   __uint16_t            ftw;
112:   __uint16_t            fop;
113:   __uint64_t            rip;
114:   __uint64_t            rdp;
115:   __uint32_t            mxcsr;
116:   __uint32_t            mxcr_mask;
117:   struct _libc_fpxreg   _st[8];
118:   struct _libc_xmmreg   _xmm[16];
119:   __uint32_t            padding[24];
120: };
121: 
122: /* Structure to describe FPU registers.  */
123: typedef struct _libc_fpstate *fpregset_t;
124: 
125: /* Context to describe whole processor state.  */
126: typedef struct
127:   {
128:     gregset_t gregs;
129:     /* Note that fpregs is a pointer.  */
130:     fpregset_t fpregs;
131:     unsigned long __reserved1 [8];
132: } mcontext_t;
133: 
134: /* Userlevel context.  */
135: typedef struct ucontext
136:   {
137:     unsigned long int uc_flags;
138:     struct ucontext *uc_link;
139:     stack_t uc_stack;
140:     mcontext_t uc_mcontext;
141:     __sigset_t uc_sigmask;
142:     struct _libc_fpstate __fpregs_mem;
143:   } ucontext_t;
144: 
145: #else /* __WORDSIZE == 32 */
146: 
147: /* Type for general register.  */
148: typedef int greg_t;
149: 
150: /* Number of general registers.  */
151: #define NGREG   19
152: 
153: /* Container for all general registers.  */
154: typedef greg_t gregset_t[NGREG];
155: 
156: #ifdef __USE_GNU
157: /* Number of each register is the `gregset_t' array.  */
158: enum
159: {
160:   REG_GS = 0,
161: # define REG_GS         REG_GS
162:   REG_FS,
163: # define REG_FS         REG_FS
164:   REG_ES,
165: # define REG_ES         REG_ES
166:   REG_DS,
167: # define REG_DS         REG_DS
168:   REG_EDI,
169: # define REG_EDI        REG_EDI
170:   REG_ESI,
171: # define REG_ESI        REG_ESI
172:   REG_EBP,
173: # define REG_EBP        REG_EBP
174:   REG_ESP,
175: # define REG_ESP        REG_ESP
176:   REG_EBX,
177: # define REG_EBX        REG_EBX
178:   REG_EDX,
179: # define REG_EDX        REG_EDX
180:   REG_ECX,
181: # define REG_ECX        REG_ECX
182:   REG_EAX,
183: # define REG_EAX        REG_EAX
184:   REG_TRAPNO,
185: # define REG_TRAPNO     REG_TRAPNO
186:   REG_ERR,
187: # define REG_ERR        REG_ERR
188:   REG_EIP,
189: # define REG_EIP        REG_EIP
190:   REG_CS,
191: # define REG_CS         REG_CS
192:   REG_EFL,
193: # define REG_EFL        REG_EFL
194:   REG_UESP,
195: # define REG_UESP       REG_UESP
196:   REG_SS
197: # define REG_SS REG_SS
198: };
199: #endif
200: 
201: /* Definitions taken from the kernel headers.  */
202: struct _libc_fpreg
203: {
204:   unsigned short int significand[4];
205:   unsigned short int exponent;
206: };
207: 
208: struct _libc_fpstate
209: {
210:   unsigned long int cw;
211:   unsigned long int sw;
212:   unsigned long int tag;
213:   unsigned long int ipoff;
214:   unsigned long int cssel;
215:   unsigned long int dataoff;
216:   unsigned long int datasel;
217:   struct _libc_fpreg _st[8];
218:   unsigned long int status;
219: };
220: 
221: /* Structure to describe FPU registers.  */
222: typedef struct _libc_fpstate *fpregset_t;
223: 
224: /* Context to describe whole processor state.  */
225: typedef struct
226:   {
227:     gregset_t gregs;
228:     /* Due to Linux's history we have to use a pointer here.  The SysV/i386
229:        ABI requires a struct with the values.  */
230:     fpregset_t fpregs;
231:     unsigned long int oldmask;
232:     unsigned long int cr2;
233:   } mcontext_t;
234: 
235: /* Userlevel context.  */
236: typedef struct ucontext
237:   {
238:     unsigned long int uc_flags;
239:     struct ucontext *uc_link;
240:     stack_t uc_stack;
241:     mcontext_t uc_mcontext;
242:     __sigset_t uc_sigmask;
243:     struct _libc_fpstate __fpregs_mem;
244:   } ucontext_t;
245: 
246: #endif /* __WORDSIZE == 32 */
247: 
248: #endif /* sys/ucontext.h */
249: 


for client 18.119.172.146
© Andrew Scott 2006 - 2024,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/