Skip to main content

eret

Function eret 

Source
pub fn eret(cop0: &mut Cop0) -> u64
Expand description

ERET โ€” return from an exception (UM Ch. 16, p. 434).

Returns where to resume. Three rules, all easy to half-implement:

  • If Status.ERL is set, resume at ErrorEPC and clear ERL; otherwise resume at EPC and clear EXL. Clearing the wrong one leaves the CPU stuck in kernel mode or returns to the wrong address.
  • LLbit is always cleared, which is the only thing besides cache invalidation that clears it (UM ยง3.1) โ€” the other half of the LL/SC contract implemented in Sprint 1.
  • ERET has no delay slot and must not itself be placed in one.

The caller clears the link bit; this function reports that it must.