infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
abi_arm64_common.h
Go to the documentation of this file.
1#pragma once
34#include <stdint.h>
35
81
125
138// Common bitfields
139#define A64_SF_64BIT (1U << 31) // 'sf' bit for 64-bit operations
140#define A64_SF_32BIT (0U << 31)
141#define A64_V_VECTOR (1U << 26) // Vector bit for SIMD/FP instructions
142
143// Data Processing -- Immediate
144#define A64_OPC_ADD (0b00U << 29)
145#define A64_OPC_ADDS (0b01U << 29)
146#define A64_OPC_SUB (0b10U << 29)
147#define A64_OPC_SUBS (0b11U << 29)
148#define A64_OP_ADD_SUB_IMM (0b0010001U << 24)
149
150// Data Processing -- Register
151#define A64_OP_ADD_SUB_REG (0b01011U << 24)
152#define A64_OP_LOGICAL_REG (0b01010U << 24)
153#define A64_OPCODE_ORR (0b01U << 29)
154
155// Move Wide
156#define A64_OPC_MOVZ (0b10U << 29)
157#define A64_OPC_MOVK (0b11U << 29)
158#define A64_OP_MOVE_WIDE_IMM (0b100101U << 23)
159
160// Load/Store -- Immediate Unsigned Offset
161#define A64_OP_LOAD_STORE_IMM_UNSIGNED (0b111001U << 24)
162#define A64_LDR_OP (1U << 22)
163#define A64_OP_LOAD_STORE_PAIR_BASE (0b101000U << 24) // Base for all LDP/STP variants
164#define A64_OPC_STP (0b00U << 30) // opc field for Store Pair
165#define A64_OPC_LDP (0b01U << 30) // opc field for Load Pair
166#define A64_L_BIT_LOAD (1U << 22) // The 'L' bit: 1 for Load, 0 for Store
167
168// Addressing modes for LDP/STP
169#define A64_ADDR_POST_INDEX (0b01U << 23)
170#define A64_ADDR_PRE_INDEX (0b11U << 23)
171#define A64_ADDR_SIGNED_OFFSET (0b10U << 23)
172
173// Branching
174#define A64_OP_BRANCH_REG (0b1101011U << 25)
175#define A64_OPC_BR (0b0000U << 21)
176#define A64_OPC_BLR (0b0001U << 21)
177#define A64_OPC_RET (0b0010U << 21)
178#define A64_OP_COMPARE_BRANCH_IMM (0b011010U << 25)
179#define A64_OPC_CBNZ (1U << 24)
180
181// System
182#define A64_OP_SYSTEM (0b11010100U << 25)
183#define A64_OP_BRK (0b00000000001U << 16)
184
// end aarch64_opcodes
arm64_gpr
Definition abi_arm64_common.h:47
@ X1_REG
Argument 2 / Volatile.
Definition abi_arm64_common.h:49
@ X13_REG
Volatile scratch register.
Definition abi_arm64_common.h:61
@ X24_REG
Callee-saved.
Definition abi_arm64_common.h:72
@ X14_REG
Volatile scratch register.
Definition abi_arm64_common.h:62
@ X12_REG
Volatile scratch register.
Definition abi_arm64_common.h:60
@ X28_REG
Callee-saved.
Definition abi_arm64_common.h:76
@ X25_REG
Callee-saved.
Definition abi_arm64_common.h:73
@ X7_REG
Argument 8 / Volatile.
Definition abi_arm64_common.h:55
@ X4_REG
Argument 5 / Volatile.
Definition abi_arm64_common.h:52
@ X22_REG
Callee-saved.
Definition abi_arm64_common.h:70
@ X21_REG
Callee-saved.
Definition abi_arm64_common.h:69
@ X16_REG
Intra-Procedure-call scratch register (IP0) / Volatile. Linker-modifiable.
Definition abi_arm64_common.h:64
@ SP_REG
Stack Pointer (SP). In some instructions, encoding 31 refers to the Zero Register (XZR/WZR).
Definition abi_arm64_common.h:79
@ X15_REG
Volatile scratch register.
Definition abi_arm64_common.h:63
@ X29_FP_REG
Frame Pointer (FP) / Callee-saved.
Definition abi_arm64_common.h:77
@ X11_REG
Volatile scratch register.
Definition abi_arm64_common.h:59
@ X8_REG
Indirect result location register (holds address for large struct returns) / Volatile.
Definition abi_arm64_common.h:56
@ X23_REG
Callee-saved.
Definition abi_arm64_common.h:71
@ X0_REG
Argument 1 / Return value / Volatile (caller-saved).
Definition abi_arm64_common.h:48
@ X6_REG
Argument 7 / Volatile.
Definition abi_arm64_common.h:54
@ X17_REG
Intra-Procedure-call scratch register (IP1) / Volatile. Linker-modifiable.
Definition abi_arm64_common.h:65
@ X3_REG
Argument 4 / Volatile.
Definition abi_arm64_common.h:51
@ X19_REG
Callee-saved. Must be preserved by a called function.
Definition abi_arm64_common.h:67
@ X30_LR_REG
Link Register (LR), holds the return address / Callee-saved by convention, but volatile on call.
Definition abi_arm64_common.h:78
@ X18_REG
Platform Register (reserved, usage is platform-specific) / May be callee-saved. Avoid use.
Definition abi_arm64_common.h:66
@ X5_REG
Argument 6 / Volatile.
Definition abi_arm64_common.h:53
@ X27_REG
Callee-saved.
Definition abi_arm64_common.h:75
@ X9_REG
Volatile (caller-saved) scratch register.
Definition abi_arm64_common.h:57
@ X2_REG
Argument 3 / Volatile.
Definition abi_arm64_common.h:50
@ X26_REG
Callee-saved.
Definition abi_arm64_common.h:74
@ X20_REG
Callee-saved.
Definition abi_arm64_common.h:68
@ X10_REG
Volatile scratch register.
Definition abi_arm64_common.h:58
arm64_vpr
Definition abi_arm64_common.h:91
@ V13_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:105
@ V23_REG
Volatile scratch register.
Definition abi_arm64_common.h:115
@ V10_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:102
@ V5_REG
Argument 6 / Volatile.
Definition abi_arm64_common.h:97
@ V12_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:104
@ V27_REG
Volatile scratch register.
Definition abi_arm64_common.h:119
@ V1_REG
Argument 2 / Volatile.
Definition abi_arm64_common.h:93
@ V0_REG
Argument 1 / Return value / Volatile (caller-saved).
Definition abi_arm64_common.h:92
@ V9_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:101
@ V7_REG
Argument 8 / Volatile.
Definition abi_arm64_common.h:99
@ V17_REG
Volatile scratch register.
Definition abi_arm64_common.h:109
@ V21_REG
Volatile scratch register.
Definition abi_arm64_common.h:113
@ V29_REG
Volatile scratch register.
Definition abi_arm64_common.h:121
@ V8_REG
Callee-saved (Note: only the lower 64 bits must be preserved).
Definition abi_arm64_common.h:100
@ V18_REG
Volatile scratch register.
Definition abi_arm64_common.h:110
@ V19_REG
Volatile scratch register.
Definition abi_arm64_common.h:111
@ V30_REG
Volatile scratch register.
Definition abi_arm64_common.h:122
@ V28_REG
Volatile scratch register.
Definition abi_arm64_common.h:120
@ V26_REG
Volatile scratch register.
Definition abi_arm64_common.h:118
@ V25_REG
Volatile scratch register.
Definition abi_arm64_common.h:117
@ V31_REG
Volatile scratch register.
Definition abi_arm64_common.h:123
@ V6_REG
Argument 7 / Volatile.
Definition abi_arm64_common.h:98
@ V16_REG
Volatile (caller-saved) scratch register.
Definition abi_arm64_common.h:108
@ V15_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:107
@ V3_REG
Argument 4 / Volatile.
Definition abi_arm64_common.h:95
@ V2_REG
Argument 3 / Volatile.
Definition abi_arm64_common.h:94
@ V4_REG
Argument 5 / Volatile.
Definition abi_arm64_common.h:96
@ V24_REG
Volatile scratch register.
Definition abi_arm64_common.h:116
@ V11_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:103
@ V22_REG
Volatile scratch register.
Definition abi_arm64_common.h:114
@ V14_REG
Callee-saved (only lower 64 bits).
Definition abi_arm64_common.h:106
@ V20_REG
Volatile scratch register.
Definition abi_arm64_common.h:112