/abi-and-calling-conventions
ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill abi-and-calling-conventions --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/abi-and-calling-conventions
Context preview
The summary Claude sees to decide when to auto-load this skill.
ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic
SKILL.md
abi-and-calling-conventions.SKILL.mdname: abi-and-calling-conventions
description: ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic function, or FFI registers.
ABI and Calling Conventions
Purpose
Document application binary interface (ABI) rules: register roles, stack alignment, argument passing, return values, and variadic conventions across System V AMD64, ARM AAPCS, and RISC-V — essential for assembly, FFI, and debugging.
When to Use
- Writing assembly thunks or inline asm clobbers
- Debugging corrupted stack in mixed C/asm
- FFI between Rust/C/Zig (`skills/rust/rust-ffi`, `skills/zig/zig-cinterop`)
- Reading disassembly from `skills/debuggers/gdb`
Workflow
1. System V AMD64 (Linux/macOS)
| Item | Rule | |------|------| | Integer args | `rdi, rsi, rdx, rcx, r8, r9` | | XMM args | `xmm0`–`xmm7` (float) | | Return int/ptr | `rax` (+ `rdx` for 128-bit) | | Stack alignment | 16-byte before `call` | | Red zone | 128 bytes below `rsp` (Linux) | | Callee-saved | `rbx, rbp, r12–r15` |
/* void foo(int a, int b, int c, int d, int e, int f, int g); */
/* a–f in regs, g on stack */
Windows x64 differs — see `skills/compilers/msvc-cl`.
2. ARM AAPCS (AArch32/AArch64)
**AArch64:**
| Item | Rule | |------|------| | Integer args | `x0`–`x7` | | Float args | `v0`–`v7` | | Return | `x0`/`x1` or `v0` | | Stack align | 16-byte | | Callee-saved | `x19`–`x28`, `fp` (`x29`), `lr` (`x30`) |
Thumb interworking: LSB of function pointer set for Thumb code.
See `skills/low-level-programming/assembly-arm`.
3. RISC-V psABI (RV64)
| Item | Rule | |------|------| | Integer args | `a0`–`a7` | | Callee-saved | `s0`–`s11`, `sp` | | Return | `a0`, `a1` | | Stack align | 16-byte |
See `skills/low-level-programming/assembly-riscv`.
4. Stack frame layout (conceptual)
high addresses
├── return address
├── saved frame pointer
├── local variables
├── spill slots / alignment padding
└── outgoing args (if any)
low addresses (rsp)
5. Variadic functions
System V: `al` holds number of vector args used; `register_save_area` on stack for `va_start`. Prefer typed wrappers over raw `va_arg` in portable FFI.
6. Verify in compiler output
gcc -O2 -S -o - foo.c # study .cfi_* and mov args
objdump -d -M intel ./a.out
7. Agent usage
/abi-and-calling-conventions Which registers hold args 5–8 in AArch64 for my C function?
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | Crash on `call` | Stack misaligned | Align `rsp` mod 16 | | Wrong float arg | XMM vs GPR mismatch | Match prototype | | Corrupt callee-saved | Asm clobber missing | List in clobber or save | | FFI garbage | Windows vs SysV mix | Match toolchain ABI | | Variadic UB | Wrong type to `va_arg` | Cast to promoted type |
Related Skills
- `skills/low-level-programming/assembly-x86` — x86-64 asm
- `skills/low-level-programming/assembly-arm` — AAPCS examples
- `skills/low-level-programming/assembly-riscv` — RISC-V asm
- `skills/rust/rust-ffi` — `extern "C"` guarantees
- `skills/binaries/elf-inspection` — symbol and relocation views
Read more
name: abi-and-calling-conventions description: ABI and calling conventions skill for cross-language boundaries. Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Activates on queries about calling convention, ABI, System V AMD64, AAPCS, stack frame, variadic function, or FFI registers.
ABI and Calling Conventions
Purpose
Document application binary interface (ABI) rules: register roles, stack alignment, argument passing, return values, and variadic conventions across System V AMD64, ARM AAPCS, and RISC-V — essential for assembly, FFI, and debugging.
When to Use
- Writing assembly thunks or inline asm clobbers
- Debugging corrupted stack in mixed C/asm
- FFI between Rust/C/Zig (`skills/rust/rust-ffi`, `skills/zig/zig-cinterop`)
- Reading disassembly from `skills/debuggers/gdb`
Workflow
1. System V AMD64 (Linux/macOS)
| Item | Rule | |------|------| | Integer args | `rdi, rsi, rdx, rcx, r8, r9` | | XMM args | `xmm0`–`xmm7` (float) | | Return int/ptr | `rax` (+ `rdx` for 128-bit) | | Stack alignment | 16-byte before `call` | | Red zone | 128 bytes below `rsp` (Linux) | | Callee-saved | `rbx, rbp, r12–r15` |
/* void foo(int a, int b, int c, int d, int e, int f, int g); */ /* a–f in regs, g on stack */
Windows x64 differs — see `skills/compilers/msvc-cl`.
2. ARM AAPCS (AArch32/AArch64)
**AArch64:**
| Item | Rule | |------|------| | Integer args | `x0`–`x7` | | Float args | `v0`–`v7` | | Return | `x0`/`x1` or `v0` | | Stack align | 16-byte | | Callee-saved | `x19`–`x28`, `fp` (`x29`), `lr` (`x30`) |
Thumb interworking: LSB of function pointer set for Thumb code.
See `skills/low-level-programming/assembly-arm`.
3. RISC-V psABI (RV64)
| Item | Rule | |------|------| | Integer args | `a0`–`a7` | | Callee-saved | `s0`–`s11`, `sp` | | Return | `a0`, `a1` | | Stack align | 16-byte |
See `skills/low-level-programming/assembly-riscv`.
4. Stack frame layout (conceptual)
high addresses ├── return address ├── saved frame pointer ├── local variables ├── spill slots / alignment padding └── outgoing args (if any) low addresses (rsp)
5. Variadic functions
System V: `al` holds number of vector args used; `register_save_area` on stack for `va_start`. Prefer typed wrappers over raw `va_arg` in portable FFI.
6. Verify in compiler output
gcc -O2 -S -o - foo.c # study .cfi_* and mov args objdump -d -M intel ./a.out
7. Agent usage
/abi-and-calling-conventions Which registers hold args 5–8 in AArch64 for my C function?
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | Crash on `call` | Stack misaligned | Align `rsp` mod 16 | | Wrong float arg | XMM vs GPR mismatch | Match prototype | | Corrupt callee-saved | Asm clobber missing | List in clobber or save | | FFI garbage | Windows vs SysV mix | Match toolchain ABI | | Variadic UB | Wrong type to `va_arg` | Cast to promoted type |
Related Skills
- `skills/low-level-programming/assembly-x86` — x86-64 asm
- `skills/low-level-programming/assembly-arm` — AAPCS examples
- `skills/low-level-programming/assembly-riscv` — RISC-V asm
- `skills/rust/rust-ffi` — `extern "C"` guarantees
- `skills/binaries/elf-inspection` — symbol and relocation views
A curated suite of AI agent skills for systems and low-level programming — C/C++, Rust, Zig, GPU, bare-metal firmware, Linux kernel/driver development, computer architecture, compiler internals, HPC, and more.
Repo: mohitmishra786/low-level-dev-skills
Other skills on low-level-dev-skills.
- /custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator,
Open skill - /numa-programming
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using libnuma API, building NUMA-aware data structures, or measuring remote access penalties. Activates on queries about numactl, libnuma, NUMA topology,
Open skill - /af-xdp
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.
Open skill - /dpdk
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting up huge pages, RSS, or testpmd validation. Activates on queries about DPDK, EAL, rte_eth_rx_burst, hugepages, PMD, or testpmd.
Open skill - /io-uring
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided buffers, fixed files, zero-copy send, or tokio-uring. Activates on queries about io_uring, SQE/CQE, liburing, IORING_OP_PROVIDE_BUFFERS, or io_uring vs
Open skill - /adc-dac-baremetal
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
Open skill

