1 /* $OpenBSD: pcb.h,v 1.3 1998/09/15 10:50:12 pefo Exp $ */
4 * SPDX-License-Identifier: BSD-3-Clause
6 * Copyright (c) 1988 University of Utah.
7 * Copyright (c) 1992, 1993
8 * The Regents of the University of California. All rights reserved.
10 * This code is derived from software contributed to Berkeley by
11 * the Systems Programming Group of the University of Utah Computer
12 * Science Department and Ralph Campbell.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * from: Utah Hdr: pcb.h 1.13 89/04/23
39 * from: @(#)pcb.h 8.1 (Berkeley) 6/10/93
40 * JNPR: pcb.h,v 1.2 2006/08/07 11:51:17 katta
44 #ifndef _MACHINE_PCB_H_
45 #define _MACHINE_PCB_H_
66 * Call ast if required
68 * XXX Do we really need to disable interrupts?
72 mfc0 t0, MIPS_COP_0_STATUS ;\
73 and a0, t0, MIPS_SR_INT_IE ;\
75 mtc0 t0, MIPS_COP_0_STATUS ;\
78 PTR_L s3, PC_CURPCB(s1) ;\
79 PTR_L s1, PC_CURTHREAD(s1) ;\
80 lw s2, TD_FLAGS(s1) ;\
81 li s0, TDF_ASTPENDING | TDF_NEEDRESCHED;\
83 mfc0 t0, MIPS_COP_0_STATUS ;\
85 mtc0 t0, MIPS_COP_0_STATUS ;\
89 PTR_LA s0, _C_LABEL(ast) ;\
91 PTR_ADDU a0, s3, U_PCB_REGS ;\
96 #define SAVE_U_PCB_REG(reg, offs, base) \
97 REG_S reg, U_PCB_REGS + (SZREG * offs) (base)
99 #define RESTORE_U_PCB_REG(reg, offs, base) \
100 REG_L reg, U_PCB_REGS + (SZREG * offs) (base)
102 #define SAVE_U_PCB_FPREG(reg, offs, base) \
103 FP_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
105 #define RESTORE_U_PCB_FPREG(reg, offs, base) \
106 FP_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
108 #define SAVE_U_PCB_FPSR(reg, offs, base) \
109 REG_S reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
111 #define RESTORE_U_PCB_FPSR(reg, offs, base) \
112 REG_L reg, U_PCB_FPREGS + (SZFPREG * offs) (base)
114 #define SAVE_U_PCB_CONTEXT(reg, offs, base) \
115 REG_S reg, U_PCB_CONTEXT + (SZREG * offs) (base)
117 #define RESTORE_U_PCB_CONTEXT(reg, offs, base) \
118 REG_L reg, U_PCB_CONTEXT + (SZREG * offs) (base)
121 #include <machine/frame.h>
124 * MIPS process control block
128 struct trapframe pcb_regs; /* saved CPU and registers */
129 __register_t pcb_context[14]; /* kernel context for resume */
130 void *pcb_onfault; /* for copyin/copyout faults */
135 extern struct pcb *curpcb; /* the current running pcb */
137 void makectx(struct trapframe *, struct pcb *);
138 int savectx(struct pcb *) __returns_twice;
143 #endif /* !_MACHINE_PCB_H_ */