pacia

Pointer Authentication Code (Inst A)

PACIA <Xd>, <Xn|SP>

Signs a pointer in Xd using Key A and modifier Xm (or SP).

Details

Signs the pointer in Xd using the Instruction key A 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 PACIA PACIASP variant uses SP as the modifier when Xn is omitted.

Pseudocode Operation

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

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
    Ptr
  • 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]);