pacib

Pointer Authentication Code (Inst B)

PACIB <Xd>, <Xn|SP>

Signs a pointer in Xd using Key B.

Details

Signs the pointer in Xd using the Instruction key B and a modifier from Xn or SP, storing the Pointer Authentication Code (PAC) in the high bits of Xd. The instruction does not modify the condition flags and operates only in AArch64 execution state with PAC support. The operation is implementation-defined; a PACIB PACIBSP variant uses SP as the modifier when Xn is omitted.

Pseudocode Operation

modifier ← Xn | SP
Xd ← AddPAC(Xd, modifier, key_b, instruction_key)

Example

PACIB x0, x1

Encoding

Binary Layout
1
1
0
11010110
00001
00
0
001
Rn
Rd
 
Format Data Processing
Opcode 0xDAC10400
Extension PAC (Security)

Operands

  • Xd
    Ptr
  • Xn
    Modifier

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xDAC10400 PACIB <Xd>, <Xn|SP> A64 1 | 1 | 0 | 11010110 | 00001 | 00 | 0 | 001 | Rn | Rd

Description

Pointer Authentication Code for Instruction address, using key B. This instruction computes and inserts a pointer authentication code for an instruction address, using a modifier and key B. The address is: The modifier is: If FEAT_PAuth_LR is implemented and PSTATE.PACM is 1, then PACIB1716 and PACIBSP include a second modifier that is: A PACIBSP instruction has an implicit BTI instruction. The implicit BTI instruction of a PACIBSP instruction is always compatible with PSTATE.BTYPE == 0b01 and PSTATE.BTYPE == 0b10. Controls in SCTLR_ELx configure whether the implicit BTI instruction of a PACIBSP instruction is compatible with PSTATE.BTYPE == 0b11. For more information, see PSTATE.BTYPE.

Operation

if IsFeatureImplemented(FEAT_PAuth) then
    if source_is_sp then
        if IsFeatureImplemented(FEAT_PAuth_LR) && PSTATE.PACM == '1' then
            X[d, 64] = AddPACIB2(X[d, 64], SP[], PC64);
        else
            X[d, 64] = AddPACIB(X[d, 64], SP[]);
    else
        if IsFeatureImplemented(FEAT_PAuth_LR) && PSTATE.PACM == '1' && pacib1716 then
            X[d, 64] = AddPACIB2(X[d, 64], X[n, 64], X[15, 64]);
        else
            X[d, 64] = AddPACIB(X[d, 64], X[n, 64]);