Function xuantie::asm::ipop

source · []
pub unsafe fn ipop()
Expand description

IPOP, fast interrupt stack pop instruction

Pop interrupt switch registers from current stack, and return from interrupt environment. It pops mcause, mepc, x1, x5 to x7, x10 to x17 and x28 to x31 from stack. Another word, the popped xi integer registers are ra, t0 to t6, and a0 to a7 (not in order) other than CSR registers mcause and mepc.

In pseudocode, it performs like:

mcause = *sp.add(17);
mepc = *sp.add(16);
ra = *sp.add(15);
/* ... mcause, mepc, {xi} ← Mem[sp + 68] ..= Mem[sp] */
t6 = *sp.add(0);
sp = sp.add(18);
riscv::asm::mret();

Permissions

Must run on M mode.

Exceptions

Raises store unaligned exception, store access exception, or illegal instruction exception.