v0.10.1 eaff005

go_darwin.go RawHistoryFolder

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

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