The memory management toggle-in passes (see /devices/pdp11/machine/1170/panel/debugger)

This commit is contained in:
Jeff 2016-11-02 21:20:04 -07:00 committed by Jeff Parsons
commit 0afab359ad
7 changed files with 222 additions and 178 deletions

View file

@ -93,8 +93,8 @@ function BusPDP11(parmsBus, cpu, dbg)
* For PDPjs machines, the ideal block size is 8Kb (IOPAGE_LENGTH), the size of the IOPAGE on all PDP-11 machines;
* as a result, our IOController functions assume that all incoming offsets are within a single 8Kb block.
*/
this.addrTotal = Math.pow(2, this.nBusWidth);
this.nBusLimit = this.nBusMask = (this.addrTotal - 1) | 0;
this.addrTotal = 1 << this.nBusWidth;
this.nBusLimit = this.nBusMask = (this.addrTotal - 1);
this.nBlockSize = BusPDP11.IOPAGE_LENGTH;
this.nBlockShift = Math.log2(this.nBlockSize); // ES6 ALERT (alternatively: Math.log(this.nBlockSize) / Math.LN2)
this.nBlockLen = this.nBlockSize >> 2;
@ -457,7 +457,9 @@ BusPDP11.prototype.setIOPageRange = function(nRange)
}
if (nRange) {
this.nIOPageRange = nRange;
addr = (1 << nRange) - BusPDP11.IOPAGE_LENGTH;
addr = (1 << nRange);
this.nBusLimit = this.nBusMask = (addr - 1);
addr -= BusPDP11.IOPAGE_LENGTH;
this.prevIOPageBlocks = this.getMemoryBlocks(addr, BusPDP11.IOPAGE_LENGTH);
if (this.realIOPageBlocks) {
this.setMemoryBlocks(addr, BusPDP11.IOPAGE_LENGTH, this.realIOPageBlocks);

View file

@ -1312,15 +1312,16 @@ CPUStatePDP11.prototype.mapUnibus = function(addr)
*/
CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFlags)
{
var page, pdr, physicalAddress, errorMask = 0;
var page, pdr, physicalAddress;
this.assert(!(virtualAddress & ~0x1ffff) && accessFlags);
/*
* Verify that 1) the incoming virtual address is within the 17-bit I/D range, 2) that
* accessFlags is properly set, and 3) that the MMU is enabled (because non-MMU code paths
* should no longer be going through this function; the Bus component is responsible for
* mapping physical addresses appropriately).
* This can happen when the DSTMODE (MAINT) bit of MMR0 is set but *not* the ENABLED bit.
*/
this.assert(!(virtualAddress & ~0x1ffff) && accessFlags && (accessFlags & this.mmuEnable));
if (!(accessFlags & this.mmuEnable)) {
return virtualAddress;
}
this.mmuLastVirtual = virtualAddress;
@ -1329,6 +1330,7 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
pdr = this.mmuPDR[this.mmuMode][page];
physicalAddress = ((this.mmuPAR[this.mmuMode][page] << 6) + (virtualAddress & 0x1fff)) & this.mmuMask;
var errorMask = 0;
switch (pdr & 0x7) {
case 1: // read-only with trap
errorMask = 0x1000; // MMU trap

View file

@ -316,7 +316,7 @@ var PDP11 = {
PAGE_D: 0x0010, // last fault occurred in D space
PAGE_MODE: 0x0060, // processor mode as of last fault
COMPLETED: 0x0080, // last instruction completed
DSTMODE: 0x0100, // only destination mode references will be relocated (for diagnostic use)
DSTMODE: 0x0100, // only destination mode references will be relocated (aka MAINT bit)
MMU_TRAPS: 0x0200, // enable MMU traps
UNUSED: 0x0C00,
TRAP_MMU: 0x1000, // trap: MMU