1 /*	$NetBSD: types.h,v 1.64 2016/07/11 16:15:35 matt Exp $	*/
2 
3 /*-
4  * Copyright (c) 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Ralph Campbell.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	@(#)types.h	8.3 (Berkeley) 1/5/94
35  */
36 
37 #ifndef	_MACHTYPES_H_
38 #define	_MACHTYPES_H_
39 
40 #include <sys/cdefs.h>
41 #include <sys/featuretest.h>
42 #include <mips/int_types.h>
43 
44 typedef	unsigned int	__cpu_simple_lock_nv_t;
45 #if defined(__mips_o32)
46 typedef __int32_t	__register_t;
47 #else
48 typedef __int64_t	__register_t;
49 #endif
50 #if defined(__mips_o64) || defined(__mips_o32)
51 typedef	__uint32_t	__fpregister_t;
52 #else
53 typedef	__uint64_t	__fpregister_t;
54 #endif
55 
56 /*
57  * Note that mips_reg_t is distinct from the register_t defined
58  * in <types.h> to allow these structures to be as hidden from
59  * the rest of the operating system as possible.
60  */
61 
62 
63 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
64 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
65 typedef __uint64_t	paddr_t;
66 typedef __uint64_t	psize_t;
67 #define	PRIxPADDR	PRIx64
68 #define	PRIxPSIZE	PRIx64
69 #define	PRIdPSIZE	PRId64
70 #else
71 typedef __uint32_t	paddr_t;
72 typedef __uint32_t	psize_t;
73 #define	PRIxPADDR	PRIx32
74 #define	PRIxPSIZE	PRIx32
75 #define	PRIdPSIZE	PRId32
76 #endif
77 #ifdef _LP64
78 typedef __uint64_t	vaddr_t;
79 typedef __uint64_t	vsize_t;
80 #define	PRIxVADDR	PRIx64
81 #define	PRIxVSIZE	PRIx64
82 #define	PRIdVSIZE	PRId64
83 #else
84 typedef __uint32_t	vaddr_t;
85 typedef __uint32_t	vsize_t;
86 #define	PRIxVADDR	PRIx32
87 #define	PRIxVSIZE	PRIx32
88 #define	PRIdVSIZE	PRId32
89 #endif
90 
91 
92 typedef int		mips_prid_t;
93 /* Make sure this is signed; we need pointers to be sign-extended. */
94 typedef	__fpregister_t	fpregister_t;
95 typedef	__fpregister_t	mips_fpreg_t;		/* do not use */
96 typedef __register_t	register_t;
97 typedef __register_t	mips_reg_t;
98 
99 #if defined(__mips_o32)
100 typedef __uint32_t	uregister_t;
101 typedef __uint32_t	mips_ureg_t;		/* do not use */
102 #define	PRIxREGISTER	PRIx32
103 #define	PRIxUREGISTER	PRIx32
104 #else
105 typedef __uint64_t	uregister_t;
106 typedef __uint64_t	mips_ureg_t;		/* do not use */
107 typedef __int64_t	register32_t;
108 typedef __uint64_t	uregister32_t;
109 #define	PRIxREGISTER	PRIx64
110 #define	PRIxUREGISTER	PRIx64
111 #endif /* __mips_o32 */
112 
113 typedef struct label_t {
114 	register_t val[14];
115 } label_t;
116 #define	_L_S0		0
117 #define	_L_S1		1
118 #define	_L_S2		2
119 #define	_L_S3		3
120 #define	_L_S4		4
121 #define	_L_S5		5
122 #define	_L_S6		6
123 #define	_L_S7		7
124 #define	_L_T8		8
125 #define	_L_GP		9
126 #define	_L_SP		10
127 #define	_L_S8		11
128 #define	_L_RA		12
129 #define	_L_SR		13
130 
131 typedef __uint32_t tlb_asid_t;
132 #endif /* _KERNEL */
133 
134 #if defined(_KERNEL) || defined(_KMEMUSER)
135 #define	PCU_FPU		0
136 #define	PCU_DSP		1
137 #define	PCU_UNIT_COUNT	2
138 #endif
139 
140 
141 #define	__SIMPLELOCK_LOCKED	1
142 #define	__SIMPLELOCK_UNLOCKED	0
143 
144 #define	__HAVE_FAST_SOFTINTS
145 #define	__HAVE_AST_PERPROC
146 #define	__HAVE_SYSCALL_INTERN
147 #define	__HAVE_CPU_LWP_SETPRIVATE
148 #define	__HAVE_CPU_DATA_FIRST
149 #define	__HAVE_MD_CPU_OFFLINE
150 #define	__HAVE_CPU_COUNTER
151 #define	__HAVE_CPU_UAREA_ROUTINES
152 #define	__HAVE_COMMON___TLS_GET_ADDR
153 #define	__HAVE___LWP_GETTCB_FAST
154 #define	__HAVE___LWP_SETTCB
155 #define	__HAVE_TLS_VARIANT_I
156 
157 #if !defined(__mips_o32)
158 #define	__HAVE_ATOMIC64_OPS
159 #endif
160 
161 #if defined(_KERNEL)
162 #define	__HAVE_RAS
163 #if defined(_LP64)
164 #define	__HAVE_CPU_VMSPACE_EXEC
165 #endif
166 #endif /* _KERNEL */
167 
168 #define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
169 #define	__HAVE_MM_MD_KERNACC
170 #define	__HAVE_MM_MD_CACHE_ALIASING
171 
172 #endif	/* _MACHTYPES_H_ */
173