1/*-
2 * Copyright (c) 2003,2004 Marcel Moolenaar
3 * Copyright (c) 2000 Doug Rabson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 *	$FreeBSD$
28 */
29
30#ifndef _MACHINE_PCB_H_
31#define _MACHINE_PCB_H_
32
33#ifndef _MACHINE_REGSET_H_
34#include <machine/_regset.h>
35#endif
36
37/*
38 * PCB: process control block
39 */
40struct pmap;
41struct pcb {
42	struct _special		pcb_special;
43	struct _callee_saved	pcb_preserved;
44	struct _callee_saved_fp	pcb_preserved_fp;
45	struct _high_fp		pcb_high_fp;
46	struct pcpu		*pcb_fpcpu;
47	struct pmap 		*pcb_current_pmap;
48
49	uint64_t		pcb_onfault;	/* for copy faults */
50
51	/* IA32 specific registers. */
52	uint64_t		pcb_ia32_cflg;
53	uint64_t		pcb_ia32_eflag;
54	uint64_t		pcb_ia32_fcr;
55	uint64_t		pcb_ia32_fdr;
56	uint64_t		pcb_ia32_fir;
57	uint64_t		pcb_ia32_fsr;
58};
59
60#ifdef _KERNEL
61
62#define	savectx(p)	swapctx(p, NULL)
63
64struct trapframe;
65
66void makectx(struct trapframe *, struct pcb *);
67void restorectx(struct pcb *) __dead2;
68int swapctx(struct pcb *old, struct pcb *new) __returns_twice;
69
70void ia32_restorectx(struct pcb *);
71void ia32_savectx(struct pcb *) __returns_twice;
72
73#endif
74
75#endif /* _MACHINE_PCB_H_ */
76