require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_AARCH64_TYPES_H_)) {
    eval 'sub _AARCH64_TYPES_H_ () {1;}' unless defined(&_AARCH64_TYPES_H_);
    if(defined(&__aarch64__)) {
	if(defined(&_KERNEL_OPT)) {
	    require './aarch64/opt_pmap.ph';
	}
	require 'sys/cdefs.ph';
	require 'sys/featuretest.ph';
	require 'arm/int_types.ph';
	if(defined(&_KERNEL) || defined(&_KMEMUSER) || defined(&_KERNTYPES) || defined(&_STANDALONE)) {
	    eval 'sub PRIxPADDR () {"lx";}' unless defined(&PRIxPADDR);
	    eval 'sub PRIxPSIZE () {"lx";}' unless defined(&PRIxPSIZE);
	    eval 'sub PRIuPSIZE () {"lu";}' unless defined(&PRIuPSIZE);
	    eval 'sub PRIxVADDR () {"lx";}' unless defined(&PRIxVADDR);
	    eval 'sub PRIxVSIZE () {"lx";}' unless defined(&PRIxVSIZE);
	    eval 'sub PRIuVSIZE () {"lu";}' unless defined(&PRIuVSIZE);
	    eval 'sub PRIxREGISTER () { &PRIx64;}' unless defined(&PRIxREGISTER);
	    eval 'sub PRIxREGISTER32 () { &PRIx32;}' unless defined(&PRIxREGISTER32);
	    if(defined(&_KERNEL)) {
		eval 'sub LBL_X19 () {0;}' unless defined(&LBL_X19);
		eval 'sub LBL_X20 () {1;}' unless defined(&LBL_X20);
		eval 'sub LBL_X21 () {2;}' unless defined(&LBL_X21);
		eval 'sub LBL_X22 () {3;}' unless defined(&LBL_X22);
		eval 'sub LBL_X23 () {4;}' unless defined(&LBL_X23);
		eval 'sub LBL_X24 () {5;}' unless defined(&LBL_X24);
		eval 'sub LBL_X25 () {6;}' unless defined(&LBL_X25);
		eval 'sub LBL_X26 () {7;}' unless defined(&LBL_X26);
		eval 'sub LBL_X27 () {8;}' unless defined(&LBL_X27);
		eval 'sub LBL_X28 () {9;}' unless defined(&LBL_X28);
		eval 'sub LBL_X29 () {10;}' unless defined(&LBL_X29);
		eval 'sub LBL_LR () {11;}' unless defined(&LBL_LR);
		eval 'sub LBL_SP () {12;}' unless defined(&LBL_SP);
		eval 'sub LBL_MAX () {13;}' unless defined(&LBL_MAX);
	    }
	}
	eval 'sub __SIMPLELOCK_LOCKED () {1;}' unless defined(&__SIMPLELOCK_LOCKED);
	eval 'sub __SIMPLELOCK_UNLOCKED () {0;}' unless defined(&__SIMPLELOCK_UNLOCKED);
	eval 'sub __HAVE_ATOMIC64_OPS () {1;}' unless defined(&__HAVE_ATOMIC64_OPS);
	eval 'sub __HAVE_BUS_SPACE_8 () {1;}' unless defined(&__HAVE_BUS_SPACE_8);
	eval 'sub __HAVE_COMMON___TLS_GET_ADDR () {1;}' unless defined(&__HAVE_COMMON___TLS_GET_ADDR);
	eval 'sub __HAVE_CPU_COUNTER () {1;}' unless defined(&__HAVE_CPU_COUNTER);
	eval 'sub __HAVE_CPU_DATA_FIRST () {1;}' unless defined(&__HAVE_CPU_DATA_FIRST);
	eval 'sub __HAVE_FAST_SOFTINTS () {1;}' unless defined(&__HAVE_FAST_SOFTINTS);
	eval 'sub __HAVE_MINIMAL_EMUL () {1;}' unless defined(&__HAVE_MINIMAL_EMUL);
	eval 'sub __HAVE_MM_MD_DIRECT_MAPPED_PHYS () {1;}' unless defined(&__HAVE_MM_MD_DIRECT_MAPPED_PHYS);
	eval 'sub __HAVE_MM_MD_KERNACC () {1;}' unless defined(&__HAVE_MM_MD_KERNACC);
	eval 'sub __HAVE_NEW_STYLE_BUS_H () {1;}' unless defined(&__HAVE_NEW_STYLE_BUS_H);
	eval 'sub __HAVE_OLD_DISKLABEL () {1;}' unless defined(&__HAVE_OLD_DISKLABEL);
	eval 'sub __HAVE_SYSCALL_INTERN () {1;}' unless defined(&__HAVE_SYSCALL_INTERN);
	eval 'sub __HAVE_TLS_VARIANT_I () {1;}' unless defined(&__HAVE_TLS_VARIANT_I);
	eval 'sub __HAVE___LWP_GETPRIVATE_FAST () {1;}' unless defined(&__HAVE___LWP_GETPRIVATE_FAST);
	eval 'sub __HAVE_UCAS_FULL () {1;}' unless defined(&__HAVE_UCAS_FULL);
	if(defined(&_KERNEL) || defined(&_KMEMUSER)) {
	    eval 'sub PCU_FPU () {0;}' unless defined(&PCU_FPU);
	    eval 'sub PCU_UNIT_COUNT () {1;}' unless defined(&PCU_UNIT_COUNT);
	}
	if(defined(&_KERNEL)) {
	    eval 'sub __HAVE_RAS () {1;}' unless defined(&__HAVE_RAS);
	}
	if(defined(&PMAP_MI)) {
	    eval 'sub __HAVE_UNLOCKED_PMAP () {1;}' unless defined(&__HAVE_UNLOCKED_PMAP);
	}
    }
 elsif(defined(&__arm__)) {
	require 'arm/types.ph';
    }
}
1;
