4 # Copyright (c) 2001 The NetBSD Foundation, Inc.
7 # This code is derived from software contributed to The NetBSD Foundation
8 # by Matt Thomas <matt@3am-sfotware.com>.
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
33 include <machine/reg.h>
34 include <machine/regnum.h>
37 include <sys/siginfo.h>
39 define _OFFSETOF_UC_GREGS offsetof(ucontext_t, uc_mcontext.__gregs[0])
40 define _OFFSETOF_UC_GREGS_V0 offsetof(ucontext_t, uc_mcontext.__gregs[_REG_V0])
41 define _OFFSETOF_UC_GREGS_SP offsetof(ucontext_t, uc_mcontext.__gregs[_REG_SP])
42 define _OFFSETOF_UC_GREGS_EPC offsetof(ucontext_t, uc_mcontext.__gregs[_REG_EPC])
43 define _OFFSETOF_UC_LINK offsetof(ucontext_t, uc_link)
44 define UCONTEXT_SIZE sizeof(ucontext_t)
46 define _OFFSETOF_SC_REGS offsetof(struct sigcontext, sc_regs[0])
47 define _OFFSETOF_SC_REGS_V0 offsetof(struct sigcontext, sc_regs[_R_V0])
48 define _OFFSETOF_SC_REGS_S0 offsetof(struct sigcontext, sc_regs[_R_S0])
49 define _OFFSETOF_SC_REGS_S1 offsetof(struct sigcontext, sc_regs[_R_S1])
50 define _OFFSETOF_SC_REGS_S2 offsetof(struct sigcontext, sc_regs[_R_S2])
51 define _OFFSETOF_SC_REGS_S3 offsetof(struct sigcontext, sc_regs[_R_S3])
52 define _OFFSETOF_SC_REGS_S4 offsetof(struct sigcontext, sc_regs[_R_S4])
53 define _OFFSETOF_SC_REGS_S5 offsetof(struct sigcontext, sc_regs[_R_S5])
54 define _OFFSETOF_SC_REGS_S6 offsetof(struct sigcontext, sc_regs[_R_S6])
55 define _OFFSETOF_SC_REGS_S7 offsetof(struct sigcontext, sc_regs[_R_S7])
56 define _OFFSETOF_SC_REGS_S8 offsetof(struct sigcontext, sc_regs[_R_S8])
57 define _OFFSETOF_SC_REGS_SP offsetof(struct sigcontext, sc_regs[_R_SP])
58 define _OFFSETOF_SC_REGS_GP offsetof(struct sigcontext, sc_regs[_R_GP])
59 define _OFFSETOF_SC_FPREGS offsetof(struct sigcontext, sc_fpregs[0])
60 define _OFFSETOF_SC_FPREGS_F20 offsetof(struct sigcontext, sc_fpregs[20])
61 define _OFFSETOF_SC_FPREGS_F21 offsetof(struct sigcontext, sc_fpregs[21])
62 define _OFFSETOF_SC_FPREGS_F22 offsetof(struct sigcontext, sc_fpregs[22])
63 define _OFFSETOF_SC_FPREGS_F23 offsetof(struct sigcontext, sc_fpregs[23])
64 define _OFFSETOF_SC_FPREGS_F24 offsetof(struct sigcontext, sc_fpregs[24])
65 define _OFFSETOF_SC_FPREGS_F25 offsetof(struct sigcontext, sc_fpregs[25])
66 define _OFFSETOF_SC_FPREGS_F26 offsetof(struct sigcontext, sc_fpregs[26])
67 define _OFFSETOF_SC_FPREGS_F27 offsetof(struct sigcontext, sc_fpregs[27])
68 define _OFFSETOF_SC_FPREGS_F28 offsetof(struct sigcontext, sc_fpregs[28])
69 define _OFFSETOF_SC_FPREGS_F29 offsetof(struct sigcontext, sc_fpregs[29])
70 define _OFFSETOF_SC_FPREGS_F30 offsetof(struct sigcontext, sc_fpregs[30])
71 define _OFFSETOF_SC_FPREGS_F31 offsetof(struct sigcontext, sc_fpregs[31])
72 define _OFFSETOF_SC_FPREGS_FCSR offsetof(struct sigcontext, sc_fpregs[32])
73 define _OFFSETOF_SC_PC offsetof(struct sigcontext, sc_pc)
74 define _OFFSETOF_SC_MASK offsetof(struct sigcontext, sc_mask)
75 define _OFFSETOF_SC_MASK13 offsetof(struct sigcontext, __sc_mask13)
76 define _OFFSETOF_SC_ONSTACK offsetof(struct sigcontext, sc_onstack)
77 define _OFFSETOF_SC_FPUSED offsetof(struct sigcontext, sc_fpused)
79 define SIGINFO_SIZE sizeof(siginfo_t)
81 define STACK_T_SIZE ((sizeof(stack_t) + 2 * sizeof(register_t) - 1) & -(2 * sizeof(register_t)))
82 define _OFFSETOF_STACK_T_SP offsetof(stack_t, ss_sp)
83 define _OFFSETOF_STACK_T_SIZE offsetof(stack_t, ss_size)
84 define _OFFSETOF_STACK_T_FLAGS offsetof(stack_t, ss_flags)
86 define SS_ONSTACK SS_ONSTACK