xref: /netbsd/sys/arch/amd64/include/types.h (revision caf0b9b3)
1*caf0b9b3Ssimonb /*	$NetBSD: types.h,v 1.71 2021/04/01 04:35:45 simonb Exp $	*/
281918bf8Sfvdl 
381918bf8Sfvdl /*-
481918bf8Sfvdl  * Copyright (c) 1990 The Regents of the University of California.
581918bf8Sfvdl  * All rights reserved.
681918bf8Sfvdl  *
781918bf8Sfvdl  * Redistribution and use in source and binary forms, with or without
881918bf8Sfvdl  * modification, are permitted provided that the following conditions
981918bf8Sfvdl  * are met:
1081918bf8Sfvdl  * 1. Redistributions of source code must retain the above copyright
1181918bf8Sfvdl  *    notice, this list of conditions and the following disclaimer.
1281918bf8Sfvdl  * 2. Redistributions in binary form must reproduce the above copyright
1381918bf8Sfvdl  *    notice, this list of conditions and the following disclaimer in the
1481918bf8Sfvdl  *    documentation and/or other materials provided with the distribution.
15aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
1681918bf8Sfvdl  *    may be used to endorse or promote products derived from this software
1781918bf8Sfvdl  *    without specific prior written permission.
1881918bf8Sfvdl  *
1981918bf8Sfvdl  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2081918bf8Sfvdl  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2181918bf8Sfvdl  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2281918bf8Sfvdl  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2381918bf8Sfvdl  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2481918bf8Sfvdl  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2581918bf8Sfvdl  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2681918bf8Sfvdl  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2781918bf8Sfvdl  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2881918bf8Sfvdl  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2981918bf8Sfvdl  * SUCH DAMAGE.
3081918bf8Sfvdl  *
3181918bf8Sfvdl  *	@(#)types.h	7.5 (Berkeley) 3/9/91
3281918bf8Sfvdl  */
3381918bf8Sfvdl 
34bac7b3cfSchristos #ifndef	_X86_64_TYPES_H_
35bac7b3cfSchristos #define	_X86_64_TYPES_H_
36433b5ddeSmrg 
37433b5ddeSmrg #ifdef __x86_64__
3881918bf8Sfvdl 
3981918bf8Sfvdl #include <sys/cdefs.h>
404be7a2dcSbjh21 #include <sys/featuretest.h>
4181918bf8Sfvdl #include <machine/int_types.h>
4281918bf8Sfvdl 
4381918bf8Sfvdl #if defined(_KERNEL)
4481918bf8Sfvdl typedef struct label_t {
4581918bf8Sfvdl 	long val[8];
4681918bf8Sfvdl } label_t;
4781918bf8Sfvdl #endif
4881918bf8Sfvdl 
49d9f697f8Schristos #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
5081918bf8Sfvdl typedef unsigned long	paddr_t;
5181918bf8Sfvdl typedef unsigned long	psize_t;
5281918bf8Sfvdl typedef unsigned long	vaddr_t;
5381918bf8Sfvdl typedef unsigned long	vsize_t;
540a8b3842Smatt #define	PRIxPADDR	"lx"
550a8b3842Smatt #define	PRIxPSIZE	"lx"
560a8b3842Smatt #define	PRIuPSIZE	"lu"
570a8b3842Smatt #define	PRIxVADDR	"lx"
580a8b3842Smatt #define	PRIxVSIZE	"lx"
590a8b3842Smatt #define	PRIuVSIZE	"lu"
6081918bf8Sfvdl 
6181918bf8Sfvdl typedef long int	register_t;
6281918bf8Sfvdl typedef int		register32_t;
630a8b3842Smatt #define	PRIxREGISTER	"lx"
640a8b3842Smatt #define	PRIxREGISTER32	"x"
6581918bf8Sfvdl 
66baeb969eSchristos #endif
67baeb969eSchristos 
68baeb969eSchristos typedef long int		__register_t;
696f9a4d64Spooka typedef	unsigned char		__cpu_simple_lock_nv_t;
70b07ec3fcSad 
71b07ec3fcSad /* __cpu_simple_lock_t used to be a full word. */
72b07ec3fcSad #define	__CPU_SIMPLE_LOCK_PAD
734d594203Snathanw 
744d594203Snathanw #define	__SIMPLELOCK_LOCKED	1
754d594203Snathanw #define	__SIMPLELOCK_UNLOCKED	0
764d594203Snathanw 
77b31ed8abSkamil #if !__has_feature(undefined_behavior_sanitizer) && \
78b31ed8abSkamil 	!defined(__SANITIZE_UNDEFINED__)
7981918bf8Sfvdl /* The amd64 does not have strict alignment requirements. */
8081918bf8Sfvdl #define	__NO_STRICT_ALIGNMENT
81b31ed8abSkamil #endif
8281918bf8Sfvdl 
83b53a2792Sdyoung #define	__HAVE_NEW_STYLE_BUS_H
8481918bf8Sfvdl #define	__HAVE_CPU_COUNTER
85077d9db9Snjoly #define	__HAVE_CPU_DATA_FIRST
863bf3b7f1Schristos #define	__HAVE_CPU_BOOTCONF
87c959d6a1Schristos #define	__HAVE_MD_CPU_OFFLINE
8881918bf8Sfvdl #define	__HAVE_SYSCALL_INTERN
8981918bf8Sfvdl #define	__HAVE_MINIMAL_EMUL
9032c745d4Sad #define	__HAVE_ATOMIC64_OPS
91f1146e73Srmind #define	__HAVE_MM_MD_KERNACC
92bc9a6375Sad #define	__HAVE_ATOMIC_AS_MEMBAR
93ead83a47Sad #define	__HAVE_CPU_LWP_SETPRIVATE
944c92f569Sjoerg #define	__HAVE___LWP_GETPRIVATE_FAST
9545269e9eSjoerg #define	__HAVE_TLS_VARIANT_II
9645269e9eSjoerg #define	__HAVE_COMMON___TLS_GET_ADDR
974d8f47aeSad #define	__HAVE_INTR_CONTROL
98d9d03696Stls #define	__HAVE_CPU_RNG
99bac7b3cfSchristos #define	__HAVE_COMPAT_NETBSD32
1000650e703Sriastradh #define	__HAVE_MM_MD_DIRECT_MAPPED_IO
1010650e703Sriastradh #define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
102e3f92458Sthorpej #define	__HAVE_UCAS_FULL
103bb61e95eSchristos #define	__HAVE_BUS_SPACE_8
10481918bf8Sfvdl 
105b378f8b2Sbouyer #ifdef _KERNEL_OPT
106da4e67acSmartin #define	__HAVE_RAS
1076da7ff97Schs 
1086da7ff97Schs #include "opt_xen.h"
109f8e4d06fSmaxv #include "opt_kasan.h"
1105fa591c0Smaxv #include "opt_kmsan.h"
1117698d671Smaxv #ifdef KASAN
1127698d671Smaxv #define	__HAVE_KASAN_INSTR_BUS
1137698d671Smaxv #endif
114bf5abc14Scherry #if defined(__x86_64__) && !defined(XENPV)
1155fa591c0Smaxv #if !defined(KASAN) && !defined(KMSAN)
1168964449aSmaxv #define	__HAVE_PCPU_AREA 1
1176da7ff97Schs #define	__HAVE_DIRECT_MAP 1
118f8e4d06fSmaxv #endif
119a69bf788Smaxv #define	__HAVE_CPU_UAREA_ROUTINES 1
1204e541343Sbouyer #endif
121cc52e8beSpooka #endif
122da4e67acSmartin 
123433b5ddeSmrg #else	/*	!__x86_64__	*/
124433b5ddeSmrg 
125433b5ddeSmrg #include <i386/types.h>
126433b5ddeSmrg 
127433b5ddeSmrg #endif	/*	__x86_64__	*/
128433b5ddeSmrg 
129bac7b3cfSchristos #endif	/* _X86_64_TYPES_H_ */
130