require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&MACHINE_VMPARAM_H)) {
    eval 'sub MACHINE_VMPARAM_H () {1;}' unless defined(&MACHINE_VMPARAM_H);
    eval 'sub USRTEXT () { &PAGE_SIZE;}' unless defined(&USRTEXT);
    eval 'sub USRSTACK () { &VM_MAXUSER_ADDRESS;}' unless defined(&USRSTACK);
    unless(defined(&MAXTSIZ)) {
	eval 'sub MAXTSIZ () {(64*1024*1024);}' unless defined(&MAXTSIZ);
    }
    unless(defined(&DFLDSIZ)) {
	eval 'sub DFLDSIZ () {(64*1024*1024);}' unless defined(&DFLDSIZ);
    }
    unless(defined(&MAXDSIZ)) {
	eval 'sub MAXDSIZ () {(2*1024*1024*1024);}' unless defined(&MAXDSIZ);
    }
    unless(defined(&BRKSIZ)) {
	eval 'sub BRKSIZ () { &MAXDSIZ;}' unless defined(&BRKSIZ);
    }
    unless(defined(&DFLSSIZ)) {
	eval 'sub DFLSSIZ () {(1*1024*1024);}' unless defined(&DFLSSIZ);
    }
    unless(defined(&MAXSSIZ)) {
	eval 'sub MAXSSIZ () {(32*1024*1024);}' unless defined(&MAXSSIZ);
    }
    eval 'sub STACKGAP_RANDOM () {256*1024;}' unless defined(&STACKGAP_RANDOM);
    unless(defined(&SHMMAXPGS)) {
	eval 'sub SHMMAXPGS () {8192;}' unless defined(&SHMMAXPGS);
    }
    eval 'sub USRIOSIZE () {1024;}' unless defined(&USRIOSIZE);
    eval 'sub VM_MIN_ADDRESS () {(( &vaddr_t)0);}' unless defined(&VM_MIN_ADDRESS);
    eval 'sub VM_MAXUSER_ADDRESS () {(( &vaddr_t)0xfffff000);}' unless defined(&VM_MAXUSER_ADDRESS);
    eval 'sub VM_MAX_ADDRESS () { &VM_MAXUSER_ADDRESS;}' unless defined(&VM_MAX_ADDRESS);
    eval 'sub VM_MIN_KERNEL_ADDRESS () {(( &vaddr_t)( &PPC_KERNEL_SR <<  &ADDR_SR_SHIFT));}' unless defined(&VM_MIN_KERNEL_ADDRESS);
    eval 'sub VM_PIE_MIN_ADDR () { &PAGE_SIZE;}' unless defined(&VM_PIE_MIN_ADDR);
    eval 'sub VM_PIE_MAX_ADDR () {0x40000000;}' unless defined(&VM_PIE_MAX_ADDR);
    eval 'sub VM_KERN_ADDRESS_SIZE () {( &PPC_SEGMENT_LENGTH - (32* 1024* 1024));}' unless defined(&VM_KERN_ADDRESS_SIZE);
    eval 'sub VM_MAX_KERNEL_ADDRESS () {( &VM_MIN_KERNEL_ADDRESS +  &VM_KERN_ADDRESS_SIZE);}' unless defined(&VM_MAX_KERNEL_ADDRESS);
    eval 'sub VM_PHYS_SIZE () {( &USRIOSIZE *  &PAGE_SIZE);}' unless defined(&VM_PHYS_SIZE);
    eval 'sub VM_PHYSSEG_MAX () {32;}' unless defined(&VM_PHYSSEG_MAX);
    eval 'sub VM_PHYSSEG_STRAT () { &VM_PSTRAT_BSEARCH;}' unless defined(&VM_PHYSSEG_STRAT);
    eval 'sub VM_PHYSSEG_NOADD () {1;}' unless defined(&VM_PHYSSEG_NOADD);
    if(defined(&_KERNEL)) {
	eval 'sub __HAVE_VM_PAGE_MD () {1;}' unless defined(&__HAVE_VM_PAGE_MD);
	eval 'sub VM_MDPAGE_INIT {
	    my($pg) = @_;
    	    eval q( &do {  &LIST_INIT((($pg)-> ($mdpage->{pv_list}))); }  &while (0));
	}' unless defined(&VM_MDPAGE_INIT);
    }
}
1;
