__compute_r...epc_for_insn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… __compute_r...epc_for_insn(9) β€” like, the Kernel API Manual girlies know ✨

okay so bestie, before we even start: yes, the title is literally abbreviated to __compute_r...epc_for_insn(9) and that's just how the Kernel API Manual rolls it. The full name is __compute_return_epc_for_insn and she is the main character here. No cap. πŸŽ€


🌸 NAME 🌸

__compute_return_epc_for_insn β€” computes the return address and does emulate branch simulation, if required. That's it, that's the vibe. πŸ¦‹


⭐ SYNOPSIS ⭐

int __compute_return_epc_for_insn (struct pt_regs *regs , union
       mips_instruction insn );

two arguments, one int coming back at you. slay. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • regs β€” pointer to pt_regs. that's the pointer. she points. periodt. 🫢
  • insn β€” the branch instruction to decode. this is the one we're looking at, bestie. πŸ”

πŸ”₯ RETURN πŸ”₯

  • -EFAULT on error β€” and heads up, this one forces SIGILL. like, it does not play. πŸ’€
  • on success it returns 0 or BRANCH_LIKELY_TAKEN as appropriate, after evaluating the branch. iykyk. ✨

🧚 DESCRIPTION 🧚

okay so this is the MIPS R6 Compact branches + forbidden slots situation, and honestly it's giving very specific lore, so let me break it down. 🌈

Compact branches do not throw exceptions because they do not have delay slots. iconic, no notes. πŸ‘‘

The forbidden slot instruction ($PC+4) is only executed if the branch was not taken. Otherwise, the forbidden slot is skipped entirely β€” like, fully ghosted. πŸ™ˆ

So what that means is: the only possible reason to be here because of a MIPS R6 compact branch instruction is that the forbidden slot has thrown one. 🫠 And in that case, the branch was not taken, so the EPC can be safely set to EPC + 8. boom. math. ate. πŸ’–

no guessing, no improvising β€” that's literally the whole reasoning, bestie. πŸ’œ

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./arch/mips/kernel/branch.c β€” go read her, she has the range. πŸ“–

and that's the page!! πŸŽ‰ this little icon lives in ./arch/mips/kernel, dated October 2026, and it's part of the Kernel API Manual. mwah. πŸ’‹βœ¨πŸ’–

πŸ“¦ where this page comes from