xref: /openbsd/sys/arch/m88k/include/_types.h (revision b2653891)
1*b2653891Scheloha /*	$OpenBSD: _types.h,v 1.20 2023/07/02 19:02:28 cheloha Exp $	*/
2e8428d32Smillert 
3e8428d32Smillert /*-
4e8428d32Smillert  * Copyright (c) 1990, 1993
5e8428d32Smillert  *	The Regents of the University of California.  All rights reserved.
6e8428d32Smillert  *
7e8428d32Smillert  * Redistribution and use in source and binary forms, with or without
8e8428d32Smillert  * modification, are permitted provided that the following conditions
9e8428d32Smillert  * are met:
10e8428d32Smillert  * 1. Redistributions of source code must retain the above copyright
11e8428d32Smillert  *    notice, this list of conditions and the following disclaimer.
12e8428d32Smillert  * 2. Redistributions in binary form must reproduce the above copyright
13e8428d32Smillert  *    notice, this list of conditions and the following disclaimer in the
14e8428d32Smillert  *    documentation and/or other materials provided with the distribution.
15e8428d32Smillert  * 3. Neither the name of the University nor the names of its contributors
16e8428d32Smillert  *    may be used to endorse or promote products derived from this software
17e8428d32Smillert  *    without specific prior written permission.
18e8428d32Smillert  *
19e8428d32Smillert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20e8428d32Smillert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21e8428d32Smillert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22e8428d32Smillert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23e8428d32Smillert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24e8428d32Smillert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25e8428d32Smillert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26e8428d32Smillert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27e8428d32Smillert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28e8428d32Smillert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29e8428d32Smillert  * SUCH DAMAGE.
30e8428d32Smillert  *
31e8428d32Smillert  *	@(#)types.h	8.3 (Berkeley) 1/5/94
32e8428d32Smillert  *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
33e8428d32Smillert  */
34e8428d32Smillert 
35e8428d32Smillert #ifndef _M88K__TYPES_H_
36e8428d32Smillert #define _M88K__TYPES_H_
37e8428d32Smillert 
38e8428d32Smillert #if defined(_KERNEL)
39e8428d32Smillert typedef struct label_t {
40431b8a08Sderaadt 	long val[19];
41e8428d32Smillert } label_t;
42e8428d32Smillert #endif
43e8428d32Smillert 
4428644381Sguenther /*
4528644381Sguenther  * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
4628644381Sguenther  * value for all data types (int, long, ...).   The result is an
4728644381Sguenther  * unsigned long and must be cast to any desired pointer type.
4828644381Sguenther  *
4928644381Sguenther  * _ALIGNED_POINTER is a boolean macro that checks whether an address
5028644381Sguenther  * is valid to fetch data elements of type t from on this architecture.
5128644381Sguenther  * This does not reflect the optimal alignment, just the possibility
5228644381Sguenther  * (within reasonable limits).
5328644381Sguenther  */
5428644381Sguenther /*
5528644381Sguenther  * XXX These are also used for aligning stack, which needs to be on a quad
5628644381Sguenther  * word boundary for 88k.
5728644381Sguenther  */
5828644381Sguenther #define	_ALIGNBYTES		15
591e370795Sderaadt #define	_STACKALIGNBYTES	_ALIGNBYTES
6028644381Sguenther #define	_ALIGN(p)		(((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
6128644381Sguenther #define	_ALIGNED_POINTER(p,t)	((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
62ea0d1f1fSderaadt #define	_MAX_PAGE_SHIFT		12	/* same as PAGE_SHIFT */
6328644381Sguenther 
64e8428d32Smillert /* 7.18.1.1 Exact-width integer types */
65015c7c34Sguenther typedef	signed char		__int8_t;
66e8428d32Smillert typedef	unsigned char		__uint8_t;
67e8428d32Smillert typedef	short			__int16_t;
68e8428d32Smillert typedef	unsigned short		__uint16_t;
69e8428d32Smillert typedef	int			__int32_t;
70e8428d32Smillert typedef	unsigned int		__uint32_t;
71e8428d32Smillert typedef	long long		__int64_t;
72e8428d32Smillert typedef	unsigned long long	__uint64_t;
73e8428d32Smillert 
74e8428d32Smillert /* 7.18.1.2 Minimum-width integer types */
75e8428d32Smillert typedef	__int8_t		__int_least8_t;
76e8428d32Smillert typedef	__uint8_t		__uint_least8_t;
77e8428d32Smillert typedef	__int16_t		__int_least16_t;
78e8428d32Smillert typedef	__uint16_t		__uint_least16_t;
79e8428d32Smillert typedef	__int32_t		__int_least32_t;
80e8428d32Smillert typedef	__uint32_t		__uint_least32_t;
81e8428d32Smillert typedef	__int64_t		__int_least64_t;
82e8428d32Smillert typedef	__uint64_t		__uint_least64_t;
83e8428d32Smillert 
84e8428d32Smillert /* 7.18.1.3 Fastest minimum-width integer types */
85e8428d32Smillert typedef	__int32_t		__int_fast8_t;
86e8428d32Smillert typedef	__uint32_t		__uint_fast8_t;
87e8428d32Smillert typedef	__int32_t		__int_fast16_t;
88e8428d32Smillert typedef	__uint32_t		__uint_fast16_t;
89e8428d32Smillert typedef	__int32_t		__int_fast32_t;
90e8428d32Smillert typedef	__uint32_t		__uint_fast32_t;
91e8428d32Smillert typedef	__int64_t		__int_fast64_t;
92e8428d32Smillert typedef	__uint64_t		__uint_fast64_t;
939bc5afabSguenther #define	__INT_FAST8_MIN		INT32_MIN
949bc5afabSguenther #define	__INT_FAST16_MIN	INT32_MIN
959bc5afabSguenther #define	__INT_FAST32_MIN	INT32_MIN
969bc5afabSguenther #define	__INT_FAST64_MIN	INT64_MIN
979bc5afabSguenther #define	__INT_FAST8_MAX		INT32_MAX
989bc5afabSguenther #define	__INT_FAST16_MAX	INT32_MAX
999bc5afabSguenther #define	__INT_FAST32_MAX	INT32_MAX
1009bc5afabSguenther #define	__INT_FAST64_MAX	INT64_MAX
1019bc5afabSguenther #define	__UINT_FAST8_MAX	UINT32_MAX
1029bc5afabSguenther #define	__UINT_FAST16_MAX	UINT32_MAX
1039bc5afabSguenther #define	__UINT_FAST32_MAX	UINT32_MAX
1049bc5afabSguenther #define	__UINT_FAST64_MAX	UINT64_MAX
105e8428d32Smillert 
106e8428d32Smillert /* 7.18.1.4 Integer types capable of holding object pointers */
107e8428d32Smillert typedef	long			__intptr_t;
108e8428d32Smillert typedef	unsigned long		__uintptr_t;
109e8428d32Smillert 
110e8428d32Smillert /* 7.18.1.5 Greatest-width integer types */
111e8428d32Smillert typedef	__int64_t		__intmax_t;
112e8428d32Smillert typedef	__uint64_t		__uintmax_t;
113e8428d32Smillert 
114e8428d32Smillert /* Register size */
115562b3be1Sderaadt typedef long			__register_t;
116e8428d32Smillert 
117e8428d32Smillert /* VM system types */
118e8428d32Smillert typedef unsigned long		__vaddr_t;
119e8428d32Smillert typedef unsigned long		__paddr_t;
120e8428d32Smillert typedef unsigned long		__vsize_t;
121e8428d32Smillert typedef unsigned long		__psize_t;
122e8428d32Smillert 
123e8428d32Smillert /* Standard system types */
1247c79e328Smartynas typedef long double		__double_t;
1257c79e328Smartynas typedef long double		__float_t;
1260afc3bcdSmillert typedef long			__ptrdiff_t;
1270afc3bcdSmillert typedef	unsigned long		__size_t;
1280afc3bcdSmillert typedef	long			__ssize_t;
129e8428d32Smillert #if defined(__GNUC__) && __GNUC__ >= 3
130e8428d32Smillert typedef	__builtin_va_list	__va_list;
131e8428d32Smillert #else
132e8428d32Smillert struct __va_list_tag;
133e8428d32Smillert typedef	struct __va_list_tag *	__va_list;
134e8428d32Smillert #endif
135e8428d32Smillert 
136e8428d32Smillert /* Wide character support types */
137e8428d32Smillert #ifndef __cplusplus
138e8428d32Smillert typedef	int			__wchar_t;
139e8428d32Smillert #endif
140e8428d32Smillert typedef int			__wint_t;
141e8428d32Smillert typedef	int			__rune_t;
142e8428d32Smillert typedef	void *			__wctrans_t;
143e8428d32Smillert typedef	void *			__wctype_t;
144e8428d32Smillert 
145e8428d32Smillert #endif	/* _M88K__TYPES_H_ */
146