v0.1.0 786906f

go_darwin_arm64.go RawHistoryFolder

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3
4package fakecgo
5
6import "unsafe"
7
8//go:nosplit
9func _cgo_sys_thread_start(ts *ThreadStart) {
10	var attr pthread_attr_t
11	var ign, oset sigset_t
12	var p pthread_t
13	var size size_t
14	var err int
15
16	//fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug
17	sigfillset(&ign)
18	pthread_sigmask(SIG_SETMASK, &ign, &oset)
19
20	pthread_attr_init(&attr)
21	pthread_attr_getstacksize(&attr, &size)
22	// Leave stacklo=0 and set stackhi=size; mstart will do the rest.
23	ts.g.stackhi = uintptr(size)
24
25	err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts)
26
27	pthread_sigmask(SIG_SETMASK, &oset, nil)
28
29	if err != 0 {
30		print("fakecgo: pthread_create failed: ")
31		println(err)
32		abort()
33	}
34}
35
36// threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function
37//
38//go:linkname x_threadentry_trampoline threadentry_trampoline
39var x_threadentry_trampoline byte
40var threadentry_trampolineABI0 = &x_threadentry_trampoline
41
42//go:nosplit
43func threadentry(v unsafe.Pointer) unsafe.Pointer {
44	ts := *(*ThreadStart)(v)
45	free(v)
46
47	// TODO: support ios
48	//#if TARGET_OS_IPHONE
49	//	darwin_arm_init_thread_exception_port();
50	//#endif
51	setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g)))
52
53	// faking funcs in go is a bit a... involved - but the following works :)
54	fn := uintptr(unsafe.Pointer(&ts.fn))
55	(*(*func())(unsafe.Pointer(&fn)))()
56
57	return nil
58}
59
60// here we will store a pointer to the provided setg func
61var setg_func uintptr
62
63// x_cgo_init(G *g, void (*setg)(void*)) (runtime/cgo/gcc_linux_amd64.c)
64// This get's called during startup, adjusts stacklo, and provides a pointer to setg_gcc for us
65// Additionally, if we set _cgo_init to non-null, go won't do it's own TLS setup
66// This function can't be go:systemstack since go is not in a state where the systemcheck would work.
67//
68//go:nosplit
69func x_cgo_init(g *G, setg uintptr) {
70	var size size_t
71	var attr pthread_attr_t
72
73	setg_func = setg
74	pthread_attr_init(&attr)
75	pthread_attr_getstacksize(&attr, &size)
76	g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096
77	pthread_attr_destroy(&attr)
78
79	//TODO: support ios
80	//#if TARGET_OS_IPHONE
81	//	darwin_arm_init_mach_exception_handler();
82	//	darwin_arm_init_thread_exception_port();
83	//	init_working_dir();
84	//#endif
85}

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