detached 5aa9aab

docs: clarify raw syscall abi limits

commit
5aa9aab010a59995380f17149879a36ab7d3f68f
author
brice · · 2026-04-13 10:18 UTC
parent
5e114e1
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +12 -7
M syscall.go +6 -2
@@ -52,13 +52,15 @@ func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uin
5252 }
5353
5454 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.
55-// There is an internal maximum number of arguments that SyscallN can take. It panics
56-// when the maximum is exceeded. It returns the result and the libc error code if there is one.
55+// There is an internal maximum number of arguments that SyscallN can take.
56+// On 386 and arm, SyscallN supports at most 15 uintptr arguments.
57+// It panics when the maximum is exceeded. It returns the result and the libc error code if there is one.
5758 //
5859 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]
5960 // especially point 4.
6061 //
6162 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.
63+// Use RegisterFunc instead when the target function mixes integer and floating-point arguments.
6264 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607
6365 // for an explanation of why that is.
6466 //
@@ -85,6 +87,8 @@ func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) {
8587
8688 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.
8789 // It is designed for method-like calls where the first argument is always a receiver pointer.
90+// It shares SyscallN's argument-placement limits and mixed integer/float restriction.
91+// On 386 and arm, the total count including self is limited to 15 uintptr arguments.
8892 // This avoids the heap allocation that would occur with SyscallN(fn, append([]uintptr{self}, args...)...).
8993 //
9094 //go:uintptrescapes
@@ -52,13 +52,15 @@ func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uin
52 }52 }
53 53
54 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.54 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.
55-// There is an internal maximum number of arguments that SyscallN can take. It panics55+// There is an internal maximum number of arguments that SyscallN can take.
56-// when the maximum is exceeded. It returns the result and the libc error code if there is one.56+// On 386 and arm, SyscallN supports at most 15 uintptr arguments.
57+// It panics when the maximum is exceeded. It returns the result and the libc error code if there is one.
57 //58 //
58 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]59 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]
59 // especially point 4.60 // especially point 4.
60 //61 //
61 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.62 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.
63+// Use RegisterFunc instead when the target function mixes integer and floating-point arguments.
62 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-112805760764 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607
63 // for an explanation of why that is.65 // for an explanation of why that is.
64 //66 //
@@ -85,6 +87,8 @@ func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) {
85 87
86 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.88 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.
87 // It is designed for method-like calls where the first argument is always a receiver pointer.89 // It is designed for method-like calls where the first argument is always a receiver pointer.
90+// It shares SyscallN's argument-placement limits and mixed integer/float restriction.
91+// On 386 and arm, the total count including self is limited to 15 uintptr arguments.
88 // This avoids the heap allocation that would occur with SyscallN(fn, append([]uintptr{self}, args...)...).92 // This avoids the heap allocation that would occur with SyscallN(fn, append([]uintptr{self}, args...)...).
89 //93 //
90 //go:uintptrescapes94 //go:uintptrescapes
M syscall_32bit.go +6 -5
@@ -60,13 +60,14 @@ func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uin
6060 }
6161
6262 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.
63-// On 386 and arm, SyscallN supports at most 15 uintptr arguments. It panics when
64-// the maximum is exceeded. It returns the result and the libc error code if there is one.
63+// On 386 and arm, SyscallN supports at most 15 uintptr arguments.
64+// It panics when the maximum is exceeded. It returns the result and the libc error code if there is one.
6565 //
6666 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]
6767 // especially point 4.
6868 //
6969 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.
70+// Use RegisterFunc instead when the target function mixes integer and floating-point arguments.
7071 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607
7172 // for an explanation of why that is.
7273 //
@@ -93,9 +94,9 @@ func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) {
9394
9495 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.
9596 // It is designed for method-like calls where the first argument is always a receiver pointer.
96-// It shares SyscallN's argument-placement limits, and the total count including self is
97-// limited to 15 on 386 and arm. This avoids the heap allocation that would occur with
98-// SyscallN(fn, append([]uintptr{self}, args...)...).
97+// It shares SyscallN's argument-placement limits and mixed integer/float restriction.
98+// On 386 and arm, the total count including self is limited to 15 uintptr arguments.
99+// This avoids the heap allocation that would occur with SyscallN(fn, append([]uintptr{self}, args...)...).
99100 //
100101 //go:uintptrescapes
101102 func SyscallSelf(fn, self uintptr, args ...uintptr) (r1, r2, err uintptr) {
@@ -60,13 +60,14 @@ func (s *syscall15Args) Set(fn uintptr, ints []uintptr, floats []uintptr, r8 uin
60 }60 }
61 61
62 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.62 // SyscallN takes fn, a C function pointer and a list of arguments as uintptr.
63-// On 386 and arm, SyscallN supports at most 15 uintptr arguments. It panics when63+// On 386 and arm, SyscallN supports at most 15 uintptr arguments.
64-// the maximum is exceeded. It returns the result and the libc error code if there is one.64+// It panics when the maximum is exceeded. It returns the result and the libc error code if there is one.
65 //65 //
66 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]66 // In order to call this function properly make sure to follow all the rules specified in [unsafe.Pointer]
67 // especially point 4.67 // especially point 4.
68 //68 //
69 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.69 // NOTE: SyscallN does not properly call functions that have both integer and float parameters.
70+// Use RegisterFunc instead when the target function mixes integer and floating-point arguments.
70 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-112805760771 // See discussion comment https://github.com/ebiten/purego/pull/1#issuecomment-1128057607
71 // for an explanation of why that is.72 // for an explanation of why that is.
72 //73 //
@@ -93,9 +94,9 @@ func SyscallN(fn uintptr, args ...uintptr) (r1, r2, err uintptr) {
93 94
94 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.95 // SyscallSelf is like SyscallN but efficiently prepends self to args without allocation.
95 // It is designed for method-like calls where the first argument is always a receiver pointer.96 // It is designed for method-like calls where the first argument is always a receiver pointer.
96-// It shares SyscallN's argument-placement limits, and the total count including self is97+// It shares SyscallN's argument-placement limits and mixed integer/float restriction.
97-// limited to 15 on 386 and arm. This avoids the heap allocation that would occur with98+// On 386 and arm, the total count including self is limited to 15 uintptr arguments.
98-// SyscallN(fn, append([]uintptr{self}, args...)...).99+// This avoids the heap allocation that would occur with SyscallN(fn, append([]uintptr{self}, args...)...).
99 //100 //
100 //go:uintptrescapes101 //go:uintptrescapes
101 func SyscallSelf(fn, self uintptr, args ...uintptr) (r1, r2, err uintptr) {102 func SyscallSelf(fn, self uintptr, args ...uintptr) (r1, r2, err uintptr) {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close