require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_I386_I82093VAR_H_)) {
    eval 'sub _I386_I82093VAR_H_ () {1;}' unless defined(&_I386_I82093VAR_H_);
    require 'machine/apicvar.ph';
    eval 'sub APIC_INT_VIA_APIC () {0x10000000;}' unless defined(&APIC_INT_VIA_APIC);
    eval 'sub APIC_INT_APIC_MASK () {0xff0000;}' unless defined(&APIC_INT_APIC_MASK);
    eval 'sub APIC_INT_APIC_SHIFT () {16;}' unless defined(&APIC_INT_APIC_SHIFT);
    eval 'sub APIC_INT_PIN_MASK () {0xff00;}' unless defined(&APIC_INT_PIN_MASK);
    eval 'sub APIC_INT_PIN_SHIFT () {8;}' unless defined(&APIC_INT_PIN_SHIFT);
    eval 'sub APIC_INT_LINE_MASK () {0xff;}' unless defined(&APIC_INT_LINE_MASK);
    eval 'sub APIC_IRQ_APIC {
        local($x) = @_;
	    eval q((($x &  &APIC_INT_APIC_MASK) >>  &APIC_INT_APIC_SHIFT));
    }' unless defined(&APIC_IRQ_APIC);
    eval 'sub APIC_IRQ_PIN {
        local($x) = @_;
	    eval q((($x &  &APIC_INT_PIN_MASK) >>  &APIC_INT_PIN_SHIFT));
    }' unless defined(&APIC_IRQ_PIN);
    eval 'sub IOAPIC_REMAP_MASK () {( &IOAPIC_ID_MASK >>  &IOAPIC_ID_SHIFT);}' unless defined(&IOAPIC_REMAP_MASK);
    eval 'sub IOAPIC_REMAP_FLAG () {(( &IOAPIC_REMAP_MASK + 1) << 1);}' unless defined(&IOAPIC_REMAP_FLAG);
    eval 'sub IOAPIC_REMAP {
        local($old_id, $new_id) = @_;
	    eval q(( $ioapic_id_remap[($old_id)] =  &IOAPIC_REMAP_FLAG | ($new_id)));
    }' unless defined(&IOAPIC_REMAP);
    eval 'sub IOAPIC_REMAPPED {
        local($id) = @_;
	    eval q(( $ioapic_id_remap[($id)] &  &IOAPIC_REMAP_FLAG));
    }' unless defined(&IOAPIC_REMAPPED);
    eval 'sub IOAPIC_REMAPPED_ID {
        local($id) = @_;
	    eval q(( &IOAPIC_REMAPPED($id) ?  $ioapic_id_remap[($id)] &  &IOAPIC_REMAP_MASK : ($id)));
    }' unless defined(&IOAPIC_REMAPPED_ID);
}
1;
