1178172Simp/*	$OpenBSD: pcb.h,v 1.3 1998/09/15 10:50:12 pefo Exp $	*/
2178172Simp
3178172Simp/*-
4178172Simp * Copyright (c) 1988 University of Utah.
5178172Simp * Copyright (c) 1992, 1993
6178172Simp *	The Regents of the University of California.  All rights reserved.
7178172Simp *
8178172Simp * This code is derived from software contributed to Berkeley by
9178172Simp * the Systems Programming Group of the University of Utah Computer
10178172Simp * Science Department and Ralph Campbell.
11178172Simp *
12178172Simp * Redistribution and use in source and binary forms, with or without
13178172Simp * modification, are permitted provided that the following conditions
14178172Simp * are met:
15178172Simp * 1. Redistributions of source code must retain the above copyright
16178172Simp *    notice, this list of conditions and the following disclaimer.
17178172Simp * 2. Redistributions in binary form must reproduce the above copyright
18178172Simp *    notice, this list of conditions and the following disclaimer in the
19178172Simp *    documentation and/or other materials provided with the distribution.
20178172Simp * 4. Neither the name of the University nor the names of its contributors
21178172Simp *    may be used to endorse or promote products derived from this software
22178172Simp *    without specific prior written permission.
23178172Simp *
24178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34178172Simp * SUCH DAMAGE.
35178172Simp *
36178172Simp *	from: Utah Hdr: pcb.h 1.13 89/04/23
37178172Simp *	from: @(#)pcb.h 8.1 (Berkeley) 6/10/93
38178172Simp *	JNPR: pcb.h,v 1.2 2006/08/07 11:51:17 katta
39178172Simp * $FreeBSD$
40178172Simp */
41178172Simp
42178172Simp#ifndef _MACHINE_PCB_H_
43178172Simp#define	_MACHINE_PCB_H_
44178172Simp
45178172Simp/*
46178172Simp * used by switch.S
47178172Simp */
48211862Sjchandra#define	PCB_REG_S0	0
49211862Sjchandra#define	PCB_REG_S1	1
50211862Sjchandra#define	PCB_REG_S2	2
51211862Sjchandra#define	PCB_REG_S3	3
52211862Sjchandra#define	PCB_REG_S4	4
53211862Sjchandra#define	PCB_REG_S5	5
54211862Sjchandra#define	PCB_REG_S6	6
55211862Sjchandra#define	PCB_REG_S7	7
56211862Sjchandra#define	PCB_REG_SP	8
57211862Sjchandra#define	PCB_REG_S8	9
58211862Sjchandra#define	PCB_REG_RA	10
59211862Sjchandra#define	PCB_REG_SR	11
60211862Sjchandra#define	PCB_REG_GP	12
61211862Sjchandra#define	PCB_REG_PC	13
62178172Simp
63249882Simp#ifndef LOCORE
64249882Simp#include <machine/frame.h>
65178172Simp
66249882Simp/*
67249882Simp * MIPS process control block
68249882Simp */
69249882Simpstruct pcb
70249882Simp{
71249882Simp	struct trapframe pcb_regs;	/* saved CPU and registers */
72249882Simp	__register_t pcb_context[14];	/* kernel context for resume */
73249882Simp	void *pcb_onfault;		/* for copyin/copyout faults */
74249882Simp	register_t pcb_tpc;
75249882Simp};
76249882Simp
77178172Simp#ifdef _KERNEL
78178172Simpextern struct pcb *curpcb;		/* the current running pcb */
79178172Simp
80178172Simpvoid makectx(struct trapframe *, struct pcb *);
81234785Sdimint savectx(struct pcb *) __returns_twice;
82178172Simp#endif
83249882Simp#endif
84178172Simp
85178172Simp#endif	/* !_MACHINE_PCB_H_ */
86