Final preparations for open source roll-out
This commit is contained in:
parent
e96f0eecd9
commit
60669365f9
40 changed files with 2814 additions and 2639 deletions
|
|
@ -122,21 +122,20 @@ function X86CPU(parmsCPU) {
|
|||
* "INT 0x00" generated by a divide-by-zero or any other kind of interrupt (nor any interrupt simulated
|
||||
* with "PUSHF/CALLF").
|
||||
*
|
||||
* aInterruptReturn is a stack of return address notifications set up by software interrupt notification
|
||||
* aInterruptReturn is a hash of return address notifications set up by software interrupt notification
|
||||
* functions that want to receive return notifications. A software interrupt function must call
|
||||
* cpu.addInterruptReturn(fn).
|
||||
*
|
||||
* WARNING: There's no specific mechanism in place to insure that software interrupt return notifications
|
||||
* don't get "orphaned" and stack up if an interrupt handler bypasses the normal return path (INT 0x24 is
|
||||
* one example of an "evil" software interrupt). So use this feature sparingly, avoid "evil" software
|
||||
* interrupts, and/or add a mechanism to detect and clean up orphans.
|
||||
* WARNING: There's no mechanism in place to insure that software interrupt return notifications don't
|
||||
* get "orphaned" if an interrupt handler bypasses the normal return path (INT 0x24 is one example of an
|
||||
* "evil" software interrupt).
|
||||
*/
|
||||
this.aInterruptNotify = [];
|
||||
this.aInterruptReturn = [];
|
||||
|
||||
/*
|
||||
* Since aReturnNotify is a "sparse array", this global count gives the CPU a quick way of knowing whether
|
||||
* or not RETF or IRET instructions need to bother checking the array.
|
||||
* or not RETF or IRET instructions need to bother calling checkInterruptReturn().
|
||||
*/
|
||||
this.cInterruptReturn = 0;
|
||||
|
||||
|
|
@ -931,27 +930,27 @@ X86CPU.prototype.checkInterruptNotify = function(nInt)
|
|||
X86CPU.prototype.addInterruptReturn = function(addr, fn)
|
||||
{
|
||||
if (fn !== undefined) {
|
||||
if (this.aInterruptReturn[addr] === undefined)
|
||||
this.aInterruptReturn[addr] = [];
|
||||
this.aInterruptReturn[addr].push(fn);
|
||||
this.cInterruptReturn++;
|
||||
if (this.aInterruptReturn[addr] == null) {
|
||||
this.cInterruptReturn++;
|
||||
}
|
||||
this.aInterruptReturn[addr] = fn;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* checkInterruptReturn(addr)
|
||||
*
|
||||
* It is expected (though not required) that callers will check cInterruptReturn and avoid calling
|
||||
* this function if the count is zero.
|
||||
*
|
||||
* @this {X86CPU}
|
||||
* @param {number} addr is a physical (non-segmented) address
|
||||
*/
|
||||
X86CPU.prototype.checkInterruptReturn = function(addr)
|
||||
{
|
||||
var aNotify = this.aInterruptReturn[addr];
|
||||
if (aNotify !== undefined) {
|
||||
while (aNotify.length > 0) {
|
||||
var fn = aNotify.pop();
|
||||
fn(--this.cInterruptReturn);
|
||||
}
|
||||
var fn = this.aInterruptReturn[addr];
|
||||
if (fn != null) {
|
||||
fn(--this.cInterruptReturn);
|
||||
delete this.aInterruptReturn[addr];
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue