]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/Arm/machine/mcontext.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / Include / Arm / machine / mcontext.h
CommitLineData
2aa62f2b 1/* $NetBSD: mcontext.h,v 1.5 2005/12/11 12:16:47 christos Exp $ */\r
2\r
3/*-\r
4 * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.\r
5 * All rights reserved.\r
6 *\r
7 * This code is derived from software contributed to The NetBSD Foundation\r
8 * by Klaus Klein and by Jason R. Thorpe of Wasabi Systems, Inc.\r
9 *\r
10 * Redistribution and use in source and binary forms, with or without\r
11 * modification, are permitted provided that the following conditions\r
12 * are met:\r
13 * 1. Redistributions of source code must retain the above copyright\r
14 * notice, this list of conditions and the following disclaimer.\r
15 * 2. Redistributions in binary form must reproduce the above copyright\r
16 * notice, this list of conditions and the following disclaimer in the\r
17 * documentation and/or other materials provided with the distribution.\r
18 * 3. All advertising materials mentioning features or use of this software\r
19 * must display the following acknowledgement:\r
20 * This product includes software developed by the NetBSD\r
21 * Foundation, Inc. and its contributors.\r
22 * 4. Neither the name of The NetBSD Foundation nor the names of its\r
23 * contributors may be used to endorse or promote products derived\r
24 * from this software without specific prior written permission.\r
25 *\r
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
36 * POSSIBILITY OF SUCH DAMAGE.\r
37 */\r
38\r
39#ifndef _ARM_MCONTEXT_H_\r
40#define _ARM_MCONTEXT_H_\r
41\r
42/*\r
43 * General register state\r
44 */\r
45#define _NGREG 17\r
46typedef unsigned int __greg_t;\r
47typedef __greg_t __gregset_t[_NGREG];\r
48\r
49#define _REG_R0 0\r
50#define _REG_R1 1\r
51#define _REG_R2 2\r
52#define _REG_R3 3\r
53#define _REG_R4 4\r
54#define _REG_R5 5\r
55#define _REG_R6 6\r
56#define _REG_R7 7\r
57#define _REG_R8 8\r
58#define _REG_R9 9\r
59#define _REG_R10 10\r
60#define _REG_R11 11\r
61#define _REG_R12 12\r
62#define _REG_R13 13\r
63#define _REG_R14 14\r
64#define _REG_R15 15\r
65#define _REG_CPSR 16\r
66/* Convenience synonyms */\r
67#define _REG_FP _REG_R11\r
68#define _REG_SP _REG_R13\r
69#define _REG_LR _REG_R14\r
70#define _REG_PC _REG_R15\r
71\r
72/*\r
73 * Floating point register state\r
74 */\r
75/* Note: the storage layout of this structure must be identical to ARMFPE! */\r
76typedef struct {\r
77 unsigned int __fp_fpsr;\r
78 struct {\r
79 unsigned int __fp_exponent;\r
80 unsigned int __fp_mantissa_hi;\r
81 unsigned int __fp_mantissa_lo;\r
82 } __fp_fr[8];\r
83} __fpregset_t;\r
84\r
85typedef struct {\r
86 unsigned int __vfp_fpscr;\r
87 unsigned int __vfp_fstmx[33];\r
88 unsigned int __vfp_fpsid;\r
89} __vfpregset_t;\r
90\r
91typedef struct {\r
92 __gregset_t __gregs;\r
93 union {\r
94 __fpregset_t __fpregs;\r
95 __vfpregset_t __vfpregs;\r
96 } __fpu;\r
97} mcontext_t;\r
98\r
99/* Machine-dependent uc_flags */\r
100#define _UC_ARM_VFP 0x00010000 /* FPU field is VFP */\r
101\r
102/* used by signal delivery to indicate status of signal stack */\r
103#define _UC_SETSTACK 0x00020000\r
104#define _UC_CLRSTACK 0x00040000\r
105\r
106#define _UC_MACHINE_PAD 3 /* Padding appended to ucontext_t */\r
107\r
108#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_SP])\r
109#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC])\r
110#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_R0])\r
111\r
112#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)\r
113\r
114#endif /* !_ARM_MCONTEXT_H_ */\r