v0.4.0-alpha.2 e145907

syscall_cgo_linux.go RawHistoryFolder

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3
4package cgo
5
6// this file is placed inside internal/cgo and not package purego
7// because Cgo and assembly files can't be in the same package.
8
9/*
10 #cgo LDFLAGS: -ldl
11
12#include <stdint.h>
13#include <dlfcn.h>
14#include <errno.h>
15#include <assert.h>
16
17typedef struct syscall9Args {
18	uintptr_t fn;
19	uintptr_t a1, a2, a3, a4, a5, a6, a7, a8, a9;
20	uintptr_t f1, f2, f3, f4, f5, f6, f7, f8;
21	uintptr_t r1, r2, err;
22} syscall9Args;
23
24void syscall9(struct syscall9Args *args) {
25	assert((args->f1|args->f2|args->f3|args->f4|args->f5|args->f6|args->f7|args->f8) == 0);
26	uintptr_t (*func_name)(uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9);
27	*(void**)(&func_name) = (void*)(args->fn);
28	uintptr_t r1 =  func_name(args->a1,args->a2,args->a3,args->a4,args->a5,args->a6,args->a7,args->a8,args->a9);
29	args->r1 = r1;
30	args->err = errno;
31}
32
33*/
34import "C"
35import "unsafe"
36
37// assign purego.syscall9XABI0 to the C version of this function.
38var Syscall9XABI0 = unsafe.Pointer(C.syscall9)
39
40// all that is needed is to assign each dl function because then its
41// symbol will then be made available to the linker and linked to inside dlfcn.go
42var (
43	_ = C.dlopen
44	_ = C.dlsym
45	_ = C.dlerror
46	_ = C.dlclose
47)
48
49//go:nosplit
50func Syscall9X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) {
51	args := C.syscall9Args{C.uintptr_t(fn), C.uintptr_t(a1), C.uintptr_t(a2), C.uintptr_t(a3),
52		C.uintptr_t(a4), C.uintptr_t(a5), C.uintptr_t(a6),
53		C.uintptr_t(a7), C.uintptr_t(a8), C.uintptr_t(a9), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
54	C.syscall9(&args)
55	return uintptr(args.r1), uintptr(args.r2), uintptr(args.err)
56}

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