1249259Sdim/* 2249259Sdim * Copyright (c) 1992, 1993 3249259Sdim * The Regents of the University of California. All rights reserved. 4249259Sdim * 5249259Sdim * This code is derived from software contributed to Berkeley by 6249259Sdim * Ralph Campbell. 7249259Sdim * 8249259Sdim * Redistribution and use in source and binary forms, with or without 9249259Sdim * modification, are permitted provided that the following conditions 10249259Sdim * are met: 11249259Sdim * 1. Redistributions of source code must retain the above copyright 12249259Sdim * notice, this list of conditions and the following disclaimer. 13249259Sdim * 2. Redistributions in binary form must reproduce the above copyright 14249259Sdim * notice, this list of conditions and the following disclaimer in the 15249259Sdim * documentation and/or other materials provided with the distribution. 16249259Sdim * 4. Neither the name of the University nor the names of its contributors 17249259Sdim * may be used to endorse or promote products derived from this software 18249259Sdim * without specific prior written permission. 19249259Sdim * 20249259Sdim * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21249259Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22249259Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23249259Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24249259Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25249259Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26249259Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27249259Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28249259Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29249259Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30249259Sdim * SUCH DAMAGE. 31249259Sdim * 32249259Sdim * @(#)ucontext.h 8.1 (Berkeley) 6/10/93 33249259Sdim * JNPR: ucontext.h,v 1.2 2007/08/09 11:23:32 katta 34249259Sdim * $FreeBSD$ 35249259Sdim */ 36249259Sdim 37249259Sdim#ifndef _MACHINE_UCONTEXT_H_ 38249259Sdim#define _MACHINE_UCONTEXT_H_ 39249259Sdim 40249259Sdim#ifndef _LOCORE 41249259Sdim 42249259Sdim#if defined(_KERNEL) && !defined(KLD_MODULE) && !defined(_STANDALONE) 43249259Sdim#include "opt_compat.h" 44249259Sdim#endif 45249259Sdim 46249259Sdimtypedef struct __mcontext { 47249259Sdim /* 48249259Sdim * These fields must match the corresponding fields in struct 49249259Sdim * sigcontext which follow 'sc_mask'. That way we can support 50249259Sdim * struct sigcontext and ucontext_t at the same time. 51249259Sdim */ 52249259Sdim int mc_onstack; /* sigstack state to restore */ 53249259Sdim register_t mc_pc; /* pc at time of signal */ 54249259Sdim register_t mc_regs[32]; /* processor regs 0 to 31 */ 55249259Sdim register_t sr; /* status register */ 56249259Sdim register_t mullo, mulhi; /* mullo and mulhi registers... */ 57249259Sdim int mc_fpused; /* fp has been used */ 58249259Sdim f_register_t mc_fpregs[33]; /* fp regs 0 to 31 and csr */ 59249259Sdim register_t mc_fpc_eir; /* fp exception instruction reg */ 60249259Sdim void *mc_tls; /* pointer to TLS area */ 61249259Sdim int __spare__[8]; /* XXX reserved */ 62249259Sdim} mcontext_t; 63249259Sdim 64249259Sdim#if (defined(__mips_n32) || defined(__mips_n64)) && defined(COMPAT_FREEBSD32) 65249259Sdim#include <compat/freebsd32/freebsd32_signal.h> 66249259Sdim 67249259Sdimtypedef struct __mcontext32 { 68249259Sdim int mc_onstack; 69249259Sdim int32_t mc_pc; 70249259Sdim int32_t mc_regs[32]; 71249259Sdim int32_t sr; 72249259Sdim int32_t mullo, mulhi; 73249259Sdim int mc_fpused; 74249259Sdim int32_t mc_fpregs[33]; 75249259Sdim int32_t mc_fpc_eir; 76249259Sdim int32_t mc_tls; 77249259Sdim int __spare__[8]; 78249259Sdim} mcontext32_t; 79249259Sdim 80249259Sdimtypedef struct __ucontext32 { 81249259Sdim sigset_t uc_sigmask; 82249259Sdim mcontext32_t uc_mcontext; 83249259Sdim uint32_t uc_link; 84249259Sdim struct sigaltstack32 uc_stack; 85249259Sdim uint32_t uc_flags; 86249259Sdim uint32_t __spare__[4]; 87249259Sdim} ucontext32_t; 88249259Sdim#endif 89249259Sdim#endif 90249259Sdim 91249259Sdim#ifndef SZREG 92249259Sdim#if defined(__mips_o32) 93249259Sdim#define SZREG 4 94249259Sdim#else 95249259Sdim#define SZREG 8 96249259Sdim#endif 97249259Sdim#endif 98249259Sdim 99249259Sdim/* offsets into mcontext_t */ 100249259Sdim#define UCTX_REG(x) (4 + SZREG + (x)*SZREG) 101249259Sdim 102249259Sdim#define UCR_ZERO UCTX_REG(0) 103249259Sdim#define UCR_AT UCTX_REG(1) 104249259Sdim#define UCR_V0 UCTX_REG(2) 105249259Sdim#define UCR_V1 UCTX_REG(3) 106249259Sdim#define UCR_A0 UCTX_REG(4) 107249259Sdim#define UCR_A1 UCTX_REG(5) 108249259Sdim#define UCR_A2 UCTX_REG(6) 109249259Sdim#define UCR_A3 UCTX_REG(7) 110249259Sdim#define UCR_T0 UCTX_REG(8) 111249259Sdim#define UCR_T1 UCTX_REG(9) 112249259Sdim#define UCR_T2 UCTX_REG(10) 113249259Sdim#define UCR_T3 UCTX_REG(11) 114249259Sdim#define UCR_T4 UCTX_REG(12) 115249259Sdim#define UCR_T5 UCTX_REG(13) 116249259Sdim#define UCR_T6 UCTX_REG(14) 117249259Sdim#define UCR_T7 UCTX_REG(15) 118249259Sdim#define UCR_S0 UCTX_REG(16) 119249259Sdim#define UCR_S1 UCTX_REG(17) 120249259Sdim#define UCR_S2 UCTX_REG(18) 121249259Sdim#define UCR_S3 UCTX_REG(19) 122249259Sdim#define UCR_S4 UCTX_REG(20) 123249259Sdim#define UCR_S5 UCTX_REG(21) 124249259Sdim#define UCR_S6 UCTX_REG(22) 125249259Sdim#define UCR_S7 UCTX_REG(23) 126249259Sdim#define UCR_T8 UCTX_REG(24) 127249259Sdim#define UCR_T9 UCTX_REG(25) 128249259Sdim#define UCR_K0 UCTX_REG(26) 129249259Sdim#define UCR_K1 UCTX_REG(27) 130249259Sdim#define UCR_GP UCTX_REG(28) 131249259Sdim#define UCR_SP UCTX_REG(29) 132249259Sdim#define UCR_S8 UCTX_REG(30) 133249259Sdim#define UCR_RA UCTX_REG(31) 134249259Sdim#define UCR_SR UCTX_REG(32) 135249259Sdim#define UCR_MDLO UCTX_REG(33) 136249259Sdim#define UCR_MDHI UCTX_REG(34) 137249259Sdim 138249259Sdim#endif /* !_MACHINE_UCONTEXT_H_ */ 139249259Sdim