36 #include "debug/Quiesce.hh"
37 #include "debug/Timer.hh"
50 if (pil < 14 && softint & 0x10000)
54 if (pil < 14 && softint & 0x1)
60 for (
int bit = 15; bit > 0; --bit) {
61 if (1 << bit & softint && bit > pil)
73 {
"asi",
"tick",
"fprs",
"pcr",
"pic",
74 "gsr",
"softint_set",
"softint_clr",
"softint",
"tick_cmpr",
75 "stick",
"stick_cmpr",
76 "tpc",
"tnpc",
"tstate",
"tt",
"privtick",
"tba",
"pstate",
"tl",
79 "hpstate",
"htstate",
"hintp",
"htba",
"hver",
"strand_sts_reg",
81 "fsr",
"prictx",
"secctx",
"partId",
"lsuCtrlReg",
82 "scratch0",
"scratch1",
"scratch2",
"scratch3",
"scratch4",
83 "scratch5",
"scratch6",
"scratch7",
"cpuMondoHead",
"cpuMondoTail",
84 "devMondoHead",
"devMondoTail",
"resErrorHead",
"resErrorTail",
85 "nresErrorHead",
"nresErrorTail",
"TlbData" };
98 setMiscRegNoEffect(miscReg,
val);
107 if (tickCompare == NULL)
109 setMiscRegNoEffect(miscReg,
val);
110 if ((tick_cmpr & ~
mask(63)) && tickCompare->scheduled())
111 cpu->deschedule(tickCompare);
112 time = (tick_cmpr &
mask(63)) - (tick &
mask(63));
113 if (!(tick_cmpr & ~
mask(63)) && time > 0) {
114 if (tickCompare->scheduled())
115 cpu->deschedule(tickCompare);
116 cpu->schedule(tickCompare, cpu->clockEdge(
Cycles(time)));
118 DPRINTF(Timer,
"writing to TICK compare register value %#X\n",
val);
122 if (sTickCompare == NULL)
124 setMiscRegNoEffect(miscReg,
val);
125 if ((stick_cmpr & ~
mask(63)) && sTickCompare->scheduled())
126 cpu->deschedule(sTickCompare);
127 time = ((int64_t)(stick_cmpr &
mask(63)) - (int64_t)stick) -
129 if (!(stick_cmpr & ~
mask(63)) && time > 0) {
130 if (sTickCompare->scheduled())
131 cpu->deschedule(sTickCompare);
132 cpu->schedule(sTickCompare, cpu->clockEdge(
Cycles(time)));
134 DPRINTF(Timer,
"writing to sTICK compare register value %#X\n",
val);
138 setMiscRegNoEffect(miscReg,
val);
142 setMiscRegNoEffect(miscReg,
val);
147 panic(
"Shouldn't be writing HVER\n");
150 setMiscRegNoEffect(miscReg,
val);
159 setMiscRegNoEffect(miscReg,
val &
ULL(~0x7FFF));
164 setMiscRegNoEffect(miscReg,
val);
165 if (cpu_mondo_head != cpu_mondo_tail)
172 setMiscRegNoEffect(miscReg,
val);
173 if (dev_mondo_head != dev_mondo_tail)
180 setMiscRegNoEffect(miscReg,
val);
181 if (res_error_head != res_error_tail)
188 setMiscRegNoEffect(miscReg,
val);
193 if (hSTickCompare == NULL)
195 setMiscRegNoEffect(miscReg,
val);
196 if ((hstick_cmpr & ~
mask(63)) && hSTickCompare->scheduled())
197 cpu->deschedule(hSTickCompare);
198 time = ((int64_t)(hstick_cmpr &
mask(63)) - (int64_t)stick) -
200 if (!(hstick_cmpr & ~
mask(63)) && time > 0) {
201 if (hSTickCompare->scheduled())
202 cpu->deschedule(hSTickCompare);
203 cpu->schedule(hSTickCompare, cpu->clockEdge(
Cycles(time)));
205 DPRINTF(Timer,
"writing to hsTICK compare register value %#X\n",
val);
210 HPSTATE newVal =
val;
213 setMiscRegNoEffect(miscReg, newVal);
215 if (newVal.tlz &&
tl == 0 && !newVal.hpriv)
222 setMiscRegNoEffect(miscReg,
val);
227 panic(
"No support for setting spec_en bit\n");
228 setMiscRegNoEffect(miscReg,
bits(
val,0,0));
230 DPRINTF(Quiesce,
"Cpu executed quiescing instruction\n");
233 auto *workload = tc->getSystemPtr()->workload;
235 workload->recordQuiesce();
240 panic(
"Invalid write to FS misc register %s\n",
268 return readMiscRegNoEffect(miscReg) ;
271 return readMiscRegNoEffect(miscReg) &
ULL(~0x7FFF);
274 return ULL(0x3e) << 48 |
284 sys = tc->getSystemPtr();
286 temp = readMiscRegNoEffect(miscReg) & (STS::active | STS::speculative);
291 temp |= tc->contextId() << STS::shft_id;
293 for (
x = tc->contextId() & ~3; x < sys->threads.size();
x++) {
294 switch (sys->
threads[
x]->status()) {
296 temp |= STS::st_run << (STS::shft_fsm0 -
297 ((
x & 0x3) * (STS::shft_fsm0-STS::shft_fsm1)));
301 temp |= STS::st_idle << (STS::shft_fsm0 -
302 ((
x & 0x3) * (STS::shft_fsm0-STS::shft_fsm1)));
305 temp |= STS::st_halt << (STS::shft_fsm0 -
306 ((
x & 0x3) * (STS::shft_fsm0-STS::shft_fsm1)));
309 panic(
"What state are we in?!\n");
315 panic(
"Invalid read to FS misc register\n");
322 panic(
"tick compare not implemented\n");
328 BaseCPU *cpu = tc->getCpuPtr();
334 delay = ((int64_t)(stick_cmpr &
mask(63)) - (int64_t)stick) -
336 assert(delay >= 0 &&
"stick compare missed interrupt cycle");
339 DPRINTF(Timer,
"STick compare cycle reached at %#x\n",
340 (stick_cmpr &
mask(63)));
345 cpu->schedule(sTickCompare, cpu->clockEdge(
Cycles(delay)));
352 BaseCPU *cpu = tc->getCpuPtr();
361 delay = ((int64_t)(hstick_cmpr &
mask(63)) - (int64_t)stick) -
363 assert(delay >= 0 &&
"hstick compare missed interrupt cycle");
366 DPRINTF(Timer,
"HSTick compare cycle reached at %#x\n",
367 (stick_cmpr &
mask(63)));
373 cpu->schedule(hSTickCompare, cpu->clockEdge(
Cycles(delay)));