proc.h revision 232449
1296435Spfg/*	$OpenBSD: proc.h,v 1.2 1998/09/15 10:50:12 pefo Exp $	*/
2276881Sbapt
3276881Sbapt/*-
4276881Sbapt * Copyright (c) 1992, 1993
5276881Sbapt *	The Regents of the University of California.  All rights reserved.
6276881Sbapt *
7276881Sbapt * This code is derived from software contributed to Berkeley by
8276881Sbapt * Ralph Campbell.
9276881Sbapt *
10276881Sbapt * Redistribution and use in source and binary forms, with or without
11276881Sbapt * modification, are permitted provided that the following conditions
12276881Sbapt * are met:
13276881Sbapt * 1. Redistributions of source code must retain the above copyright
14276881Sbapt *    notice, this list of conditions and the following disclaimer.
15276881Sbapt * 2. Redistributions in binary form must reproduce the above copyright
16276881Sbapt *    notice, this list of conditions and the following disclaimer in the
17276881Sbapt *    documentation and/or other materials provided with the distribution.
18276881Sbapt * 4. Neither the name of the University nor the names of its contributors
19276881Sbapt *    may be used to endorse or promote products derived from this software
20276881Sbapt *    without specific prior written permission.
21276881Sbapt *
22276881Sbapt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23276881Sbapt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24276881Sbapt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25276881Sbapt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26276881Sbapt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27276881Sbapt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28276881Sbapt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29276881Sbapt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30276881Sbapt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31276881Sbapt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32276881Sbapt * SUCH DAMAGE.
33276881Sbapt *
34296435Spfg *	@(#)proc.h	8.1 (Berkeley) 6/10/93
35276881Sbapt *	JNPR: proc.h,v 1.7.2.1 2007/09/10 06:25:24 girish
36276881Sbapt * $FreeBSD: head/sys/mips/include/proc.h 232449 2012-03-03 08:19:18Z jmallett $
37276881Sbapt */
38276881Sbapt
39296435Spfg#ifndef _MACHINE_PROC_H_
40276881Sbapt#define	_MACHINE_PROC_H_
41276881Sbapt
42276881Sbapt#ifdef	CPU_CNMIPS
43276881Sbapt#include <machine/octeon_cop2.h>
44276881Sbapt#endif
45283084Sbapt
46283084Sbapt/*
47276881Sbapt * Machine-dependent part of the proc structure.
48276881Sbapt */
49283084Sbaptstruct mdthread {
50283084Sbapt	int		md_flags;	/* machine-dependent flags */
51283084Sbapt#if defined(__mips_n64) || defined(__mips_n32) /*  PHYSADDR_64_BIT */
52283084Sbapt	uint64_t	md_upte[KSTACK_PAGES];	/* ptes for mapping u pcb */
53283084Sbapt#else
54283084Sbapt	int		md_upte[KSTACK_PAGES];
55283084Sbapt#endif
56283084Sbapt	int		md_ss_addr;	/* single step address for ptrace */
57283084Sbapt	int		md_ss_instr;	/* single step instruction for ptrace */
58283084Sbapt	register_t	md_saved_intr;
59283084Sbapt	u_int		md_spinlock_count;
60283084Sbapt/* The following is CPU dependent, but kept in for compatibility */
61276881Sbapt	int		md_pc_ctrl;	/* performance counter control */
62283084Sbapt	int		md_pc_count;	/* performance counter */
63283084Sbapt	int		md_pc_spill;	/* performance counter spill */
64283084Sbapt	void		*md_tls;
65276881Sbapt#ifdef	CPU_CNMIPS
66283084Sbapt	struct octeon_cop2_state	*md_cop2; /* kernel context */
67283084Sbapt	struct octeon_cop2_state	*md_ucop2; /* userland context */
68283084Sbapt#define	COP2_OWNER_USERLAND	0x0000		/* Userland owns COP2 */
69283084Sbapt#define	COP2_OWNER_KERNEL	0x0001		/* Kernel owns COP2 */
70283084Sbapt	int		md_cop2owner;
71296435Spfg#endif
72283084Sbapt};
73283084Sbapt
74283084Sbapt/* md_flags */
75283084Sbapt#define	MDTD_FPUSED	0x0001		/* Process used the FPU */
76283084Sbapt#define	MDTD_COP2USED	0x0002		/* Process used the COP2 */
77283084Sbapt
78283084Sbaptstruct mdproc {
79283084Sbapt	/* empty */
80283084Sbapt};
81283084Sbapt
82276881Sbapt#ifdef _KERNEL
83283084Sbaptstruct thread;
84283084Sbapt
85276881Sbaptvoid	mips_cpu_switch(struct thread *, struct thread *, struct mtx *);
86276881Sbaptvoid	mips_cpu_throw(struct thread *, struct thread *);
87276881Sbapt
88276881Sbaptstruct syscall_args {
89276881Sbapt	u_int code;
90276881Sbapt	struct sysent *callp;
91276881Sbapt	register_t args[8];
92283084Sbapt	int narg;
93276881Sbapt	struct trapframe *trapframe;
94276881Sbapt};
95276881Sbapt#endif
96276881Sbapt
97276881Sbapt#ifdef __mips_n64
98283084Sbapt#define	KINFO_PROC_SIZE 1088
99283084Sbapt#define	KINFO_PROC32_SIZE 816
100283084Sbapt#else
101283084Sbapt#define	KINFO_PROC_SIZE 816
102283084Sbapt#endif
103276881Sbapt
104276881Sbapt#endif	/* !_MACHINE_PROC_H_ */
105276881Sbapt