/odin-native:abi-and-calling-conventionsfrom ODIN Native
Explains System V AMD64, ARM AAPCS, and RISC-V psABI calling conventions including register roles, stack alignment, argument passing, and variadic rules. Useful when debugging FFI boundaries, inline assembly, or ABI-related crashes.
Ships in ODIN Native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Field | Bound contract |
|---|---|
| Trigger | A question or debugging session needs the register roles, stack alignment, argument passing, return value, or variadic rules of System V AMD64, ARM AAPCS, or the RISC-V psABI. |
| Authority | Read-only. The skill reads source, disassembly, and compiler output and answers in chat. Nothing on disk changes, so there is nothing to roll back. No remote mutation. |
| Side effect | Chat output only. Compiler and disassembler runs write nothing outside stdout. |
| Done | The answer names the argument registers, return registers, stack alignment, callee-saved set, and variadic rule for the named ABI, and points to the compiler output that confirms it. |
call, a wrong argument value, or a corrupted register after a call.| ABI | Integer arguments | Float or vector arguments | Return | Stack alignment at call | Callee-saved |
|---|---|---|---|---|---|
| System V AMD64 | rdi, rsi, rdx, rcx, r8, r9 | xmm0 to xmm7 | rax (xmm0 for float or vector), plus rdx for 128-bit values | 16 bytes before call | rbx, rbp, r12 to r15, rsp |
| AAPCS64 | x0 to x7 | v0 to v7 | x0 and x1, or v0 | 16 bytes | x19 to x28, x29 (frame pointer), sp |
| RISC-V psABI RV64 | a0 to a7 | fa0 to fa7 | a0 and a1 (fa0 for float) | 16 bytes | s0 to s11, sp |
System V AMD64 on Linux also grants a 128-byte red zone below rsp that leaf functions use without adjusting the stack pointer. Arguments past the register set go on the stack, so a seven-integer C function on System V passes the seventh in memory.
The link register is call-clobbered on all three ABIs: System V AMD64 pushes the return address before the call lands, and AAPCS64 and RISC-V save x30/ra in the prologue when the callee itself calls, which is why the callee-saved rows above exclude them.
.... On System V AMD64 the caller sets al to the count of vector registers used, and va_start needs the register save area the prologue writes. Recommend typed wrappers over raw va_arg at FFI boundaries, and cast every va_arg type to its promoted form. Done when: the variadic rule is stated or the context has no variadic call..cfi_* directives that match the stated rule.gcc -O2 -S -o - foo.c # argument moves and .cfi_* directives
objdump -d -M intel ./a.out # the same after linking
For AArch32 Thumb interworking, note that a function pointer to Thumb code carries its low bit set. For the assembly side of each target, use assembly-x86, assembly-arm, or assembly-riscv. For symbol and relocation views, use elf-inspection.
| Failure class | Behavior |
|---|---|
| Windows x64 is the target | State that the Microsoft x64 convention differs from System V (different register order, 32-byte shadow space, no red zone) and stop. Do not apply System V rules to it. |
| ABI cannot be inferred | Ask for the toolchain target triple. Do not guess from the source language. |
Crash on call | Check that rsp is 16-byte aligned at the call instruction. A pushed return address leaves the callee entry at 8 mod 16. |
| Wrong float argument | Match the prototype: a float without a prototype goes through integer promotion rules and lands in the wrong register class. |
| Corrupted callee-saved register | The inline asm or thunk clobbered a callee-saved register without saving it. List it in the clobber list or save and restore it. |
| Mixed-ABI FFI | Both sides must be built for the same target ABI. Check the compiler target on each side. |
A chat answer with the register table row for the named ABI, the stack frame picture, the variadic rule where relevant, and the compiler or disassembler command that confirms the rule on the user's toolchain.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub outlinedriven/odin-claude-plugin --plugin odin-native138 skills in this plugin
/adc-dac-baremetalUse when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal./af-xdpUse when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk./apple-siliconUse when tuning or profiling native code on Apple M-series Macs: unified memory, 16 KiB pages, Accelerate and Metal for matrix work, xctrace and leaks, Rosetta 2, or sysctl hardware queries./arm-sveUse when writing or porting AArch64 SIMD to SVE or SVE2: arm_sve.h intrinsics, predicates, vector-length-agnostic loops, auto-vectorization, or SVE registers in GDB. Not for NEON: use simd-intrinsics./assembly-armUse when reading or writing AArch64 or AArch32 Thumb assembly, inline asm in C, AAPCS64 register roles, or NEON and SVE vector code. Not for ABI detail across ISAs: use abi-and-calling-conventions./assembly-riscvUse when reading or writing RV32/RV64 assembly, inline asm in C, the RISC-V psABI, IMAFD extension naming, compressed instructions, or QEMU RISC-V debugging.Other plugins' skills for the same job