Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: types.h,v 1.78 2023/03/28 10:54:13 nakayama 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	_MIPS_TYPES_H_
     38 #define	_MIPS_TYPES_H_
     39 
     40 #include <sys/cdefs.h>
     41 #include <sys/featuretest.h>
     42 #include <mips/int_types.h>
     43 
     44 typedef __int32_t		__register32_t;
     45 typedef __int64_t		__register64_t;
     46 typedef __uint32_t		__fpregister32_t;
     47 typedef __uint64_t		__fpregister64_t;
     48 
     49 typedef	unsigned int		__cpu_simple_lock_nv_t;
     50 #if defined(__mips_o32)
     51 typedef __register32_t		__register_t;
     52 typedef __fpregister32_t	__fpregister_t;
     53 #else
     54 typedef __register64_t		__register_t;
     55 typedef __fpregister64_t	__fpregister_t;
     56 #endif
     57 
     58 /*
     59  * Note that mips_reg_t is distinct from the register_t defined
     60  * in <types.h> to allow these structures to be as hidden from
     61  * the rest of the operating system as possible.
     62  */
     63 
     64 #ifdef _LP64
     65 typedef __uint64_t	__vaddr_t;
     66 #else
     67 typedef __uint32_t	__vaddr_t;
     68 #endif
     69 
     70 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
     71 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
     72 typedef __uint64_t	paddr_t;
     73 typedef __uint64_t	psize_t;
     74 #define	PRIxPADDR	PRIx64
     75 #define	PRIxPSIZE	PRIx64
     76 #define	PRIdPSIZE	PRId64
     77 #define	PRIuPSIZE	PRIu64
     78 #else
     79 typedef __uint32_t	paddr_t;
     80 typedef __uint32_t	psize_t;
     81 #define	PRIxPADDR	PRIx32
     82 #define	PRIxPSIZE	PRIx32
     83 #define	PRIdPSIZE	PRId32
     84 #define	PRIuPSIZE	PRIu32
     85 #endif
     86 #ifdef _LP64
     87 typedef __uint64_t	vaddr_t;
     88 typedef __uint64_t	vsize_t;
     89 #define	PRIxVADDR	PRIx64
     90 #define	PRIxVSIZE	PRIx64
     91 #define	PRIdVSIZE	PRId64
     92 #define	PRIuVSIZE	PRIu64
     93 #else
     94 typedef __uint32_t	vaddr_t;
     95 typedef __uint32_t	vsize_t;
     96 #define	PRIxVADDR	PRIx32
     97 #define	PRIxVSIZE	PRIx32
     98 #define	PRIdVSIZE	PRId32
     99 #define	PRIuVSIZE	PRIu32
    100 #endif
    101 
    102 typedef	vaddr_t	vm_offset_t;	/* deprecated (cddl/FreeBSD compat) */
    103 typedef	vsize_t	vm_size_t;	/* deprecated (cddl/FreeBSD compat) */
    104 
    105 
    106 typedef int		mips_prid_t;
    107 /* Make sure this is signed; we need pointers to be sign-extended. */
    108 typedef	__fpregister_t	fpregister_t;
    109 typedef	__fpregister_t	mips_fpreg_t;		/* do not use */
    110 typedef __register_t	register_t;
    111 typedef __register_t	mips_reg_t;
    112 
    113 #if defined(__mips_o32)
    114 typedef __uint32_t	uregister_t;
    115 typedef __uint32_t	mips_ureg_t;		/* do not use */
    116 #define	PRIxREGISTER	PRIx32
    117 #define	PRIxUREGISTER	PRIx32
    118 #else
    119 typedef __uint64_t	uregister_t;
    120 typedef __uint64_t	mips_ureg_t;		/* do not use */
    121 typedef __int64_t	register32_t;
    122 typedef __uint64_t	uregister32_t;
    123 #define	PRIxREGISTER	PRIx64
    124 #define	PRIxUREGISTER	PRIx64
    125 #endif /* __mips_o32 */
    126 
    127 #if defined(_KMEMUSER)
    128 typedef struct mips_label_t {
    129 	register_t val[14];
    130 } mips_label_t;
    131 #else
    132 typedef struct label_t {
    133 	register_t val[14];
    134 } label_t;
    135 typedef label_t mips_label_t;
    136 #endif
    137 
    138 #define	_L_S0		0
    139 #define	_L_S1		1
    140 #define	_L_S2		2
    141 #define	_L_S3		3
    142 #define	_L_S4		4
    143 #define	_L_S5		5
    144 #define	_L_S6		6
    145 #define	_L_S7		7
    146 #define	_L_T8		8
    147 #define	_L_GP		9
    148 #define	_L_SP		10
    149 #define	_L_S8		11
    150 #define	_L_RA		12
    151 #define	_L_SR		13
    152 
    153 typedef __uint32_t tlb_asid_t;
    154 #endif /* _KERNEL */
    155 
    156 #if defined(_KERNEL) || defined(_KMEMUSER)
    157 #define	PCU_FPU		0
    158 #define	PCU_DSP		1
    159 #define	PCU_UNIT_COUNT	2
    160 #endif
    161 
    162 #define	__SIMPLELOCK_LOCKED	1
    163 #define	__SIMPLELOCK_UNLOCKED	0
    164 
    165 #define	__HAVE_COMMON___TLS_GET_ADDR
    166 #define	__HAVE_CPU_COUNTER
    167 #define	__HAVE_CPU_DATA_FIRST
    168 #define	__HAVE_CPU_LWP_SETPRIVATE
    169 #define	__HAVE_CPU_UAREA_ROUTINES
    170 #define	__HAVE_FAST_SOFTINTS
    171 #define	__HAVE_MD_CPU_OFFLINE
    172 #define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
    173 #define	__HAVE_MM_MD_KERNACC
    174 #define	__HAVE_MM_MD_CACHE_ALIASING
    175 #define	__HAVE_SYSCALL_INTERN
    176 #define	__HAVE_TLS_VARIANT_I
    177 #define	__HAVE_UCAS_FULL
    178 #define	__HAVE___LWP_GETTCB_FAST
    179 #define	__HAVE___LWP_SETTCB
    180 #define	__HAVE_BUS_SPACE_8
    181 
    182 /* XXX temporary */
    183 #define	__HAVE_UNLOCKED_PMAP
    184 
    185 #if !defined(__mips_o32)
    186 #define	__HAVE_ATOMIC64_OPS
    187 #endif
    188 
    189 #if defined(_KERNEL)
    190 #define	__HAVE_RAS
    191 #if defined(_LP64)
    192 #define	__HAVE_CPU_VMSPACE_EXEC
    193 #endif
    194 #endif /* _KERNEL */
    195 
    196 
    197 #endif	/* _MIPS_TYPES_H_ */
    198