hashchk

Hash Check

hashchk RA

Checks the hash of the Return Address Stack (ROP Protection).

Details

Verifies the integrity of a hashed Return Address Stack entry at the address in RA to provide Return-Oriented Programming (ROP) protection. The instruction reads the hash stored at RA, recomputes it, and compares against an expected value; if they do not match, a program interrupt is triggered. This is a privileged instruction requiring supervisor-level access.

Pseudocode Operation

hash_addr ← RA
stored_hash ← [hash_addr]
expected_hash ← ComputeHash(RA)
if stored_hash ≠ expected_hash then
  TrapException()

Programming Note

If RA=0, the instruction form is invalid. EA must be a multiple of 8.

Example

hashchk r4

Encoding

Binary Layout
31
0
/
6
RA
11
/
16
754
/
 
Format X-form
Opcode 0x7C0005E4
Extension Base
Registers Altered HASHKEYR

Operands

  • RA
    Address
  • RB
    Source General Purpose Register
  • offset
    Offset value
  • RT
    Target General Purpose Register