Use pic_call_irq instead of calling interrupt directly from pic

This commit is contained in:
copy 2016-08-02 05:30:41 +02:00
parent 5b590208a4
commit d8d71f1177
2 changed files with 16 additions and 8 deletions

View file

@ -3007,6 +3007,19 @@ CPU.prototype.write_g32 = function(value)
this.reg32[this.modrm_byte >> 3 & 7] = value;
};
CPU.prototype.pic_call_irq = function(int)
{
try
{
this.previous_ip = this.instruction_pointer;
this.call_interrupt_vector(int, false, false);
}
catch(e)
{
this.exception_cleanup(e);
}
};
CPU.prototype.handle_irqs = function()
{
dbg_assert(!this.page_fault);

View file

@ -60,7 +60,7 @@ function PIC(cpu, master)
this.cpu = cpu;
// Checking for callable interrupts:
// (cpu changes interrupt flag) -> cpu.handle_irqs -> pic.check_irqs -> cpu.call_interrupt_vector
// (cpu changes interrupt flag) -> cpu.handle_irqs -> pic.check_irqs -> cpu.pic_call_irq
// (pic changes isr/irr) -> cpu.handle_irqs -> ...
// triggering irqs:
@ -116,11 +116,7 @@ function PIC(cpu, master)
}
dbg_log("master handling irq " + irq_number, LOG_PIC);
// call_interrupt_vector can cause an exception in the CPU, so we
// have to set previous_ip correctly here
this.cpu.previous_ip = this.cpu.instruction_pointer;
this.cpu.call_interrupt_vector(this.irq_map | irq_number, false, false);
this.cpu.pic_call_irq(this.irq_map | irq_number);
return true;
};
@ -159,8 +155,7 @@ function PIC(cpu, master)
this.irr &= ~irq_mask;
dbg_log("slave > handling irq " + irq_number, LOG_PIC);
this.cpu.previous_ip = this.cpu.instruction_pointer;
this.cpu.call_interrupt_vector(this.irq_map | irq_number, false, false);
this.cpu.pic_call_irq(this.irq_map | irq_number);
if(this.irr)
{