require '_h2ph_pre.ph';

unless(defined(&_LINUX_BOOTMEM_H)) {
    eval 'sub _LINUX_BOOTMEM_H () {1;}' unless defined(&_LINUX_BOOTMEM_H);
    require 'asm/pgtable.ph';
    require 'asm/dma.ph';
    require 'linux/cache.ph';
    require 'linux/init.ph';
    require 'linux/mmzone.ph';
    eval 'sub alloc_bootmem {
        local($x) = @_;
	    eval q( &__alloc_bootmem(($x),  &SMP_CACHE_BYTES,  &__pa( &MAX_DMA_ADDRESS)));
    }' unless defined(&alloc_bootmem);
    eval 'sub alloc_bootmem_low {
        local($x) = @_;
	    eval q( &__alloc_bootmem(($x),  &SMP_CACHE_BYTES, 0));
    }' unless defined(&alloc_bootmem_low);
    eval 'sub alloc_bootmem_pages {
        local($x) = @_;
	    eval q( &__alloc_bootmem(($x),  &PAGE_SIZE,  &__pa( &MAX_DMA_ADDRESS)));
    }' unless defined(&alloc_bootmem_pages);
    eval 'sub alloc_bootmem_low_pages {
        local($x) = @_;
	    eval q( &__alloc_bootmem(($x),  &PAGE_SIZE, 0));
    }' unless defined(&alloc_bootmem_low_pages);
    eval 'sub alloc_bootmem_node {
        local($pgdat, $x) = @_;
	    eval q( &__alloc_bootmem_node(($pgdat), ($x),  &SMP_CACHE_BYTES,  &__pa( &MAX_DMA_ADDRESS)));
    }' unless defined(&alloc_bootmem_node);
    eval 'sub alloc_bootmem_pages_node {
        local($pgdat, $x) = @_;
	    eval q( &__alloc_bootmem_node(($pgdat), ($x),  &PAGE_SIZE,  &__pa( &MAX_DMA_ADDRESS)));
    }' unless defined(&alloc_bootmem_pages_node);
    eval 'sub alloc_bootmem_low_pages_node {
        local($pgdat, $x) = @_;
	    eval q( &__alloc_bootmem_node(($pgdat), ($x),  &PAGE_SIZE, 0));
    }' unless defined(&alloc_bootmem_low_pages_node);
}
1;
