xref: /openbsd-src/sys/arch/mips64/include/_types.h (revision b2653891a04fba37525b326f324a5937cd5ef703)
1 /*	$OpenBSD: _types.h,v 1.25 2023/07/02 19:02:28 cheloha Exp $	*/
2 
3 /*-
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)types.h	8.3 (Berkeley) 1/5/94
32  *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
33  */
34 
35 #ifndef _MIPS64__TYPES_H_
36 #define _MIPS64__TYPES_H_
37 
38 /*
39  * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
40  * value for all data types (int, long, ...).   The result is an
41  * unsigned long and must be cast to any desired pointer type.
42  *
43  * _ALIGNED_POINTER is a boolean macro that checks whether an address
44  * is valid to fetch data elements of type t from on this architecture.
45  * This does not reflect the optimal alignment, just the possibility
46  * (within reasonable limits).
47  */
48 #define	_ALIGNBYTES		7
49 #define	_STACKALIGNBYTES	15
50 #define	_ALIGN(p)		(((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
51 #define	_ALIGNED_POINTER(p,t)	((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
52 #define	_MAX_PAGE_SHIFT		14	/* maximum possible PAGE_SHIFT */
53 
54 /*
55  *  We need to handle the various ISA levels for sizes.
56  */
57 #define	_MIPS_ISA_MIPS1		1	/* R2000/R3000 */
58 #define	_MIPS_ISA_MIPS2		2	/* R4000/R6000 */
59 #define	_MIPS_ISA_MIPS3		3	/* R4000 */
60 #define	_MIPS_ISA_MIPS4		4	/* TFP (R1x000) */
61 #define	_MIPS_ISA_MIPS32	32	/* MIPS32 */
62 #define	_MIPS_ISA_MIPS64	64	/* MIPS64 */
63 
64 /* 7.18.1.1 Exact-width integer types */
65 typedef	signed char		__int8_t;
66 typedef	unsigned char		__uint8_t;
67 typedef	short			__int16_t;
68 typedef	unsigned short		__uint16_t;
69 typedef	int			__int32_t;
70 typedef	unsigned int		__uint32_t;
71 typedef	long long		__int64_t;
72 typedef	unsigned long long	__uint64_t;
73 
74 /* 7.18.1.2 Minimum-width integer types */
75 typedef	__int8_t		__int_least8_t;
76 typedef	__uint8_t		__uint_least8_t;
77 typedef	__int16_t		__int_least16_t;
78 typedef	__uint16_t		__uint_least16_t;
79 typedef	__int32_t		__int_least32_t;
80 typedef	__uint32_t		__uint_least32_t;
81 typedef	__int64_t		__int_least64_t;
82 typedef	__uint64_t		__uint_least64_t;
83 
84 /* 7.18.1.3 Fastest minimum-width integer types */
85 typedef	__int32_t		__int_fast8_t;
86 typedef	__uint32_t		__uint_fast8_t;
87 typedef	__int32_t		__int_fast16_t;
88 typedef	__uint32_t		__uint_fast16_t;
89 typedef	__int32_t		__int_fast32_t;
90 typedef	__uint32_t		__uint_fast32_t;
91 typedef	__int64_t		__int_fast64_t;
92 typedef	__uint64_t		__uint_fast64_t;
93 #define	__INT_FAST8_MIN		INT32_MIN
94 #define	__INT_FAST16_MIN	INT32_MIN
95 #define	__INT_FAST32_MIN	INT32_MIN
96 #define	__INT_FAST64_MIN	INT64_MIN
97 #define	__INT_FAST8_MAX		INT32_MAX
98 #define	__INT_FAST16_MAX	INT32_MAX
99 #define	__INT_FAST32_MAX	INT32_MAX
100 #define	__INT_FAST64_MAX	INT64_MAX
101 #define	__UINT_FAST8_MAX	UINT32_MAX
102 #define	__UINT_FAST16_MAX	UINT32_MAX
103 #define	__UINT_FAST32_MAX	UINT32_MAX
104 #define	__UINT_FAST64_MAX	UINT64_MAX
105 
106 /* 7.18.1.4 Integer types capable of holding object pointers */
107 typedef	long			__intptr_t;
108 typedef	unsigned long		__uintptr_t;
109 
110 /* 7.18.1.5 Greatest-width integer types */
111 typedef	__int64_t		__intmax_t;
112 typedef	__uint64_t		__uintmax_t;
113 
114 /* Register size */
115 typedef long			__register_t;
116 typedef long			f_register_t;	/* XXX */
117 
118 /* VM system types */
119 typedef unsigned long		__vaddr_t;
120 typedef unsigned long		__paddr_t;
121 typedef unsigned long		__vsize_t;
122 typedef unsigned long		__psize_t;
123 
124 /* Standard system types */
125 typedef double			__double_t;
126 typedef float			__float_t;
127 typedef long			__ptrdiff_t;
128 typedef	unsigned long		__size_t;
129 typedef	long			__ssize_t;
130 #if defined(__GNUC__) && __GNUC__ >= 3
131 typedef	__builtin_va_list	__va_list;
132 #else
133 typedef	char *			__va_list;
134 #endif
135 
136 /* Wide character support types */
137 #ifndef __cplusplus
138 typedef	int			__wchar_t;
139 #endif
140 typedef int			__wint_t;
141 typedef	int			__rune_t;
142 typedef	void *			__wctrans_t;
143 typedef	void *			__wctype_t;
144 
145 #if defined(_KERNEL)
146 typedef struct label_t {
147 	long val[14];
148 } label_t;
149 #endif
150 
151 /* Feature test macros */
152 #define	__HAVE_EXEC_MD_MAP
153 
154 #endif	/* _MIPS64__TYPES_H_ */
155