1178172Simp/* 2178172Simp * Copyright (c) 1992, 1993 3178172Simp * The Regents of the University of California. All rights reserved. 4178172Simp * 5178172Simp * This code is derived from software contributed to Berkeley by 6178172Simp * Ralph Campbell. 7178172Simp * 8178172Simp * Redistribution and use in source and binary forms, with or without 9178172Simp * modification, are permitted provided that the following conditions 10178172Simp * are met: 11178172Simp * 1. Redistributions of source code must retain the above copyright 12178172Simp * notice, this list of conditions and the following disclaimer. 13178172Simp * 2. Redistributions in binary form must reproduce the above copyright 14178172Simp * notice, this list of conditions and the following disclaimer in the 15178172Simp * documentation and/or other materials provided with the distribution. 16178172Simp * 4. Neither the name of the University nor the names of its contributors 17178172Simp * may be used to endorse or promote products derived from this software 18178172Simp * without specific prior written permission. 19178172Simp * 20178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30178172Simp * SUCH DAMAGE. 31178172Simp * 32178172Simp * @(#)ucontext.h 8.1 (Berkeley) 6/10/93 33178172Simp * JNPR: ucontext.h,v 1.2 2007/08/09 11:23:32 katta 34178172Simp * $FreeBSD$ 35178172Simp */ 36178172Simp 37178172Simp#ifndef _MACHINE_UCONTEXT_H_ 38178172Simp#define _MACHINE_UCONTEXT_H_ 39178172Simp 40178172Simp#ifndef _LOCORE 41178172Simp 42232449Sjmallett#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) 43232449Sjmallett#include "opt_compat.h" 44232449Sjmallett#endif 45232449Sjmallett 46178172Simptypedef struct __mcontext { 47178172Simp /* 48178172Simp * These fields must match the corresponding fields in struct 49178172Simp * sigcontext which follow 'sc_mask'. That way we can support 50178172Simp * struct sigcontext and ucontext_t at the same time. 51178172Simp */ 52178172Simp int mc_onstack; /* sigstack state to restore */ 53295561Skib __register_t mc_pc; /* pc at time of signal */ 54295561Skib __register_t mc_regs[32]; /* processor regs 0 to 31 */ 55295561Skib __register_t sr; /* status register */ 56295561Skib __register_t mullo, mulhi; /* mullo and mulhi registers... */ 57178172Simp int mc_fpused; /* fp has been used */ 58178172Simp f_register_t mc_fpregs[33]; /* fp regs 0 to 31 and csr */ 59295561Skib __register_t mc_fpc_eir; /* fp exception instruction reg */ 60202031Simp void *mc_tls; /* pointer to TLS area */ 61211862Sjchandra int __spare__[8]; /* XXX reserved */ 62178172Simp} mcontext_t; 63232449Sjmallett 64232449Sjmallett#if (defined(__mips_n32) || defined(__mips_n64)) && defined(COMPAT_FREEBSD32) 65232449Sjmallett#include <compat/freebsd32/freebsd32_signal.h> 66232449Sjmallett 67232449Sjmalletttypedef struct __mcontext32 { 68232449Sjmallett int mc_onstack; 69232449Sjmallett int32_t mc_pc; 70232449Sjmallett int32_t mc_regs[32]; 71232449Sjmallett int32_t sr; 72232449Sjmallett int32_t mullo, mulhi; 73232449Sjmallett int mc_fpused; 74232449Sjmallett int32_t mc_fpregs[33]; 75232449Sjmallett int32_t mc_fpc_eir; 76232584Sjmallett int32_t mc_tls; 77232449Sjmallett int __spare__[8]; 78232449Sjmallett} mcontext32_t; 79232449Sjmallett 80232449Sjmalletttypedef struct __ucontext32 { 81232449Sjmallett sigset_t uc_sigmask; 82232449Sjmallett mcontext32_t uc_mcontext; 83232449Sjmallett uint32_t uc_link; 84232449Sjmallett struct sigaltstack32 uc_stack; 85232449Sjmallett uint32_t uc_flags; 86232449Sjmallett uint32_t __spare__[4]; 87232449Sjmallett} ucontext32_t; 88178172Simp#endif 89232449Sjmallett#endif 90178172Simp 91204557Simp#ifndef SZREG 92204557Simp#if defined(__mips_o32) 93204557Simp#define SZREG 4 94202031Simp#else 95204557Simp#define SZREG 8 96202031Simp#endif 97204557Simp#endif 98178172Simp 99178172Simp/* offsets into mcontext_t */ 100202031Simp#define UCTX_REG(x) (4 + SZREG + (x)*SZREG) 101178172Simp 102178172Simp#define UCR_ZERO UCTX_REG(0) 103178172Simp#define UCR_AT UCTX_REG(1) 104178172Simp#define UCR_V0 UCTX_REG(2) 105178172Simp#define UCR_V1 UCTX_REG(3) 106178172Simp#define UCR_A0 UCTX_REG(4) 107178172Simp#define UCR_A1 UCTX_REG(5) 108178172Simp#define UCR_A2 UCTX_REG(6) 109178172Simp#define UCR_A3 UCTX_REG(7) 110178172Simp#define UCR_T0 UCTX_REG(8) 111178172Simp#define UCR_T1 UCTX_REG(9) 112178172Simp#define UCR_T2 UCTX_REG(10) 113178172Simp#define UCR_T3 UCTX_REG(11) 114178172Simp#define UCR_T4 UCTX_REG(12) 115178172Simp#define UCR_T5 UCTX_REG(13) 116178172Simp#define UCR_T6 UCTX_REG(14) 117178172Simp#define UCR_T7 UCTX_REG(15) 118178172Simp#define UCR_S0 UCTX_REG(16) 119178172Simp#define UCR_S1 UCTX_REG(17) 120178172Simp#define UCR_S2 UCTX_REG(18) 121178172Simp#define UCR_S3 UCTX_REG(19) 122178172Simp#define UCR_S4 UCTX_REG(20) 123178172Simp#define UCR_S5 UCTX_REG(21) 124178172Simp#define UCR_S6 UCTX_REG(22) 125178172Simp#define UCR_S7 UCTX_REG(23) 126178172Simp#define UCR_T8 UCTX_REG(24) 127178172Simp#define UCR_T9 UCTX_REG(25) 128178172Simp#define UCR_K0 UCTX_REG(26) 129178172Simp#define UCR_K1 UCTX_REG(27) 130178172Simp#define UCR_GP UCTX_REG(28) 131178172Simp#define UCR_SP UCTX_REG(29) 132178172Simp#define UCR_S8 UCTX_REG(30) 133178172Simp#define UCR_RA UCTX_REG(31) 134211862Sjchandra#define UCR_SR UCTX_REG(32) 135178172Simp#define UCR_MDLO UCTX_REG(33) 136178172Simp#define UCR_MDHI UCTX_REG(34) 137178172Simp 138178172Simp#endif /* !_MACHINE_UCONTEXT_H_ */ 139