pacia

Pointer Authentication Code for Instruction Address (Key A)

PACIA <Xd>, <Xn>

Signs an instruction address using Key A.

Details

Computes a pointer authentication code for an instruction address using Key A and the modifier in Xn, storing the signed value in Xd. This is an AArch64-only instruction used for control-flow integrity. No general-purpose condition flags are set; authentication failure (during later verification) generates an exception.

Pseudocode Operation

Xd ← AddPAC(Xd, Xn, Key_A, InstructionAddressType)

Example

PACIA x0, x1

Encoding

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

Operands

  • Xd
    Destination 64-bit integer register
  • Xn
    Modifier

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0xDAC10000 PACIA <Xd>, <Xn|SP> A64 1 | 1 | 0 | 11010110 | 00001 | 00 | 0 | 000 | Rn | Rd

Description

Pointer Authentication Code for Instruction address, using key A. This instruction computes and inserts a pointer authentication code for an instruction address, using a modifier and key A. The address is: The modifier is: If FEAT_PAuth_LR is implemented and PSTATE.PACM is 1, then PACIA1716 and PACIASP include a second modifier that is: A PACIASP instruction has an implicit BTI instruction. The implicit BTI instruction of a PACIASP instruction is always compatible with PSTATE.BTYPE == 0b01 and PSTATE.BTYPE == 0b10. Controls in SCTLR_ELx configure whether the implicit BTI instruction of a PACIASP 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] = AddPACIA2(X[d, 64], SP[], PC64);
        else
            X[d, 64] = AddPACIA(X[d, 64], SP[]);
    else
        if IsFeatureImplemented(FEAT_PAuth_LR) && PSTATE.PACM == '1' && pacia1716 then
            X[d, 64] = AddPACIA2(X[d, 64], X[n, 64], X[15, 64]);
        else
            X[d, 64] = AddPACIA(X[d, 64], X[n, 64]);