ucontext.h revision 129198
1129198Scognet/* $NetBSD: mcontext.h,v 1.4 2003/10/08 22:43:01 thorpej Exp $ */ 2129198Scognet 3129198Scognet/*- 4129198Scognet * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. 587575Sobrien * All rights reserved. 687575Sobrien * 7129198Scognet * This code is derived from software contributed to The NetBSD Foundation 8129198Scognet * by Klaus Klein and by Jason R. Thorpe of Wasabi Systems, Inc. 987575Sobrien * 1087575Sobrien * Redistribution and use in source and binary forms, with or without 1187575Sobrien * modification, are permitted provided that the following conditions 1287575Sobrien * are met: 1387575Sobrien * 1. Redistributions of source code must retain the above copyright 1487575Sobrien * notice, this list of conditions and the following disclaimer. 1587575Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1687575Sobrien * notice, this list of conditions and the following disclaimer in the 1787575Sobrien * documentation and/or other materials provided with the distribution. 1887575Sobrien * 3. All advertising materials mentioning features or use of this software 1987575Sobrien * must display the following acknowledgement: 20129198Scognet * This product includes software developed by the NetBSD 21129198Scognet * Foundation, Inc. and its contributors. 22129198Scognet * 4. Neither the name of The NetBSD Foundation nor the names of its 23129198Scognet * contributors may be used to endorse or promote products derived 24129198Scognet * from this software without specific prior written permission. 2587575Sobrien * 26129198Scognet * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27129198Scognet * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28129198Scognet * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29129198Scognet * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30129198Scognet * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31129198Scognet * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32129198Scognet * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33129198Scognet * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34129198Scognet * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35129198Scognet * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36129198Scognet * POSSIBILITY OF SUCH DAMAGE. 3787575Sobrien * 3887575Sobrien * $FreeBSD: head/sys/arm/include/ucontext.h 129198 2004-05-14 11:46:45Z cognet $ 3987575Sobrien */ 4087575Sobrien 41129198Scognet#ifndef _MACHINE_MCONTEXT_H_ 42129198Scognet#define _MACHINE_MCONTEXT_H_ 43129198Scognet/* 44129198Scognet * General register state 45129198Scognet */ 46129198Scognet#define _NGREG 17 47129198Scognettypedef unsigned int __greg_t; 48129198Scognettypedef __greg_t __gregset_t[_NGREG]; 4987575Sobrien 50129198Scognet#define _REG_R0 0 51129198Scognet#define _REG_R1 1 52129198Scognet#define _REG_R2 2 53129198Scognet#define _REG_R3 3 54129198Scognet#define _REG_R4 4 55129198Scognet#define _REG_R5 5 56129198Scognet#define _REG_R6 6 57129198Scognet#define _REG_R7 7 58129198Scognet#define _REG_R8 8 59129198Scognet#define _REG_R9 9 60129198Scognet#define _REG_R10 10 61129198Scognet#define _REG_R11 11 62129198Scognet#define _REG_R12 12 63129198Scognet#define _REG_R13 13 64129198Scognet#define _REG_R14 14 65129198Scognet#define _REG_R15 15 66129198Scognet#define _REG_CPSR 16 67129198Scognet/* Convenience synonyms */ 68129198Scognet#define _REG_FP _REG_R11 69129198Scognet#define _REG_SP _REG_R13 70129198Scognet#define _REG_LR _REG_R14 71129198Scognet#define _REG_PC _REG_R15 7287575Sobrien 73129198Scognet/* 74129198Scognet * Floating point register state 75129198Scognet */ 76129198Scognet/* Note: the storage layout of this structure must be identical to ARMFPE! */ 77129198Scognettypedef struct { 78129198Scognet unsigned int __fp_fpsr; 79129198Scognet struct { 80129198Scognet unsigned int __fp_exponent; 81129198Scognet unsigned int __fp_mantissa_hi; 82129198Scognet unsigned int __fp_mantissa_lo; 83129198Scognet } __fp_fr[8]; 84129198Scognet} __fpregset_t; 85129198Scognet 86129198Scognettypedef struct { 87129198Scognet unsigned int __vfp_fpscr; 88129198Scognet unsigned int __vfp_fstmx[33]; 89129198Scognet unsigned int __vfp_fpsid; 90129198Scognet} __vfpregset_t; 91129198Scognet 92129198Scognettypedef struct { 93129198Scognet __gregset_t __gregs; 94129198Scognet union { 95129198Scognet __fpregset_t __fpregs; 96129198Scognet __vfpregset_t __vfpregs; 97129198Scognet } __fpu; 9887575Sobrien} mcontext_t; 9987575Sobrien 100129198Scognet/* Machine-dependent uc_flags */ 101129198Scognet#define _UC_ARM_VFP 0x00010000 /* FPU field is VFP */ 102129198Scognet 103129198Scognet/* used by signal delivery to indicate status of signal stack */ 104129198Scognet#define _UC_SETSTACK 0x00020000 105129198Scognet#define _UC_CLRSTACK 0x00040000 106129198Scognet 107129198Scognet#define _UC_MACHINE_PAD 3 /* Padding appended to ucontext_t */ 108129198Scognet 109129198Scognet#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP]) 110129198Scognet#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC]) 111129198Scognet#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_R0]) 112129198Scognet 113129198Scognet#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc) 114129198Scognet 115129198Scognet#endif /* !_MACHINE_MCONTEXT_H_ */ 116