1 /* Copyright (C) 1998-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _SYS_UCONTEXT_H
19 #define _SYS_UCONTEXT_H 1
23 #include <bits/types/sigset_t.h>
24 #include <bits/sigcontext.h>
25 #include <bits/types/stack_t.h>
27 #include <bits/wordsize.h>
53 typedef unsigned long mc_greg_t
;
54 typedef mc_greg_t mc_gregset_t
[MC_NGREG
];
58 unsigned long *mcfq_addr
;
59 unsigned int mcfq_insn
;
64 unsigned int sregs
[32];
65 unsigned long dregs
[32];
66 long double qregs
[16];
68 unsigned long mcfpu_fsr
;
69 unsigned long mcfpu_fprs
;
70 unsigned long mcfpu_gsr
;
71 struct mc_fq
*mcfpu_fq
;
72 unsigned char mcfpu_qcnt
;
73 unsigned char mcfpu_qentsz
;
74 unsigned char mcfpu_enab
;
76 typedef struct mc_fpu mc_fpu_t
;
79 mc_gregset_t mc_gregs
;
85 typedef struct ucontext
{
86 struct ucontext
*uc_link
;
87 unsigned long uc_flags
;
88 unsigned long __uc_sigmask
;
89 mcontext_t uc_mcontext
;
94 #endif /* __WORDISIZE == 64 */
97 * Location of the users' stored registers relative to R0.
98 * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
121 * A gregset_t is defined as an array type for compatibility with the reference
122 * source. This is important due to differences in the way the C language
123 * treats arrays and structures as parameters.
125 * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
126 * but that the ABI defines it absolutely to be 21 (resp. 19).
132 #define REG_FPRS (20)
137 #else /* __WORDSIZE == 32 */
142 #endif /* __WORDSIZE == 32 */
144 typedef greg_t gregset_t
[NGREG
];
147 * The following structures define how a register window can appear on the
148 * stack. This structure is available (when required) through the `gwins'
149 * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the
150 * maximum number of outstanding regiters window defined in the SPARC
151 * architecture (*not* implementation).
153 #define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */
156 greg_t rw_local
[8]; /* locals */
157 greg_t rw_in
[8]; /* ins */
160 #define rw_fp rw_in[6] /* frame pointer */
161 #define rw_rtn rw_in[7] /* return address */
163 typedef struct gwindows
166 int *spbuf
[SPARC_MAXREGWINDOW
];
167 struct rwindow wbuf
[SPARC_MAXREGWINDOW
];
171 * Floating point definitions.
174 #define MAXFPQ 16 /* max # of fpu queue entries currently supported */
177 * struct fq defines the minimal format of a floating point instruction queue
178 * entry. The size of entries in the floating point queue are implementation
179 * dependent. The union FQu is guarenteed to be the first field in any ABI
180 * conformant system implementation. Any additional fields provided by an
181 * implementation should not be used applications designed to be ABI conformant. */
185 unsigned long *fpq_addr
; /* address */
186 unsigned long fpq_instr
; /* instruction */
191 union /* FPU inst/addr queue */
198 #define FPU_REGS_TYPE unsigned
199 #define FPU_DREGS_TYPE unsigned long long
200 #define V7_FPU_FSR_TYPE unsigned
201 #define V9_FPU_FSR_TYPE unsigned long long
202 #define V9_FPU_FPRS_TYPE unsigned
208 union { /* FPU floating point regs */
209 unsigned fpu_regs
[32]; /* 32 singles */
210 double fpu_dregs
[32]; /* 32 doubles */
211 long double fpu_qregs
[16]; /* 16 quads */
213 struct fq
*fpu_q
; /* ptr to array of FQ entries */
214 unsigned long fpu_fsr
; /* FPU status register */
215 unsigned char fpu_qcnt
; /* # of entries in saved FQ */
216 unsigned char fpu_q_entrysize
; /* # of bytes per FQ entry */
217 unsigned char fpu_en
; /* flag signifying fpu in use */
220 #else /* __WORDSIZE == 32 */
224 union { /* FPU floating point regs */
225 __extension__
unsigned long long fpu_regs
[32]; /* 32 singles */
226 double fpu_dregs
[16]; /* 16 doubles */
228 struct fq
*fpu_q
; /* ptr to array of FQ entries */
229 unsigned fpu_fsr
; /* FPU status register */
230 unsigned char fpu_qcnt
; /* # of entries in saved FQ */
231 unsigned char fpu_q_entrysize
; /* # of bytes per FQ entry */
232 unsigned char fpu_en
; /* flag signifying fpu in use */
236 * The following structure is for associating extra register state with
237 * the ucontext structure and is kept within the uc_mcontext filler area.
239 * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to
240 * extra register state. The exact format of the extra register state
241 * pointed to by xrs_ptr is platform-dependent.
243 * Note: a platform may or may not manage extra register state.
247 unsigned int xrs_id
; /* indicates xrs_ptr validity */
248 void * xrs_ptr
; /* ptr to extra reg state */
251 #define XRS_ID 0x78727300 /* the string "xrs" */
255 gregset_t gregs
; /* general register set */
256 gwindows_t
*gwins
; /* POSSIBLE pointer to register windows */
257 fpregset_t fpregs
; /* floating point register set */
258 xrs_t xrs
; /* POSSIBLE extra register state association */
263 /* Userlevel context. */
264 typedef struct ucontext
266 unsigned long uc_flags
;
267 struct ucontext
*uc_link
;
270 mcontext_t uc_mcontext
;
273 #endif /* __WORDSIZE == 32 */
274 #endif /* sys/ucontext.h */