-- RTQuanta.Mesa -- last edited June 24, 1980 3:54 PM by Willie Sue -- last edited May 20, 1982 10:22 am by Paul Rovner DIRECTORY Inline USING[LongNumber]; RTQuanta: DEFINITIONS = BEGIN -- CONSTANTS LASTAddress: LONG CARDINAL = 17777777B; -- nonsense, would like LAST[Address] PagesPerQuantum: CARDINAL = 4; QuantumSize: CARDINAL = PagesPerQuantum*256; -- *** NOTE the assumption that LASTAddress/QuantumSize fits in 16 bits LASTQuantum: CARDINAL = LOOPHOLE[LASTAddress/QuantumSize, Inline.LongNumber].lowbits; QuantumIndex: TYPE = [0..LASTQuantum]; QuantumCount: TYPE = [0..LASTQuantum+1]; -- addresses are stored with the low order 16 bits first FullAddress: TYPE = MACHINE DEPENDENT RECORD [ qnl: [0..LAST[CARDINAL]/QuantumSize], --QuantumNumberLow qOff: [0..QuantumSize), --QuantumNumberOffset unused: [0..LAST[CARDINAL]/QuantumSize], qnh: [0..QuantumSize) --QuantumNumberHigh ]; QuantumNumber: TYPE = MACHINE DEPENDENT RECORD [ qnh: [0..QuantumSize), --QuantumNumberHigh qnl: [0..LAST[CARDINAL]/QuantumSize] --QuantumNumberLow ]; -- PROCEDURES QtmIndexToPtr: PROC[q: QuantumIndex] RETURNS[LONG POINTER] = INLINE { ptr: LONG POINTER; LOOPHOLE[ptr, FullAddress].qnh ← LOOPHOLE[q, QuantumNumber].qnh; LOOPHOLE[ptr, FullAddress].qnl ← LOOPHOLE[q, QuantumNumber].qnl; LOOPHOLE[ptr, FullAddress].unused ← LOOPHOLE[0]; LOOPHOLE[ptr, FullAddress].qOff ← LOOPHOLE[0]; RETURN[ptr]; }; PtrToQtmIndex: PROC[ptr: LONG POINTER] RETURNS[QuantumIndex] = INLINE { q: QuantumIndex; LOOPHOLE[q, QuantumNumber].qnh ← LOOPHOLE[ptr, FullAddress].qnh; LOOPHOLE[q, QuantumNumber].qnl ← LOOPHOLE[ptr, FullAddress].qnl; RETURN[q]; }; -- just a copy of QtmIndexToPtr MapQPtr: PROC[q: QuantumIndex] RETURNS[LONG POINTER] = INLINE { ptr: LONG POINTER; LOOPHOLE[ptr, FullAddress].qnh ← LOOPHOLE[q, QuantumNumber].qnh; LOOPHOLE[ptr, FullAddress].qnl ← LOOPHOLE[q, QuantumNumber].qnl; LOOPHOLE[ptr, FullAddress].unused ← LOOPHOLE[0]; LOOPHOLE[ptr, FullAddress].qOff ← LOOPHOLE[0]; RETURN[ptr]; }; QuantumSizeMULT: PROC[q: CARDINAL] RETURNS[LONG CARDINAL] = INLINE { ptr: LONG CARDINAL; LOOPHOLE[ptr, FullAddress].qnh ← LOOPHOLE[q, QuantumNumber].qnh; LOOPHOLE[ptr, FullAddress].qnl ← LOOPHOLE[q, QuantumNumber].qnl; LOOPHOLE[ptr, FullAddress].unused ← LOOPHOLE[0]; LOOPHOLE[ptr, FullAddress].qOff ← LOOPHOLE[0]; RETURN[ptr]; }; QuantumSizeDIV: PROC[ptr: LONG CARDINAL] RETURNS[QuantumIndex] = INLINE { q: QuantumIndex; LOOPHOLE[q, QuantumNumber].qnh ← LOOPHOLE[ptr, FullAddress].qnh; LOOPHOLE[q, QuantumNumber].qnl ← LOOPHOLE[ptr, FullAddress].qnl; RETURN[q]; }; QuantumSizeMOD: PROC[ptr: LONG CARDINAL] RETURNS[CARDINAL] = INLINE { RETURN[LOOPHOLE[ptr, FullAddress].qOff] }; END.