#ifdef __x86_64__
#ifndef XENPV
#define MAXCPUS 256
#endif
#ifdef _KERNEL
#include <machine/cpu.h>
#if defined(_KERNEL_OPT)
#include "opt_kasan.h"
#include "opt_kmsan.h"
#include "opt_svs.h"
#endif
#endif
#define _MACHINE amd64
#define MACHINE "amd64"
#define _MACHINE_ARCH x86_64
#define MACHINE_ARCH "x86_64"
#define MID_MACHINE MID_X86_64
#define ALIGNED_POINTER(p,t) 1
#define ALIGNED_POINTER_LOAD(q,p,t) memcpy((q), (p), sizeof(t))
#define STACK_ALIGNBYTES (16 - 1)
#define STACK_ALIGNBYTES32 (4 - 1)
#define ALIGNBYTES32 (sizeof(int) - 1)
#define ALIGN32(p) (((u_long)(p) + ALIGNBYTES32) &~ALIGNBYTES32)
#define PGSHIFT 12
#define NBPG (1 << PGSHIFT)
#define PGOFSET (NBPG-1)
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
#define MAXIOMEM 0xffffffffffff
#if defined(KMSAN)
#define MAXPHYSMEM 0x008000000000ULL
#else
#define MAXPHYSMEM 0x100000000000ULL
#endif
#define KERNBASE 0xffffffff80000000
#define KERNTEXTOFF 0xffffffff80200000
#define KERNTEXTOFF_HI 0xffffffff
#define KERNTEXTOFF_LO 0x80200000
#define KERNBASE_HI 0xffffffff
#define KERNBASE_LO 0x80000000
#if defined(KASAN) || defined(KMSAN)
#define UPAGES_KxSAN 3
#else
#define UPAGES_KxSAN 0
#endif
#if defined(SVS)
#define UPAGES_SVS 1
#else
#define UPAGES_SVS 0
#endif
#define UPAGES_PCB 1
#define UPAGES_RED 1
#define UPAGES_STACK 3
#define UPAGES \
(UPAGES_PCB + UPAGES_RED + UPAGES_STACK + UPAGES_SVS + UPAGES_KxSAN)
#ifndef _STANDALONE
#if defined(KASAN) || defined(KMSAN)
__CTASSERT(UPAGES == 8);
#elif defined(SVS)
__CTASSERT(UPAGES == 6);
#else
__CTASSERT(UPAGES == 5);
#endif
#endif
#define USPACE (UPAGES * NBPG)
#ifndef MSGBUFSIZE
#define MSGBUFSIZE (16*NBPG)
#endif
#define MSIZE 512
#ifndef MCLSHIFT
#define MCLSHIFT 11
#endif
#define MCLBYTES (1 << MCLSHIFT)
#ifndef NFS_RSIZE
#define NFS_RSIZE 32768
#endif
#ifndef NFS_WSIZE
#define NFS_WSIZE 32768
#endif
#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_UNLIMITED 1
#define x86_round_pdr(x) \
((((unsigned long)(x)) + (NBPD_L2 - 1)) & ~(NBPD_L2 - 1))
#define x86_trunc_pdr(x) ((unsigned long)(x) & ~(NBPD_L2 - 1))
#define x86_btod(x) ((unsigned long)(x) >> L2_SHIFT)
#define x86_dtob(x) ((unsigned long)(x) << L2_SHIFT)
#define x86_round_page(x) ((((unsigned long)(x)) + PGOFSET) & ~PGOFSET)
#define x86_trunc_page(x) ((unsigned long)(x) & ~PGOFSET)
#define x86_btop(x) ((unsigned long)(x) >> PGSHIFT)
#define x86_ptob(x) ((unsigned long)(x) << PGSHIFT)
#define btop(x) x86_btop(x)
#define ptob(x) x86_ptob(x)
#else
#include <i386/param.h>
#endif