proc.h revision 229677
1139825Simp/*	$OpenBSD: proc.h,v 1.2 1998/09/15 10:50:12 pefo Exp $	*/
2137822Smarius
3137822Smarius/*-
4137822Smarius * Copyright (c) 1992, 1993
5137822Smarius *	The Regents of the University of California.  All rights reserved.
6137822Smarius *
7137822Smarius * This code is derived from software contributed to Berkeley by
8137822Smarius * Ralph Campbell.
9137822Smarius *
10137822Smarius * Redistribution and use in source and binary forms, with or without
11137822Smarius * modification, are permitted provided that the following conditions
12137822Smarius * are met:
13137822Smarius * 1. Redistributions of source code must retain the above copyright
14137822Smarius *    notice, this list of conditions and the following disclaimer.
15137822Smarius * 2. Redistributions in binary form must reproduce the above copyright
16137822Smarius *    notice, this list of conditions and the following disclaimer in the
17137822Smarius *    documentation and/or other materials provided with the distribution.
18137822Smarius * 4. Neither the name of the University nor the names of its contributors
19137822Smarius *    may be used to endorse or promote products derived from this software
20137822Smarius *    without specific prior written permission.
21137822Smarius *
22137822Smarius * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23137822Smarius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24137822Smarius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25137822Smarius * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26137822Smarius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27137822Smarius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28137822Smarius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29137822Smarius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30137822Smarius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31200915Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32200915Smarius * SUCH DAMAGE.
33200915Smarius *
34200915Smarius *	@(#)proc.h	8.1 (Berkeley) 6/10/93
35200915Smarius *	JNPR: proc.h,v 1.7.2.1 2007/09/10 06:25:24 girish
36137822Smarius * $FreeBSD: head/sys/mips/include/proc.h 229677 2012-01-06 01:23:26Z gonzo $
37137822Smarius */
38137822Smarius
39137822Smarius#ifndef _MACHINE_PROC_H_
40137822Smarius#define	_MACHINE_PROC_H_
41137822Smarius
42137822Smarius#ifdef	CPU_CNMIPS
43137822Smarius#include <machine/octeon_cop2.h>
44146417Smarius#endif
45137822Smarius
46146417Smarius/*
47137822Smarius * Machine-dependent part of the proc structure.
48137822Smarius */
49137822Smariusstruct mdthread {
50137822Smarius	int		md_flags;	/* machine-dependent flags */
51137822Smarius#if defined(__mips_n64) || defined(__mips_n32) /*  PHYSADDR_64_BIT */
52137822Smarius	uint64_t	md_upte[KSTACK_PAGES];	/* ptes for mapping u pcb */
53137822Smarius#else
54137822Smarius	int		md_upte[KSTACK_PAGES];
55137822Smarius#endif
56137822Smarius	int		md_ss_addr;	/* single step address for ptrace */
57137822Smarius	int		md_ss_instr;	/* single step instruction for ptrace */
58170845Smarius	register_t	md_saved_intr;
59137822Smarius	u_int		md_spinlock_count;
60137822Smarius/* The following is CPU dependent, but kept in for compatibility */
61137822Smarius	int		md_pc_ctrl;	/* performance counter control */
62137822Smarius	int		md_pc_count;	/* performance counter */
63170845Smarius	int		md_pc_spill;	/* performance counter spill */
64170845Smarius	void		*md_tls;
65170845Smarius#ifdef	CPU_CNMIPS
66170845Smarius	struct octeon_cop2_state	*md_cop2; /* kernel context */
67170845Smarius	struct octeon_cop2_state	*md_ucop2; /* userland context */
68170845Smarius#define	COP2_OWNER_USERLAND	0x0000		/* Userland owns COP2 */
69170845Smarius#define	COP2_OWNER_KERNEL	0x0001		/* Kernel owns COP2 */
70170845Smarius	int		md_cop2owner;
71170845Smarius#endif
72170845Smarius};
73170845Smarius
74170845Smarius/* md_flags */
75170845Smarius#define	MDTD_FPUSED	0x0001		/* Process used the FPU */
76137822Smarius#define	MDTD_COP2USED	0x0002		/* Process used the COP2 */
77137822Smarius
78170845Smariusstruct mdproc {
79170845Smarius	/* empty */
80137822Smarius};
81170845Smarius
82137822Smarius#ifdef _KERNEL
83137822Smariusstruct thread;
84137822Smarius
85137822Smariusvoid	mips_cpu_switch(struct thread *, struct thread *, struct mtx *);
86137822Smariusvoid	mips_cpu_throw(struct thread *, struct thread *);
87137822Smarius
88137822Smariusstruct syscall_args {
89137822Smarius	u_int code;
90137822Smarius	struct sysent *callp;
91137822Smarius	register_t args[8];
92137822Smarius	int narg;
93227848Smarius	struct trapframe *trapframe;
94137822Smarius};
95137822Smarius#endif
96137822Smarius
97137822Smarius#ifdef __mips_n64
98137822Smarius#define	KINFO_PROC_SIZE 1088
99137822Smarius#else
100137822Smarius#define	KINFO_PROC_SIZE 816
101137822Smarius#endif
102137822Smarius
103137822Smarius#endif	/* !_MACHINE_PROC_H_ */
104137822Smarius