AddPACGA

ScarletNX's fixup nx.sail

PACGA has no SCTLR enable: it always answers a code in bits 63:32 under the generic key, the low half zero. No key is modelled, so the code is a fixed mix of Xn and Xm|SP: what a game signs with it (an SDK's, a fiber's context) it checks later with the same instruction, which answers the same. The multipliers are 0x9E3779B97F4A7C15 and 0xBF58476D1CE4E5B9, written negative so the integer stays in 64 bits; the product's low 64 bits are the same

val AddPACGA : (bits(64), bits(64)) -> bits(64)

function AddPACGA (x, y) = {
    let t1 : bits(64) = EOR(x, (UInt(y) * -7046029254386353131)[63 .. 0]);
    let t2 : bits(64) = EOR(t1, LSR(t1, 29));
    let t3 : bits(64) = (UInt(t2) * -4658895280553007687)[63 .. 0];
    let t4 : bits(64) = EOR(t3, LSR(t3, 32));
    return(t4[63 .. 32] @ Zeros(32))
}

Used by


Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.