Changed Debugger and diagnostic functions to call probeAddr() to safely probe linear addresses

This commit is contained in:
Jeff Parsons 2015-05-08 12:22:12 -07:00 committed by jeffpar
commit ab0399064e
4 changed files with 27 additions and 7 deletions

View file

@ -2703,6 +2703,24 @@ X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
return fBound;
};
/**
* probeAddr(addr)
*
* Used by the Debugger to probe addresses without risk of triggering a page fault, and by internal
* functions, like fnFaultMessage(), that also need to avoid triggering faults, since they're not part
* of standard CPU operation.
*
* @this {X86CPU}
* @param {number} addr is a linear address
* @return {number|null} byte (8-bit) value at that address, or null if invalid
*/
X86CPU.prototype.probeAddr = function(addr)
{
var block = this.aMemBlocks[(addr & this.memMask) >>> this.blockShift];
if (block.type == Memory.TYPE.UNPAGED) return null;
return block.readByteDirect(addr & this.blockLimit, addr);
};
/**
* getByte(addr)
*