1/*	$NetBSD: freebsd_machdep.h,v 1.1 2017/08/08 08:04:06 maxv Exp $	*/
2
3/*
4 * Copyright (c) 1986, 1989, 1991, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * William Jolitz.
9 *
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.
21 *
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.
33 *
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
36 *
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
39 */
40#ifndef _FREEBSD_MACHDEP_H
41#define _FREEBSD_MACHDEP_H
42
43#include <compat/sys/sigtypes.h>
44
45/*
46 * signal support
47 */
48
49struct 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;
67};
68
69/*
70 * The sequence of the fields/registers in struct sigcontext should match
71 * those in mcontext_t.
72 */
73struct 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;
95	/*
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.
99	 */
100	int	sc_fpregs[28];		/* machine state (FPU): */
101	int	sc_spare[17];
102};
103
104struct 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;
111};
112
113void freebsd_syscall_intern(struct proc *);
114
115#endif /* _FREEBSD_MACHDEP_H */
116