require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_X86_I82093VAR_H_)) {
    eval 'sub _X86_I82093VAR_H_ () {1;}' unless defined(&_X86_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_IRQ_APIC {
        my($x) = @_;
	    eval q((($x &  &APIC_INT_APIC_MASK) >>  &APIC_INT_APIC_SHIFT));
    }' unless defined(&APIC_IRQ_APIC);
    eval 'sub APIC_IRQ_PIN {
        my($x) = @_;
	    eval q((($x &  &APIC_INT_PIN_MASK) >>  &APIC_INT_PIN_SHIFT));
    }' unless defined(&APIC_IRQ_PIN);
    eval 'sub APIC_IRQ_ISLEGACY {
        my($x) = @_;
	    eval q((!(($x) &  &APIC_INT_VIA_APIC)));
    }' unless defined(&APIC_IRQ_ISLEGACY);
    eval 'sub APIC_IRQ_LEGACY_IRQ {
        my($x) = @_;
	    eval q((($x) & 0xff));
    }' unless defined(&APIC_IRQ_LEGACY_IRQ);
}
1;
