1 /* $NetBSD: freebsd_machdep.h,v 1.8 2003/10/27 13:44:20 junyoung Exp $ */
4 * Copyright (c) 1986, 1989, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
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.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * from: @(#)signal.h 8.1 (Berkeley) 6/11/93
35 * from: Id: signal.h,v 1.4 1994/08/21 04:55:30 paul Exp
37 * from: @(#)frame.h 5.2 (Berkeley) 1/18/91
38 * from: Id: frame.h,v 1.10 1995/03/16 18:11:42 bde Exp
40 #ifndef _FREEBSD_MACHDEP_H
41 #define _FREEBSD_MACHDEP_H
43 #include <compat/sys/sigtypes.h>
49 struct freebsd_osigcontext
{
50 int sc_onstack
; /* sigstack state to restore */
51 sigset13_t sc_mask
; /* signal mask to restore */
52 int sc_esp
; /* machine state */
70 * The sequence of the fields/registers in struct sigcontext should match
71 * those in mcontext_t.
73 struct freebsd_sigcontext
{
74 sigset_t sc_mask
; /* signal mask to restore */
75 int sc_onstack
; /* sigstack state to restore */
76 int sc_gs
; /* machine state (struct trapframe): */
96 * XXX FPU state is 27 * 4 bytes h/w, 1 * 4 bytes s/w (probably not
97 * needed here), or that + 16 * 4 bytes for emulators (probably all
98 * needed here). The "spare" bytes are mostly not spare.
100 int sc_fpregs
[28]; /* machine state (FPU): */
104 struct freebsd_sigframe
{
107 struct freebsd_sigcontext
*sf_scp
;
110 struct freebsd_sigcontext sf_sc
;
114 * freebsd_ptrace(2) support
117 #define FREEBSD_USRSTACK 0xefbfe000 /* USRSTACK */
118 #define FREEBSD_U_AR0_OFFSET 0x0000045c /* offsetof(struct user, u_ar0) */
119 #define FREEBSD_U_SAVEFP_OFFSET 0x00000070
120 /* offsetof(struct user, u_pcb) + offsetof(struct pcb, pcb_savefpu) */
122 /* Exception/Trap Stack Frame */
123 struct freebsd_trapframe
{
135 /* below portion defined in 386 hardware */
140 /* below only when transitting rings (e.g. user to kernel) */
145 /* Environment information of floating point unit */
146 struct freebsd_env87
{
147 long en_cw
; /* control word (16bits) */
148 long en_sw
; /* status word (16bits) */
149 long en_tw
; /* tag word (16bits) */
150 long en_fip
; /* floating point instruction pointer */
151 u_short en_fcs
; /* floating code segment selector */
152 u_short en_opcode
; /* opcode last executed (11 bits ) */
153 long en_foo
; /* floating operand offset */
154 long en_fos
; /* floating operand segment selector */
157 /* Contents of each floating point accumulator */
158 struct freebsd_fpacc87
{
159 #ifdef dontdef /* too unportable */
160 u_long fp_mantlo
; /* mantissa low (31:0) */
161 u_long fp_manthi
; /* mantissa high (63:32) */
162 int fp_exp
:15; /* exponent */
163 int fp_sgn
:1; /* mantissa sign */
169 /* Floating point context */
170 struct freebsd_save87
{
171 struct freebsd_env87 sv_env
; /* floating point control/status */
172 struct freebsd_fpacc87 sv_ac
[8]; /* accumulator contents, 0-7 */
173 u_long sv_ex_sw
; /* status word for last exception */
175 * Bogus padding for emulators. Emulators should use their own
176 * struct and arrange to store into this struct (ending here)
177 * before it is inspected for ptracing or for core dumps. Some
178 * emulators overwrite the whole struct. We have no good way of
179 * knowing how much padding to leave. Leave just enough for the
180 * GPL emulator's i387_union (176 bytes total).
182 u_char sv_pad
[64]; /* padding; used by emulators */
185 struct freebsd_ptrace_reg
{
186 struct freebsd_trapframe freebsd_ptrace_regs
;
187 struct freebsd_save87 freebsd_ptrace_fpregs
;
190 /* sys/i386/include/exec.h */
191 #define FREEBSD___LDPGSZ 4096
193 void freebsd_syscall_intern(struct proc
*);
195 #endif /* _FREEBSD_MACHDEP_H */