skills/computer-architecture/abi-and-calling-conventions/SKILL.md
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.
npx skillsauth add mohitmishra786/low-level-dev-skills abi-and-calling-conventionsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
skills/rust/rust-ffi, skills/zig/zig-cinterop)skills/debuggers/gdb| 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.
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.
| 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.
high addresses
├── return address
├── saved frame pointer
├── local variables
├── spill slots / alignment padding
└── outgoing args (if any)
low addresses (rsp)
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.
gcc -O2 -S -o - foo.c # study .cfi_* and mov args
objdump -d -M intel ./a.out
/abi-and-calling-conventions Which registers hold args 5–8 in AArch64 for my C function?
| 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 |
skills/low-level-programming/assembly-x86 — x86-64 asmskills/low-level-programming/assembly-arm — AAPCS examplesskills/low-level-programming/assembly-riscv — RISC-V asmskills/rust/rust-ffi — extern "C" guaranteesskills/binaries/elf-inspection — symbol and relocation viewsdevelopment
QEMU/KVM skill for virtualization and kernel development. Use when running qemu-system-x86_64 with KVM, configuring virtio devices, VFIO passthrough, QMP monitor, libvirt, or booting custom kernels. Activates on queries about QEMU, KVM, virtio, VFIO, virsh, virt-install, or -kernel -append.
development
Hardware virtualization internals skill for Intel VT-x and AMD-V. Use when studying VMCS/VMCB, EPT/NPT page tables, VMEXIT handling, APIC virtualization, or building minimal hypervisors. Activates on queries about VMX, SVM, VMCS, EPT, NPT, VMEXIT, or type-1 hypervisor.
testing
Linux containers internals skill for namespaces, cgroups, and OCI. Use when understanding clone/unshare namespaces, cgroups v2 limits, overlayfs, runc, seccomp profiles, capabilities, or escape mitigations. Activates on queries about namespaces, cgroups, overlayfs, runc, seccomp-bpf, OCI spec, or container escape.
tools
Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.