1 /* Copyright (C) 1998, 1999 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 Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _SYS_UCONTEXT_H
20 #define _SYS_UCONTEXT_H 1
24 #include <bits/wordsize.h>
49 typedef unsigned long mc_greg_t
;
50 typedef mc_greg_t mc_gregset_t
[MC_NGREG
];
54 unsigned long *mcfq_addr
;
55 unsigned int mcfq_insn
;
60 unsigned int sregs
[32];
61 unsigned long dregs
[32];
62 long double qregs
[16];
64 unsigned long mcfpu_fsr
;
65 unsigned long mcfpu_fprs
;
66 unsigned long mcfpu_gsr
;
67 struct mc_fq
*mcfpu_fq
;
68 unsigned char mcfpu_qcnt
;
69 unsigned char mcfpu_qentsz
;
70 unsigned char mcfpu_enab
;
72 typedef struct mc_fpu mc_fpu_t
;
75 mc_gregset_t mc_gregs
;
81 typedef struct ucontext
{
82 struct ucontext
*uc_link
;
83 unsigned long uc_flags
;
84 unsigned long uc_sigmask
;
85 mcontext_t uc_mcontext
;
88 #endif /* __WORDISIZE == 64 */
91 * Location of the users' stored registers relative to R0.
92 * Usage is as an index into a gregset_t array or as u.u_ar0[XX].
115 * A gregset_t is defined as an array type for compatibility with the reference
116 * source. This is important due to differences in the way the C language
117 * treats arrays and structures as parameters.
119 * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)),
120 * but that the ABI defines it absolutely to be 21 (resp. 19).
126 #define REG_FPRS (20)
131 #else /* __WORDSIZE == 32 */
136 #endif /* __WORDSIZE == 32 */
138 typedef greg_t gregset_t
[NGREG
];
141 * The following structures define how a register window can appear on the
142 * stack. This structure is available (when required) through the `gwins'
143 * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the
144 * maximum number of outstanding regiters window defined in the SPARC
145 * architecture (*not* implementation).
147 #define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */
150 greg_t rw_local
[8]; /* locals */
151 greg_t rw_in
[8]; /* ins */
154 #define rw_fp rw_in[6] /* frame pointer */
155 #define rw_rtn rw_in[7] /* return address */
157 typedef struct gwindows
160 int *spbuf
[SPARC_MAXREGWINDOW
];
161 struct rwindow wbuf
[SPARC_MAXREGWINDOW
];
165 * Floating point definitions.
168 #define MAXFPQ 16 /* max # of fpu queue entries currently supported */
171 * struct fq defines the minimal format of a floating point instruction queue
172 * entry. The size of entries in the floating point queue are implementation
173 * dependent. The union FQu is guarenteed to be the first field in any ABI
174 * conformant system implementation. Any additional fields provided by an
175 * implementation should not be used applications designed to be ABI conformant. */
179 unsigned long *fpq_addr
; /* address */
180 unsigned long fpq_instr
; /* instruction */
185 union /* FPU inst/addr queue */
192 #define FPU_REGS_TYPE unsigned
193 #define FPU_DREGS_TYPE unsigned long long
194 #define V7_FPU_FSR_TYPE unsigned
195 #define V9_FPU_FSR_TYPE unsigned long long
196 #define V9_FPU_FPRS_TYPE unsigned
202 union { /* FPU floating point regs */
203 unsigned fpu_regs
[32]; /* 32 singles */
204 double fpu_dregs
[16]; /* 32 doubles */
205 long double fpu_qregs
[16]; /* 16 quads */
207 struct fq
*fpu_q
; /* ptr to array of FQ entries */
208 unsigned long fpu_fsr
; /* FPU status register */
209 unsigned char fpu_qcnt
; /* # of entries in saved FQ */
210 unsigned char fpu_q_entrysize
; /* # of bytes per FQ entry */
211 unsigned char fpu_en
; /* flag signifying fpu in use */
214 #else /* __WORDSIZE == 32 */
218 union { /* FPU floating point regs */
219 unsigned long long fpu_regs
[32]; /* 32 singles */
220 double fpu_dregs
[16]; /* 16 doubles */
222 struct fq
*fpu_q
; /* ptr to array of FQ entries */
223 unsigned fpu_fsr
; /* FPU status register */
224 unsigned char fpu_qcnt
; /* # of entries in saved FQ */
225 unsigned char fpu_q_entrysize
; /* # of bytes per FQ entry */
226 unsigned char fpu_en
; /* flag signifying fpu in use */
230 * The following structure is for associating extra register state with
231 * the ucontext structure and is kept within the uc_mcontext filler area.
233 * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to
234 * extra register state. The exact format of the extra register state
235 * pointed to by xrs_ptr is platform-dependent.
237 * Note: a platform may or may not manage extra register state.
241 unsigned int xrs_id
; /* indicates xrs_ptr validity */
242 void * xrs_ptr
; /* ptr to extra reg state */
245 #define XRS_ID 0x78727300 /* the string "xrs" */
249 gregset_t gregs
; /* general register set */
250 gwindows_t
*gwins
; /* POSSIBLE pointer to register windows */
251 fpregset_t fpregs
; /* floating point register set */
252 xrs_t xrs
; /* POSSIBLE extra register state association */
257 /* Userlevel context. */
258 typedef struct ucontext
260 unsigned long uc_flags
;
261 struct ucontext
*uc_link
;
262 unsigned long uc_sigmask
[4]; /* a svr4 sigset_t */
264 mcontext_t uc_mcontext
;
268 #endif /* __WORDSIZE == 32 */
269 #endif /* sys/ucontext.h */