From 78a87d1869d3482c076bfc482e962f420a3485ab Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 31 Dec 2020 19:14:32 -0600 Subject: [PATCH] ioapic improvements for 9front (#332) --- src/ioapic.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/ioapic.js b/src/ioapic.js index 811cbea6..793ff853 100644 --- a/src/ioapic.js +++ b/src/ioapic.js @@ -76,12 +76,24 @@ function IOAPIC(cpu) cpu.io.mmap_register(IOAPIC_ADDRESS, MMAP_BLOCK_SIZE, (addr) => { - dbg_assert(false, "unsupported read8 from ioapic: " + h(addr)); - return 0; + addr = addr - IOAPIC_ADDRESS | 0; + + if(addr >= IOWIN && addr < IOWIN + 4) + { + const byte = addr - IOWIN; + dbg_log("ioapic read8 byte " + byte + " " + h(this.ioregsel), LOG_APIC); + return this.read(this.ioregsel) >> (8 * byte) & 0xFF; + } + else + { + dbg_log("Unexpected IOAPIC register read: " + h(addr >>> 0), LOG_APIC); + dbg_assert(false); + return 0; + } }, (addr, value) => { - dbg_assert(false, "unsupported write8 from ioapic: " + h(addr)); + dbg_assert(false, "unsupported write8 from ioapic: " + h(addr >>> 0)); }, (addr) => { @@ -97,7 +109,7 @@ function IOAPIC(cpu) } else { - dbg_log("Unexpected IOAPIC register read: " + h(addr), LOG_APIC); + dbg_log("Unexpected IOAPIC register read: " + h(addr >>> 0), LOG_APIC); dbg_assert(false); return 0; } @@ -116,7 +128,7 @@ function IOAPIC(cpu) } else { - dbg_log("Unexpected IOAPIC register write: " + h(addr) + " <- " + h(value >>> 0, 8), LOG_APIC); + dbg_log("Unexpected IOAPIC register write: " + h(addr >>> 0) + " <- " + h(value >>> 0, 8), LOG_APIC); dbg_assert(false); } });