Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / i386 / include / freebsd_machdep.h
blob1b717e8582c0c8ae3801338d4aebcc3557a00599
1 /* $NetBSD: freebsd_machdep.h,v 1.8 2003/10/27 13:44:20 junyoung Exp $ */
3 /*
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
8 * William Jolitz.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
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
32 * SUCH DAMAGE.
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>
46 * signal support
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 */
53 int sc_ebp;
54 int sc_isp;
55 int sc_eip;
56 int sc_eflags;
57 int sc_es;
58 int sc_ds;
59 int sc_cs;
60 int sc_ss;
61 int sc_edi;
62 int sc_esi;
63 int sc_ebx;
64 int sc_edx;
65 int sc_ecx;
66 int sc_eax;
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): */
77 int sc_fs;
78 int sc_es;
79 int sc_ds;
80 int sc_edi;
81 int sc_esi;
82 int sc_ebp;
83 int sc_isp;
84 int sc_ebx;
85 int sc_edx;
86 int sc_ecx;
87 int sc_eax;
88 int sc_trapno;
89 int sc_err;
90 int sc_eip;
91 int sc_cs;
92 int sc_efl;
93 int sc_esp;
94 int sc_ss;
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): */
101 int sc_spare[17];
104 struct freebsd_sigframe {
105 int sf_signum;
106 int sf_code;
107 struct freebsd_sigcontext *sf_scp;
108 char *sf_addr;
109 sig_t sf_handler;
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 {
124 int tf_es;
125 int tf_ds;
126 int tf_edi;
127 int tf_esi;
128 int tf_ebp;
129 int tf_isp;
130 int tf_ebx;
131 int tf_edx;
132 int tf_ecx;
133 int tf_eax;
134 int tf_trapno;
135 /* below portion defined in 386 hardware */
136 int tf_err;
137 int tf_eip;
138 int tf_cs;
139 int tf_eflags;
140 /* below only when transitting rings (e.g. user to kernel) */
141 int tf_esp;
142 int tf_ss;
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 */
164 #else
165 u_char fp_bytes[10];
166 #endif
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 */