From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Library:Go runtime" |
|---|
| claim | "Since Go 1.17, Go functions on amd64 (ABIInternal) take and return integer values in RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11 (in this order) and floating-point values in X0-X14; RDX holds the closure context on entry (scratch on return and in the body), R14 always holds the current goroutine (g), X15 holds zero at calls and returns but is scratch inside a function body (and is a scratch register on Plan 9), R12 and R13 are permanent scratch, and R15 is a GOT temporary in dynamically linked code (scratch otherwise). Assembly functions use the stack-only ABI0, bridged by wrappers." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Go runtime" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "call to a Go (non-assembly) function on amd64" |
|---|
| effect | "arguments in RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11 / X0-X14; R14 = g; X15 = 0; RDX = closure context" |
|---|
| condition | "Go 1.17 and later, ABIInternal" |
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "amd64 architecture: 9 integer registers RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11; X0-X14 for floats; special registers table (RDX closure context, R14 current goroutine, R15 GOT reference temporary if dynlink, X15 zero value)" |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/cmd/compile/abi-internal.md" |
|---|
| lines | "385-415" |
|---|
|
| type | "byte_pattern" |
|---|
| detail | "Every R14-relative stack check (49 3B 66 10) in Mailpit v1.22.3 is consistent with R14 = g on entry." |
|---|
|
| type | "documentation" |
|---|
| detail | "Special-purpose register table: RDX closure context (call) / scratch (return, body); X15 'Zero value (*)' with Same on return and Scratch in body; footnote: except on Plan 9." |
|---|
| repo | "https://github.com/golang/go" |
|---|
| commit | "dfc6f7db9bd75868ffb5cbc9501a2f4899122d2f" |
|---|
| path | "src/cmd/compile/abi-internal.md" |
|---|
| lines | "385-415" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "ABIInternal registers on amd64" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T09:13:42.640Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:06:17.018Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read golang src/cmd/compile/abi-internal.md at dfc6f7d lines 385-420: integer register sequence, X0-X14, R12/R13/R15 scratch rules, special-purpose table (RDX, R14, R15, X15 with Plan 9 footnote). Matches; 'Since Go 1.17' is not stated in that section." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:15:41.851Z" |
|---|
| summary | "X15 is zero only at calls and returns, scratch in function bodies, and not zero on Plan 9; RDX is scratch on return. Read abi-internal.md amd64 section at the cited commit." |
|---|
| changed | |
|---|
|
|
|---|