pacib
Pointer Authentication Code for Instruction Address (Key B)
PACIB <Xd>, <Xn>
Signs an instruction address using Key B.
Details
Computes a pointer authentication code for an instruction address using Key B 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_B, InstructionAddressType)
Example
PACIB x0, x1
Encoding
Binary Layout
1
1
0
11010110
00001
00
0
001
Rn
Rd
Operands
-
Xd
Destination 64-bit integer register -
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]);