172
SPARC JPS1 Implementation Supplement:
Fujitsu SPARC64 V
• Release 1.0, 1 July 2002
void
expected_software_handling_of_ADE_trap()
{
/* Only %r0-%r7 can be used from here to Point#1 because the register window
control registers may not have valid value until Point#1. It is
recommended that only %r0-%r7 are used as general-purpose registers (GPR)
in the whole single-ADE trap handler, if possible. */
ASI_SCRATCH_REG
p
← %r
X
;
ASI_SCRATCH_REG
q
← %r
Y
;
%r
X
← ASI_UGESR;
if ((%r
X
&& 0x07) ≠ 0) {
/* multiple-ADE trap occurrence */
invoke panic routine and take system dump as much as possible
with the running environment of ASI_ERROR_CONTROL.WEAK_ED == 1;
}
if (%r
X
.IUG_%R == 1) {
%r1-%r31 except %r
X
and %r
Y
← %r0;
%y ← %r0;
%tstate.pstate ← %r0; /* because ccr or asi field in %tstate.pstate
contains the error */
}
else {
save required %r1-%r7 to the ADE trap save area, using %r
X
, %r
Y
,
ASI_SCRATCH_REG
p
and ASI_SCRATCH_REG
q
;
/* whole %r save and restore is required to retry the context
with PSTATE.AG == 1 */
}
if (ASI_UGESR.IUG_PSTATE == 1) {
%tstate.pstate ← %r0;
%tpc ← %r0;
%pil ← %r0;
%wstate ← %r0;
All general-purpose registers in the register window ← %r0;
Set the register window control registers
(CWP, CANSAVE, CANRESTORE, OTHERWIN, CLEANWIN) to appropriate values;
}
/* Point#1: Program can use the general-purpose registers except %r0-%r7
after this because the register window control registers were validated
in the above step. */
if ((ASI_UGESR.IAUG_CRE == 1) ||( ASI_UGESR.IAUG_TSBCTXT == 1) ||
(ASI_UGESR.IUG_TSBP == 1) || (ASI_UGESR.IUG_TSTATE == 1) ||
(ASI_UGESR.IUG_%F==1)) {
Write to each register with an error indication, to erase as many
register errors as possible;
}
if (ASI_UGESR.IUG_DTLB == 1) {
execute demap_all for DTLB;
/* A locked fDTLB entry with uncorrectable error is not removed by this
operation. A locked fDTLB entry with UE never detects its tag match or