v0.10.0-alpha.1 684058f

wincallback.go RawHistoryFolder

1// Copyright 2014 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 ignore
6
7// Generate Windows callback assembly file.
8// This was copied from the Go repository and modified to generate non-Windows assembly files.
9
10package main
11
12import (
13	"bytes"
14	"fmt"
15	"os"
16)
17
18const maxCallback = 2000
19
20func genasmAmd64() {
21	var buf bytes.Buffer
22
23	buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT.
24
25//go:build darwin || freebsd || linux || netbsd
26
27// runtime·callbackasm is called by external code to
28// execute Go implemented callback function. It is not
29// called from the start, instead runtime·compilecallback
30// always returns address into runtime·callbackasm offset
31// appropriately so different callbacks start with different
32// CALL instruction in runtime·callbackasm. This determines
33// which Go callback function is executed later on.
34#include "textflag.h"
35
36TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0
37`)
38	for i := 0; i < maxCallback; i++ {
39		buf.WriteString("\tCALL\tcallbackasm1(SB)\n")
40	}
41	if err := os.WriteFile("zcallback_amd64.s", buf.Bytes(), 0644); err != nil {
42		fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
43		os.Exit(2)
44	}
45}
46
47func genasmArm64() {
48	var buf bytes.Buffer
49
50	buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT.
51
52//go:build darwin || freebsd || linux || netbsd
53
54// External code calls into callbackasm at an offset corresponding
55// to the callback index. Callbackasm is a table of MOV and B instructions.
56// The MOV instruction loads R12 with the callback index, and the
57// B instruction branches to callbackasm1.
58// callbackasm1 takes the callback index from R12 and
59// indexes into an array that stores information about each callback.
60// It then calls the Go implementation for that callback.
61#include "textflag.h"
62
63TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0
64`)
65	for i := 0; i < maxCallback; i++ {
66		fmt.Fprintf(&buf, "\tMOVD\t$%d, R12\n", i)
67		buf.WriteString("\tB\tcallbackasm1(SB)\n")
68	}
69	if err := os.WriteFile("zcallback_arm64.s", buf.Bytes(), 0644); err != nil {
70		fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
71		os.Exit(2)
72	}
73}
74
75func genasmLoong64() {
76        var buf bytes.Buffer
77
78        buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT.
79
80//go:build darwin || freebsd || linux || netbsd
81
82// External code calls into callbackasm at an offset corresponding
83// to the callback index. Callbackasm is a table of MOVV and JMP instructions.
84// The MOVV instruction loads R12 with the callback index, and the
85// JMP instruction branches to callbackasm1.
86// callbackasm1 takes the callback index from R12 and
87// indexes into an array that stores information about each callback.
88// It then calls the Go implementation for that callback.
89#include "textflag.h"
90
91TEXT callbackasm(SB),NOSPLIT|NOFRAME,$0
92`)
93        for i := 0; i < maxCallback; i++ {
94                fmt.Fprintf(&buf, "\tMOVV\t$%d, R13\n", i)
95                buf.WriteString("\tJMP\tcallbackasm1(SB)\n")
96        }
97        if err := os.WriteFile("zcallback_loong64.s", buf.Bytes(), 0644); err != nil {
98                fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
99                os.Exit(2)
100        }
101}
102
103func main() {
104	genasmAmd64()
105	genasmArm64()
106	genasmLoong64()
107}

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