tracking tlbLookupData.request/response for TLB hit/miss handling
TranslationIfc tlbLookupData
;TranslationIfc tlbLookupData
: .request(reqIn)
and .response()
tlb.lookup[1/2].request(reqIn)
and .response()
, which is defined in mkTLB
modulelookup = lookups
. see [../tlb], Do TLB searchtracking cache for hit/miss handling
Reference 1
File: cheri/trunk/CP0.bsv
mkCP0#(Bit#(16) coreId)(CP0Ifc)
interface CP0Ifc
, in cheri/trunk/MIPS.bsv:
readReq
writePending
;writeReg
;getAsid
// a method to get current code/data page tags???subinterfaces
interface Vector#(2, TranslationIfc) tlbs; // For the DMA
// cheri/trunk/MIPS.bsv
// The CPOIfc interface is the interface for the system control processor, or coprocessor 0 (CP0).
interface CP0Ifc;
method Action readReq(RegNum rn, Bit#(3) sel); // Initiate a CP0 register read
method Bool writePending; // Report whether there is a write pending in CP0
method ActionValue#(Word) readGet(Bool goingToWrite); // Deliver a read CP0 register to the main pipeline
method Action writeReg(RegNum rn, Bit#(3) sel, Word data, Bool forceKernelMode, Bool writeBack); // Write a CP0 register
method Cp0ExceptionReport getException(); // Get an exception report from CP0 (in writeback)
method Action putException(ExceptionWriteback exp, Address ivaddr, MIPSReg dvaddr); // Report the final exception to CP0 from writeback
method ActionValue#(Bool) setLlScReg(Address matchAddress, Bool link, Bool store); // Set the load linked address
method Action interrupts(Bit#(5) interruptLines); // Put the external interrupt line state into CP0
method CoProEn getCoprocessorEnables(); // Report the current state of the coprocessor enable signals.
method HWREna getHardwareRegisterEnables();
method Bit#(8) getAsid(); // Report the current address space identifier.
method Action putCount(Bit#(48) commonCount); // Put the common count register for all cores.
method Action putCacheConfiguration(L1ChCfg iCacheConfig, L1ChCfg dCacheConfig); // Recieve a report of
// the L1 cache configurations. This allows the caches to define their
// own configurations.
method Action putDeterministicCycleCount(Bool cycleCount);
// Whether the CP0 thinks tracing should be turned on
method Bool shouldTrace();
`ifndef CHERIOS
interface TranslationIfc tlbLookupInstruction; // Initiate an instruction TLB lookup
interface TranslationIfc tlbLookupData; // Initiate a data TLB lookup
`endif // CHERIOS
`ifdef DMA_VIRT
interface Vector#(2, TranslationIfc) tlbs; // For the DMA
`endif
endinterface
States includes:
FIFOs:
eretHappened
rnUpdate // store register write request in writeReg
sand do it in rule updateCP0Registers
dataUpdate
foreUpdate
expectWrites
deqExpectWrites
RWries, write then read in same cycle:
default values
PRId defaultProcID; // processor ID
TlbEntryLo defaulttlbEntryLo; //
TlbEntryHi defaultTlbEntryHi; //
TlbResponse defaultTlbResponse;
Config0 defaultConfig0; // cache coherency algorithm; MMU type; Little/Big endian; …
LxChCfg l2ChCfg, l3ChCfg; // cache associativity; cache line size; …
Config1 defaultConfig1; // coprocessor 2; size of TLB entry. (MMU has mmuSize +1 entries)
Config2 defaultConfig2; // l2 config, l3 config
Config3 defaultConfig3; // …
Config6 defaultConfig6; // inferred from nlm’s source code in FreeBSD; tlbSize 271, …
Registers: 30 different categories
Reg#(StatusRegister) sr <- mkConfigReg(defaultSR);
TLB module: TLBIfc tlb <- mkTLB(coreid.coreID);
(ifndef MICRO && ifndef CHERIOS)
declaration: in cheri/trunk/MIPS.bsv:
// cheri/trunk/MIPS.bsv:
interface TranslationIfc;
method ActionValue#(TlbResponse) request(TlbRequest reqIn);
method ActionValue#(TlbResponse) response();
definition:
Steps: query tlb using tlb.lookup[2].requets(reqIn)
and return result that contains success/failure/exception info
TlbResponse retVal <- tlb.lookup[2].request(reqIn);
kernelMode
or debug mode.Code:
// cheri/trunk/CP0.bsv
method ActionValue#(TlbResponse) request(TlbRequest reqIn);
TlbResponse retVal <- tlb.lookup[2].request(reqIn);
if (!kernelMode && !retVal.fromDebug) begin// && retVal.exception==None) begin
if (retVal.priv==Kernel) retVal.exception = (retVal.write) ? DADES : DADEL;
else if (retVal.priv == Supervisor && !supervisorMode) retVal.exception = (retVal.write) ? DADES : DADEL;
end
if (retVal.addr[35:0] == {watchHi,watchLo[31:3],3'b0} && // If there has not been an exception and the address matches
((watchLo[1]==1'b1 && !retVal.write) || (watchLo[0]==1'b1 && retVal.write))) begin // and the address is watching for a read or a write and the operation matches.
if (retVal.exception == None) retVal.exception = Watch;
end
return retVal;
endmethod
Steps: query response info via tlb.lookup[2].response()
and return result with failure/success/exception info
TlbResponse retVal <- tlb.lookup[2].response();
TlbResponse retVal <- tlb.lookup[1].request(reqIn);
tlb.lookup[1].response()
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?