More debugger paging improvements
This commit is contained in:
parent
ab0399064e
commit
83f2218e27
4 changed files with 24 additions and 15 deletions
|
|
@ -78,7 +78,7 @@
|
|||
"debugger": {
|
||||
"id": "pc386.debugger",
|
||||
"name": "",
|
||||
"commands": "",
|
||||
"commands": "bp F000:825F;g",
|
||||
"messages": ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2688,12 +2688,14 @@ if (DEBUGGER) {
|
|||
if (nState >= 0 && this.aaOpcodeCounts.length) {
|
||||
this.cInstructions++;
|
||||
var bOpcode = this.cpu.probeAddr(addr);
|
||||
this.aaOpcodeCounts[bOpcode][1]++;
|
||||
var a = this.aOpcodeHistory[this.iOpcodeHistory];
|
||||
a[0] = this.cpu.getIP();
|
||||
a[1] = this.cpu.getCS();
|
||||
a[2] = addr;
|
||||
if (++this.iOpcodeHistory == this.aOpcodeHistory.length) this.iOpcodeHistory = 0;
|
||||
if (bOpcode != null) {
|
||||
this.aaOpcodeCounts[bOpcode][1]++;
|
||||
var a = this.aOpcodeHistory[this.iOpcodeHistory];
|
||||
a[0] = this.cpu.getIP();
|
||||
a[1] = this.cpu.getCS();
|
||||
a[2] = addr;
|
||||
if (++this.iOpcodeHistory == this.aOpcodeHistory.length) this.iOpcodeHistory = 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -737,9 +737,10 @@ X86CPU.prototype.enablePageBlocks = function()
|
|||
* @this {X86CPU}
|
||||
* @param {number} addr is a linear address
|
||||
* @param {boolean} fWrite (true if called for a write, false if for a read)
|
||||
* @param {boolean} [fSuppress] (true if any faults, remapping, etc should be suppressed)
|
||||
* @return {Memory|null}
|
||||
*/
|
||||
X86CPU.prototype.mapPageBlock = function(addr, fWrite)
|
||||
X86CPU.prototype.mapPageBlock = function(addr, fWrite, fSuppress)
|
||||
{
|
||||
var offPDE = (addr & X86.LADDR.PDE.MASK) >>> X86.LADDR.PDE.SHIFT;
|
||||
var addrPDE = this.regCR3 + offPDE;
|
||||
|
|
@ -752,12 +753,12 @@ X86CPU.prototype.mapPageBlock = function(addr, fWrite)
|
|||
var pde = blockPDE.readLong(offPDE);
|
||||
|
||||
if (!(pde & X86.PTE.PRESENT)) {
|
||||
X86.fnPageFault.call(this, addr, false, fWrite);
|
||||
if (!fSuppress) X86.fnPageFault.call(this, addr, false, fWrite);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(pde & X86.PTE.USER) && this.segCS.cpl == 3) {
|
||||
X86.fnPageFault.call(this, addr, true, fWrite);
|
||||
if (!fSuppress) X86.fnPageFault.call(this, addr, true, fWrite);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -771,13 +772,13 @@ X86CPU.prototype.mapPageBlock = function(addr, fWrite)
|
|||
var blockPTE = this.aBusBlocks[(addrPTE & this.busMask) >>> this.blockShift];
|
||||
var pte = blockPTE.readLong(offPTE);
|
||||
|
||||
if (!(pte & X86.PTE.PRESENT)) {
|
||||
X86.fnPageFault.call(this, addr, false, fWrite);
|
||||
if (!(pte & X86.PTE.PRESENT) && !fSuppress) {
|
||||
if (!fSuppress) X86.fnPageFault.call(this, addr, false, fWrite);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(pte & X86.PTE.USER) && this.segCS.cpl == 3) {
|
||||
X86.fnPageFault.call(this, addr, true, fWrite);
|
||||
if (!fSuppress) X86.fnPageFault.call(this, addr, true, fWrite);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -786,6 +787,7 @@ X86CPU.prototype.mapPageBlock = function(addr, fWrite)
|
|||
* TODO: Since we're immediately shifting addrPhys by blockShift, we could also skip adding the addr's offset.
|
||||
*/
|
||||
var blockPhys = this.aBusBlocks[(addrPhys & this.busMask) >>> this.blockShift];
|
||||
if (fSuppress) return blockPhys;
|
||||
|
||||
/*
|
||||
* So we have the block containing the physical memory corresponding to the given linear address.
|
||||
|
|
@ -2717,7 +2719,10 @@ X86CPU.prototype.setBinding = function(sHTMLType, sBinding, control)
|
|||
X86CPU.prototype.probeAddr = function(addr)
|
||||
{
|
||||
var block = this.aMemBlocks[(addr & this.memMask) >>> this.blockShift];
|
||||
if (block.type == Memory.TYPE.UNPAGED) return null;
|
||||
if (block.type == Memory.TYPE.UNPAGED) {
|
||||
block = this.mapPageBlock(addr, false, true);
|
||||
if (!block) return null;
|
||||
}
|
||||
return block.readByteDirect(addr & this.blockLimit, addr);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
bits 16
|
||||
|
||||
PAGING equ 1
|
||||
|
||||
;
|
||||
; If we built our data structures in RAM, we might use the first page of RAM (0x0000-0x0fff) like so:
|
||||
;
|
||||
|
|
@ -264,7 +266,7 @@ initPT: stosd
|
|||
goProt: o32 lgdt [cs:addrGDT]
|
||||
mov cr3,esi
|
||||
mov eax,cr0
|
||||
%ifdef PAGING
|
||||
%if PAGING
|
||||
or eax,CR0_MSW_PE | CR0_PG
|
||||
%else
|
||||
or eax,CR0_MSW_PE
|
||||
|
|
|
|||
Loading…
Reference in a new issue