xref: /openbsd/sys/arch/sh/include/_types.h (revision b2653891)
1*b2653891Scheloha /*	$OpenBSD: _types.h,v 1.22 2023/07/02 19:02:28 cheloha Exp $	*/
295c7671fSmiod 
395c7671fSmiod /*-
495c7671fSmiod  * Copyright (c) 1990, 1993
595c7671fSmiod  *	The Regents of the University of California.  All rights reserved.
695c7671fSmiod  *
795c7671fSmiod  * Redistribution and use in source and binary forms, with or without
895c7671fSmiod  * modification, are permitted provided that the following conditions
995c7671fSmiod  * are met:
1095c7671fSmiod  * 1. Redistributions of source code must retain the above copyright
1195c7671fSmiod  *    notice, this list of conditions and the following disclaimer.
1295c7671fSmiod  * 2. Redistributions in binary form must reproduce the above copyright
1395c7671fSmiod  *    notice, this list of conditions and the following disclaimer in the
1495c7671fSmiod  *    documentation and/or other materials provided with the distribution.
1595c7671fSmiod  * 3. Neither the name of the University nor the names of its contributors
1695c7671fSmiod  *    may be used to endorse or promote products derived from this software
1795c7671fSmiod  *    without specific prior written permission.
1895c7671fSmiod  *
1995c7671fSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2095c7671fSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2195c7671fSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2295c7671fSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2395c7671fSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2495c7671fSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2595c7671fSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2695c7671fSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2795c7671fSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2895c7671fSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2995c7671fSmiod  * SUCH DAMAGE.
3095c7671fSmiod  *
3195c7671fSmiod  *	@(#)types.h	8.3 (Berkeley) 1/5/94
3295c7671fSmiod  *	@(#)ansi.h	8.2 (Berkeley) 1/4/94
3395c7671fSmiod  */
3495c7671fSmiod 
3595c7671fSmiod #ifndef _SH__TYPES_H_
3695c7671fSmiod #define _SH__TYPES_H_
3795c7671fSmiod 
3895c7671fSmiod #if defined(_KERNEL)
3995c7671fSmiod typedef struct label_t {
40431b8a08Sderaadt 	long val[9];
4195c7671fSmiod } label_t;
4295c7671fSmiod #endif
4395c7671fSmiod 
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 #define	_ALIGNBYTES		(sizeof(int) - 1)
551e370795Sderaadt #define	_STACKALIGNBYTES	_ALIGNBYTES
5628644381Sguenther #define	_ALIGN(p)		(((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
5728644381Sguenther #define	_ALIGNED_POINTER(p,t)	((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
58ea0d1f1fSderaadt #define	_MAX_PAGE_SHIFT		12	/* same as PAGE_SHIFT */
5928644381Sguenther 
6095c7671fSmiod /* 7.18.1.1 Exact-width integer types */
61015c7c34Sguenther typedef	signed char		__int8_t;
6295c7671fSmiod typedef	unsigned char		__uint8_t;
6395c7671fSmiod typedef	short			__int16_t;
6495c7671fSmiod typedef	unsigned short		__uint16_t;
6595c7671fSmiod typedef	int			__int32_t;
6695c7671fSmiod typedef	unsigned int		__uint32_t;
6795c7671fSmiod typedef	long long		__int64_t;
6895c7671fSmiod typedef	unsigned long long	__uint64_t;
6995c7671fSmiod 
7095c7671fSmiod /* 7.18.1.2 Minimum-width integer types */
7195c7671fSmiod typedef	__int8_t		__int_least8_t;
7295c7671fSmiod typedef	__uint8_t		__uint_least8_t;
7395c7671fSmiod typedef	__int16_t		__int_least16_t;
7495c7671fSmiod typedef	__uint16_t		__uint_least16_t;
7595c7671fSmiod typedef	__int32_t		__int_least32_t;
7695c7671fSmiod typedef	__uint32_t		__uint_least32_t;
7795c7671fSmiod typedef	__int64_t		__int_least64_t;
7895c7671fSmiod typedef	__uint64_t		__uint_least64_t;
7995c7671fSmiod 
8095c7671fSmiod /* 7.18.1.3 Fastest minimum-width integer types */
8195c7671fSmiod typedef	__int32_t		__int_fast8_t;
8295c7671fSmiod typedef	__uint32_t		__uint_fast8_t;
8395c7671fSmiod typedef	__int32_t		__int_fast16_t;
8495c7671fSmiod typedef	__uint32_t		__uint_fast16_t;
8595c7671fSmiod typedef	__int32_t		__int_fast32_t;
8695c7671fSmiod typedef	__uint32_t		__uint_fast32_t;
8795c7671fSmiod typedef	__int64_t		__int_fast64_t;
8895c7671fSmiod typedef	__uint64_t		__uint_fast64_t;
899bc5afabSguenther #define	__INT_FAST8_MIN		INT32_MIN
909bc5afabSguenther #define	__INT_FAST16_MIN	INT32_MIN
919bc5afabSguenther #define	__INT_FAST32_MIN	INT32_MIN
929bc5afabSguenther #define	__INT_FAST64_MIN	INT64_MIN
939bc5afabSguenther #define	__INT_FAST8_MAX		INT32_MAX
949bc5afabSguenther #define	__INT_FAST16_MAX	INT32_MAX
959bc5afabSguenther #define	__INT_FAST32_MAX	INT32_MAX
969bc5afabSguenther #define	__INT_FAST64_MAX	INT64_MAX
979bc5afabSguenther #define	__UINT_FAST8_MAX	UINT32_MAX
989bc5afabSguenther #define	__UINT_FAST16_MAX	UINT32_MAX
999bc5afabSguenther #define	__UINT_FAST32_MAX	UINT32_MAX
1009bc5afabSguenther #define	__UINT_FAST64_MAX	UINT64_MAX
10195c7671fSmiod 
10295c7671fSmiod /* 7.18.1.4 Integer types capable of holding object pointers */
10395c7671fSmiod typedef	long			__intptr_t;
10495c7671fSmiod typedef	unsigned long		__uintptr_t;
10595c7671fSmiod 
10695c7671fSmiod /* 7.18.1.5 Greatest-width integer types */
10795c7671fSmiod typedef	__int64_t		__intmax_t;
10895c7671fSmiod typedef	__uint64_t		__uintmax_t;
10995c7671fSmiod 
11095c7671fSmiod /* Register size */
111562b3be1Sderaadt typedef long			__register_t;
11295c7671fSmiod 
11395c7671fSmiod /* VM system types */
11495c7671fSmiod typedef unsigned long		__vaddr_t;
11595c7671fSmiod typedef unsigned long		__paddr_t;
11695c7671fSmiod typedef unsigned long		__vsize_t;
11795c7671fSmiod typedef unsigned long		__psize_t;
11895c7671fSmiod 
11995c7671fSmiod /* Standard system types */
1207c79e328Smartynas typedef double			__double_t;
1217c79e328Smartynas typedef float			__float_t;
12295c7671fSmiod typedef long			__ptrdiff_t;
12395c7671fSmiod typedef	unsigned long		__size_t;
12495c7671fSmiod typedef	long			__ssize_t;
12595c7671fSmiod #if defined(__GNUC__) && __GNUC__ >= 3
12695c7671fSmiod typedef	__builtin_va_list	__va_list;
12795c7671fSmiod #else
12895c7671fSmiod struct __va_list_tag;
12995c7671fSmiod typedef	struct __va_list_tag *	__va_list;
13095c7671fSmiod #endif
13195c7671fSmiod 
13295c7671fSmiod /* Wide character support types */
13395c7671fSmiod #ifndef __cplusplus
13495c7671fSmiod typedef	int			__wchar_t;
13595c7671fSmiod #endif
13695c7671fSmiod typedef int			__wint_t;
13795c7671fSmiod typedef	int			__rune_t;
13895c7671fSmiod typedef	void *			__wctrans_t;
13995c7671fSmiod typedef	void *			__wctype_t;
14095c7671fSmiod 
14195c7671fSmiod #endif	/* _SH__TYPES_H_ */
142