ISAv7
CSC: Store Capability via Capability
CSC cs,rt,offset(cb)
CSCR cs,rt(cb)
CSCI cs,offset(cb)
Cap register cs
is stored at the memory location of cb.base + cb.offset + rt + 16*offset
| Bit | size | value | |——-|—-|——–| | 31-26 | 6 | 0x3e | | 25-21 | 5 | cs | | 20-16 | 5 | cb | | 15-11 | 5 | rt | | 10-0 | 11 | offset |
enq(ControlTokenT ct)
:
decodeInstruction(ControlToken i, MIPSReg rc, MIPSReg pc)
:
check i.inst
: 4 categories: Immediate, Jump, Register, Coprocessor; return new control token di
Register .ri: check opcode ri.op
(6 bits)
ri.f
ri.f
is RDHWR: if rd
is 0-14/29/30: opA=rc & 64'hFFFF
Coprocessor .ci: check opcode ci.op
(6 bits)
cpEn.cu2
: if zero will throw exception.ci.cOp
:
di.inst = tagged Immediate unpack(pack(ci))
pc+8
;ci.r1
0/1/2/3: determine 15 registers to clear: 15-0/31-16 regular regs; or 15-0/31-16 cap regs. Update mask accordingly.di.opA = zeroExtend(mask)
input ControkTokenT di: enq(ControlTokenT di)
ouput ControlTokenT er: outQ.enq(er);
, or pendingOps.enq(er);
, or
Steps:
er.opA
, er.opB
determine er.storeData
pass opA, opB to coprocessor 1, get result and check exception.
determine er.archPC
prepare capReq
:
di.alu==Add
: the offset set to be opA+opB
capReq.offset
is er.opB
Grab cap Response as capVal
:
di.alu==Cap
, store capVal.data
in calcResult
.er.opA = capVal.data
;di.mem == Write
and di.storeDatasrc == CoPro2
, store er.storeData = capVal.storeData
;Parse di.alu
: store result at calcResult
.
in/out ControlTokenT er/mi enq(ControlTokenT er)
Steps:
CoProResponse capResp <- capCop.getAddress()
er.inst matches tagged Coprocessor .ci
&&&er.memSize==CapWord
er.opA
check er.mem == Write
er.test==SC
, set storeConditional = True
;er.mem = None
pass memory request down to dataMemory
. Parameters:
grab result from arith cap instructions that produce a late result
mi.opA = capResp.data
;mi.opB = capResp.data
;goes to dcache–l2cache–tagcontroller–memory.
Reference 1
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?