From 2d6ff998edc0f3877ee24d28647a494491742f25 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Sun, 29 Nov 2020 14:06:17 -0800 Subject: [dev.regabi] cmd/compile: process //go:linknames after declarations Allows emitting errors about ineffectual //go:linkname directives. In particular, this exposed: a typo in os2_aix.go; redundant (but harmless) directives for libc_pipe in both os3_solaris.go and syscall2_solaris.go; and a bunch of useless //go:linkname directives in macOS wrapper code. However, because there's also ineffectual directives in the vendored macOS code from x/sys, that can't be an error just yet. So instead we print a warning (including a heads up that it will be promoted to an error in Go 1.17) to prevent backsliding while we fix and re-vendor that code. Passes toolstash-check. Change-Id: I59badeab5df0d8b3abfd14c6066e9bb00e840f73 Reviewed-on: https://go-review.googlesource.com/c/go/+/273986 Run-TryBot: Matthew Dempsky TryBot-Result: Go Bot Reviewed-by: Russ Cox Trust: Matthew Dempsky --- src/runtime/os2_aix.go | 4 ++-- src/runtime/syscall2_solaris.go | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os2_aix.go b/src/runtime/os2_aix.go index 428ff7f225..abd1010be9 100644 --- a/src/runtime/os2_aix.go +++ b/src/runtime/os2_aix.go @@ -18,11 +18,11 @@ import ( //go:cgo_import_dynamic libc___n_pthreads __n_pthreads "libpthread.a/shr_xpg5_64.o" //go:cgo_import_dynamic libc___mod_init __mod_init "libc.a/shr_64.o" -//go:linkname libc___n_pthreads libc___n_pthread +//go:linkname libc___n_pthreads libc___n_pthreads //go:linkname libc___mod_init libc___mod_init var ( - libc___n_pthread, + libc___n_pthreads, libc___mod_init libFunc ) diff --git a/src/runtime/syscall2_solaris.go b/src/runtime/syscall2_solaris.go index e098e8006a..3310489202 100644 --- a/src/runtime/syscall2_solaris.go +++ b/src/runtime/syscall2_solaris.go @@ -15,7 +15,6 @@ import _ "unsafe" // for go:linkname //go:cgo_import_dynamic libc_gethostname gethostname "libc.so" //go:cgo_import_dynamic libc_getpid getpid "libc.so" //go:cgo_import_dynamic libc_ioctl ioctl "libc.so" -//go:cgo_import_dynamic libc_pipe pipe "libc.so" //go:cgo_import_dynamic libc_setgid setgid "libc.so" //go:cgo_import_dynamic libc_setgroups setgroups "libc.so" //go:cgo_import_dynamic libc_setsid setsid "libc.so" @@ -33,7 +32,6 @@ import _ "unsafe" // for go:linkname //go:linkname libc_gethostname libc_gethostname //go:linkname libc_getpid libc_getpid //go:linkname libc_ioctl libc_ioctl -//go:linkname libc_pipe libc_pipe //go:linkname libc_setgid libc_setgid //go:linkname libc_setgroups libc_setgroups //go:linkname libc_setsid libc_setsid -- cgit v1.3-5-g9baa From 2f5b1a397454b76ad71e7eda5d574c304a416372 Mon Sep 17 00:00:00 2001 From: Daniel S Fava Date: Wed, 9 Dec 2020 23:56:50 +0100 Subject: test: make a race detector test robust to timing variations The `external_cgo_thread` test in `runtime/race/output_test.go` was producing intermittent failures. The test was performing a sleep, which may not be enough depending on how long it takes to setup the callBack goroutine. Added a synchronization to make sure callBack finishes before main ends. Whether the increment to racy++ happens first in the callBack or in main doesn't matter: the race detector should flag the race regardless. The output check was changed so that the test passes regardless of which increment occurs first. Fixes #43008 Change-Id: I325ec3dea52b3725e739fbf2bd7ae92875d2de10 Reviewed-on: https://go-review.googlesource.com/c/go/+/276752 Reviewed-by: Dmitry Vyukov Run-TryBot: Dmitry Vyukov TryBot-Result: Go Bot Trust: Ian Lance Taylor --- src/runtime/race/output_test.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/race/output_test.go b/src/runtime/race/output_test.go index 986667332f..69496874c6 100644 --- a/src/runtime/race/output_test.go +++ b/src/runtime/race/output_test.go @@ -284,32 +284,31 @@ static inline void startThread(cb* c) { */ import "C" -import "time" - +var done chan bool var racy int //export goCallback func goCallback() { racy++ + done <- true } func main() { + done = make(chan bool) var c C.cb C.startThread(&c) - time.Sleep(time.Second) racy++ + <- done } `, `================== WARNING: DATA RACE -Read at 0x[0-9,a-f]+ by main goroutine: - main\.main\(\) - .*/main\.go:34 \+0x[0-9,a-f]+ +Read at 0x[0-9,a-f]+ by .*: + main\..* + .*/main\.go:[0-9]+ \+0x[0-9,a-f]+(?s).* -Previous write at 0x[0-9,a-f]+ by goroutine [0-9]: - main\.goCallback\(\) - .*/main\.go:27 \+0x[0-9,a-f]+ - _cgoexp_[0-9a-z]+_goCallback\(\) - .*_cgo_gotypes\.go:[0-9]+ \+0x[0-9,a-f]+ +Previous write at 0x[0-9,a-f]+ by .*: + main\..* + .*/main\.go:[0-9]+ \+0x[0-9,a-f]+(?s).* Goroutine [0-9] \(running\) created at: runtime\.newextram\(\) -- cgit v1.3-5-g9baa From 53c984d976f49b5671b11ff17f5d622572d4cf58 Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Sat, 5 Dec 2020 19:53:08 +0000 Subject: runtime: skip wakep call in wakeNetPoller on Plan 9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was part of a performance improvement made by CL 232298 to reduce timer latency. On multiprocessor Plan 9 machines, it triggers memory faults often enough that the builder test suite never completes successfully. See issue #42303 for discussion. As shown by the benchmark result below, worst case latency on plan9_arm is very bad even with the wakep call in place - in the tickers-per-P=1 case, a 3ms timer is 270ms late. Skipping the wakep call and running the benchmark again shows some cases worse, some better. The performance cost doesn't seem excessive for this temporary workaround which makes the plan9_arm builders usable again. With wakep call: cpu% go test -bench Latency time goos: plan9 goarch: arm pkg: time BenchmarkParallelTimerLatency-4 100 10985859 avg-late-ns 18630963 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-4 195 270294688 avg-late-ns 542057670 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-4 234 182452000 avg-late-ns 423933688 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-4 280 193003004 avg-late-ns 408034405 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-4 282 132819086 avg-late-ns 313624570 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-4 339 71152187 avg-late-ns 189014519 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-4 315 26860484 avg-late-ns 101759844 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-4 357 19106739 avg-late-ns 59435620 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-4 376 7246933 avg-late-ns 38888461 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-4 267 40476892 avg-late-ns 205851926 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-4 294 87836303 avg-late-ns 252059695 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-4 379 4127144 avg-late-ns 10494927 max-late-ns Without wakep call: BenchmarkParallelTimerLatency-4 61 10775151 avg-late-ns 18668517 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-4 199 299587535 avg-late-ns 597182307 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-4 272 184561831 avg-late-ns 449739837 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-4 235 154983257 avg-late-ns 370940553 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-4 290 150034689 avg-late-ns 332399843 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-4 298 47540764 avg-late-ns 133709031 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-4 350 20379394 avg-late-ns 81742809 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-4 363 14403223 avg-late-ns 98901212 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-4 375 12293090 avg-late-ns 50266552 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-4 336 40628820 avg-late-ns 150946099 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-4 289 88265539 avg-late-ns 280770418 max-late-ns BenchmarkStaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-4 375 8364937 avg-late-ns 22598421 max-late-ns Fixes #42303 Change-Id: I70c63cb2a2bad46950a7cd9dfc7bb32943710d32 Reviewed-on: https://go-review.googlesource.com/c/go/+/275672 Reviewed-by: David du Colombier <0intro@gmail.com> Trust: Michael Pratt --- src/runtime/proc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 64e102fb0a..418e06932e 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2882,7 +2882,9 @@ func wakeNetPoller(when int64) { } else { // There are no threads in the network poller, try to get // one there so it can handle new timers. - wakep() + if GOOS != "plan9" { // Temporary workaround - see issue #42303. + wakep() + } } } -- cgit v1.3-5-g9baa From cb95819cf6e969dc7dcc64ec7820d3995379c9f4 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 11 Dec 2020 14:14:30 -0500 Subject: runtime: detect netbsd netpoll overrun in sysmon The netbsd kernel has a bug [1] that occassionally prevents netpoll from waking with netpollBreak, which could result in missing timers for an unbounded amount of time, as netpoll can't restart with a shorter delay when an earlier timer is added. Prior to CL 232298, sysmon could detect these overrun timers and manually start an M to run them. With this fallback gone, the bug actually prevents timer execution indefinitely. As a workaround, we add back sysmon detection only for netbsd. [1] https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094 Updates #42515 Change-Id: I8391f5b9dabef03dd1d94c50b3b4b3bd4f889e66 Reviewed-on: https://go-review.googlesource.com/c/go/+/277332 Run-TryBot: Michael Pratt TryBot-Result: Go Bot Reviewed-by: Michael Knyszek Reviewed-by: Austin Clements Trust: Michael Pratt --- src/runtime/proc.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 418e06932e..5adcbf07dc 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -5130,6 +5130,26 @@ func sysmon() { } } mDoFixup() + if GOOS == "netbsd" { + // netpoll is responsible for waiting for timer + // expiration, so we typically don't have to worry + // about starting an M to service timers. (Note that + // sleep for timeSleepUntil above simply ensures sysmon + // starts running again when that timer expiration may + // cause Go code to run again). + // + // However, netbsd has a kernel bug that sometimes + // misses netpollBreak wake-ups, which can lead to + // unbounded delays servicing timers. If we detect this + // overrun, then startm to get something to handle the + // timer. + // + // See issue 42515 and + // https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094. + if next, _ := timeSleepUntil(); next < now { + startm(nil, false) + } + } if atomic.Load(&scavenge.sysmonWake) != 0 { // Kick the scavenger awake if someone requested it. wakeScavenger() -- cgit v1.3-5-g9baa From 8438a5779b76620237d608282a99d17467b91f4c Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 11 Nov 2020 21:27:56 -0500 Subject: runtime: use _exit on darwin On darwin, where we use libc for syscalls, when the runtime exits, it calls libc exit function, which may call back into user code, e.g. invoking functions registered with atexit. In particular, it may call back into Go. But at this point, the Go runtime is already exiting, so this wouldn't work. On non-libc platforms we use exit syscall directly, which doesn't invoke any callbacks. Use _exit on darwin to achieve the same behavior. No test for now, as it doesn't pass on all platforms (see trybot run of PS2). May fix #42465. May fix #43294. Change-Id: Ia1ada22b5da8cb64fdd598d0541eb90e195367eb Reviewed-on: https://go-review.googlesource.com/c/go/+/269378 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- src/runtime/sys_darwin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go index c89ce78012..55845bf2e5 100644 --- a/src/runtime/sys_darwin.go +++ b/src/runtime/sys_darwin.go @@ -467,7 +467,7 @@ func setNonblock(fd int32) { //go:cgo_import_dynamic libc_pthread_create pthread_create "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic libc_pthread_self pthread_self "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic libc_pthread_kill pthread_kill "/usr/lib/libSystem.B.dylib" -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" +//go:cgo_import_dynamic libc_exit _exit "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic libc_raise raise "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" -- cgit v1.3-5-g9baa From 6cff874c47bdb4567f5c84bc59d93311493caefe Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Mon, 7 Dec 2020 15:11:46 +0000 Subject: runtime/metrics: add Read examples This change adds two examples of using the Read function: one that reads one metric and one that reads all metrics. Change-Id: I4940a44c9b1d65f3f7a1554e3145ff07e6492fc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/275855 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Michael Pratt Trust: Michael Knyszek --- src/runtime/metrics/example_test.go | 96 +++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 src/runtime/metrics/example_test.go (limited to 'src/runtime') diff --git a/src/runtime/metrics/example_test.go b/src/runtime/metrics/example_test.go new file mode 100644 index 0000000000..cade0c38bf --- /dev/null +++ b/src/runtime/metrics/example_test.go @@ -0,0 +1,96 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package metrics_test + +import ( + "fmt" + "runtime/metrics" +) + +func ExampleRead_readingOneMetric() { + // Name of the metric we want to read. + const myMetric = "/memory/classes/heap/free:bytes" + + // Create a sample for the metric. + sample := make([]metrics.Sample, 1) + sample[0].Name = myMetric + + // Sample the metric. + metrics.Read(sample) + + // Check if the metric is actually supported. + // If it's not, the resulting value will always have + // kind KindBad. + if sample[0].Value.Kind() == metrics.KindBad { + panic(fmt.Sprintf("metric %q no longer supported", myMetric)) + } + + // Handle the result. + // + // It's OK to assume a particular Kind for a metric; + // they're guaranteed not to change. + freeBytes := sample[0].Value.Uint64() + + fmt.Printf("free but not released memory: %d\n", freeBytes) +} + +func ExampleRead_readingAllMetrics() { + // Get descriptions for all supported metrics. + descs := metrics.All() + + // Create a sample for each metric. + samples := make([]metrics.Sample, len(descs)) + for i := range samples { + samples[i].Name = descs[i].Name + } + + // Sample the metrics. Re-use the samples slice if you can! + metrics.Read(samples) + + // Iterate over all results. + for _, sample := range samples { + // Pull out the name and value. + name, value := sample.Name, sample.Value + + // Handle each sample. + switch value.Kind() { + case metrics.KindUint64: + fmt.Printf("%s: %d\n", name, value.Uint64()) + case metrics.KindFloat64: + fmt.Printf("%s: %f\n", name, value.Float64()) + case metrics.KindFloat64Histogram: + // The histogram may be quite large, so let's just pull out + // a crude estimate for the median for the sake of this example. + fmt.Printf("%s: %f\n", name, medianBucket(value.Float64Histogram())) + case metrics.KindBad: + // This should never happen because all metrics are supported + // by construction. + panic("bug in runtime/metrics package!") + default: + // This may happen as new metrics get added. + // + // The safest thing to do here is to simply log it somewhere + // as something to look into, but ignore it for now. + // In the worst case, you might temporarily miss out on a new metric. + fmt.Printf("%s: unexpected metric Kind: %v\n", name, value.Kind()) + } + } +} + +func medianBucket(h *metrics.Float64Histogram) float64 { + total := uint64(0) + for _, count := range h.Counts { + total += count + } + thresh := total / 2 + total = 0 + for i, count := range h.Counts { + total += count + if total > thresh { + return h.Buckets[i] + } + } + panic("should not happen") +} -- cgit v1.3-5-g9baa From 306b2451c849c9a5835069f317dfea851e526a00 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Mon, 14 Dec 2020 10:03:37 -0500 Subject: [dev.regabi] runtime: fix ABI targets in runtime.panic{Index,Slice} shims MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix up the assembly shim routines runtime.panic{Index,Slice} and friends so that their tail calls target ABIInternal and not ABI0 functions. This is so as to ensure that these calls don't go through an ABI0->ABIInternal wrapper (which would throw off the machinery in the called routines designed to detect whether the violation happened in the runtime). Note that when the compiler starts emitting real register calls to these routines, we'll need to rewrite them to update the arg size and ensure that args are in the correct registers. For example, the current shim TEXT runtime·panicIndex(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) JMP runtime·goPanicIndex(SB) will need to change to TEXT runtime·panicIndex(SB),NOSPLIT,$0 // AX already set up properly MOVQ CX, BX // second argument expected in BX JMP runtime·goPanicIndex(SB) Change-Id: I48d1b5138fb4d229380ad12735cfaca5c50e6cc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/278755 Reviewed-by: Cherry Zhang Trust: Than McIntosh --- src/runtime/asm_amd64.s | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 196252e1dd..53d1f8e358 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -1728,67 +1728,67 @@ TEXT runtime·debugCallPanicked(SB),NOSPLIT,$16-16 TEXT runtime·panicIndex(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicIndex(SB) + JMP runtime·goPanicIndex(SB) TEXT runtime·panicIndexU(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicIndexU(SB) + JMP runtime·goPanicIndexU(SB) TEXT runtime·panicSliceAlen(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSliceAlen(SB) + JMP runtime·goPanicSliceAlen(SB) TEXT runtime·panicSliceAlenU(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSliceAlenU(SB) + JMP runtime·goPanicSliceAlenU(SB) TEXT runtime·panicSliceAcap(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSliceAcap(SB) + JMP runtime·goPanicSliceAcap(SB) TEXT runtime·panicSliceAcapU(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSliceAcapU(SB) + JMP runtime·goPanicSliceAcapU(SB) TEXT runtime·panicSliceB(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicSliceB(SB) + JMP runtime·goPanicSliceB(SB) TEXT runtime·panicSliceBU(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicSliceBU(SB) + JMP runtime·goPanicSliceBU(SB) TEXT runtime·panicSlice3Alen(SB),NOSPLIT,$0-16 MOVQ DX, x+0(FP) MOVQ BX, y+8(FP) - JMP runtime·goPanicSlice3Alen(SB) + JMP runtime·goPanicSlice3Alen(SB) TEXT runtime·panicSlice3AlenU(SB),NOSPLIT,$0-16 MOVQ DX, x+0(FP) MOVQ BX, y+8(FP) - JMP runtime·goPanicSlice3AlenU(SB) + JMP runtime·goPanicSlice3AlenU(SB) TEXT runtime·panicSlice3Acap(SB),NOSPLIT,$0-16 MOVQ DX, x+0(FP) MOVQ BX, y+8(FP) - JMP runtime·goPanicSlice3Acap(SB) + JMP runtime·goPanicSlice3Acap(SB) TEXT runtime·panicSlice3AcapU(SB),NOSPLIT,$0-16 MOVQ DX, x+0(FP) MOVQ BX, y+8(FP) - JMP runtime·goPanicSlice3AcapU(SB) + JMP runtime·goPanicSlice3AcapU(SB) TEXT runtime·panicSlice3B(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSlice3B(SB) + JMP runtime·goPanicSlice3B(SB) TEXT runtime·panicSlice3BU(SB),NOSPLIT,$0-16 MOVQ CX, x+0(FP) MOVQ DX, y+8(FP) - JMP runtime·goPanicSlice3BU(SB) + JMP runtime·goPanicSlice3BU(SB) TEXT runtime·panicSlice3C(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicSlice3C(SB) + JMP runtime·goPanicSlice3C(SB) TEXT runtime·panicSlice3CU(SB),NOSPLIT,$0-16 MOVQ AX, x+0(FP) MOVQ CX, y+8(FP) - JMP runtime·goPanicSlice3CU(SB) + JMP runtime·goPanicSlice3CU(SB) #ifdef GOOS_android // Use the free TLS_SLOT_APP slot #2 on Android Q. -- cgit v1.3-5-g9baa From 4d27c4c223ccb7de3876abbac79b58ad9579be1a Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Wed, 9 Dec 2020 15:14:59 -0500 Subject: runtime: correct error handling in several FreeBSD syscall wrappers The FreeBSD syscall convention uses the carry flag to indicate whether an error has occured. The sys_umtx_op, thr_new, and pipe2 syscall wrappers were failing to account for this convention and silently suppressing errors as a result. This commit corrects these wrappers by copying the pattern used by the other fallible syscall wrappers. Note that futexsleep1 must now explicitly ignore the ETIMEDOUT error from sys_umtx_op. Previously ETIMEDOUT was implicitly ignored because sys_umtx_op never returned an error. Fixes #43106. Change-Id: I9c422b87cf4c6d308003bf42c3b419f785578b5d Reviewed-on: https://go-review.googlesource.com/c/go/+/276892 Run-TryBot: Ian Lance Taylor Reviewed-by: Austin Clements Trust: Than McIntosh --- src/runtime/defs_freebsd_386.go | 9 +++++---- src/runtime/defs_freebsd_amd64.go | 9 +++++---- src/runtime/defs_freebsd_arm.go | 9 +++++---- src/runtime/defs_freebsd_arm64.go | 9 +++++---- src/runtime/os_freebsd.go | 3 +-- src/runtime/sys_freebsd_386.s | 6 ++++++ src/runtime/sys_freebsd_amd64.s | 6 ++++++ src/runtime/sys_freebsd_arm.s | 3 +++ src/runtime/sys_freebsd_arm64.s | 6 ++++++ 9 files changed, 42 insertions(+), 18 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/defs_freebsd_386.go b/src/runtime/defs_freebsd_386.go index 767755425c..f822934d58 100644 --- a/src/runtime/defs_freebsd_386.go +++ b/src/runtime/defs_freebsd_386.go @@ -13,10 +13,11 @@ const ( ) const ( - _EINTR = 0x4 - _EFAULT = 0xe - _EAGAIN = 0x23 - _ENOSYS = 0x4e + _EINTR = 0x4 + _EFAULT = 0xe + _EAGAIN = 0x23 + _ENOSYS = 0x4e + _ETIMEDOUT = 0x3c _O_NONBLOCK = 0x4 _O_CLOEXEC = 0x100000 diff --git a/src/runtime/defs_freebsd_amd64.go b/src/runtime/defs_freebsd_amd64.go index 5a833426fd..0b696cf227 100644 --- a/src/runtime/defs_freebsd_amd64.go +++ b/src/runtime/defs_freebsd_amd64.go @@ -13,10 +13,11 @@ const ( ) const ( - _EINTR = 0x4 - _EFAULT = 0xe - _EAGAIN = 0x23 - _ENOSYS = 0x4e + _EINTR = 0x4 + _EFAULT = 0xe + _EAGAIN = 0x23 + _ENOSYS = 0x4e + _ETIMEDOUT = 0x3c _O_NONBLOCK = 0x4 _O_CLOEXEC = 0x100000 diff --git a/src/runtime/defs_freebsd_arm.go b/src/runtime/defs_freebsd_arm.go index b55dfd88cf..b6f3e790cf 100644 --- a/src/runtime/defs_freebsd_arm.go +++ b/src/runtime/defs_freebsd_arm.go @@ -13,10 +13,11 @@ const ( ) const ( - _EINTR = 0x4 - _EFAULT = 0xe - _EAGAIN = 0x23 - _ENOSYS = 0x4e + _EINTR = 0x4 + _EFAULT = 0xe + _EAGAIN = 0x23 + _ENOSYS = 0x4e + _ETIMEDOUT = 0x3c _O_NONBLOCK = 0x4 _O_CLOEXEC = 0x100000 diff --git a/src/runtime/defs_freebsd_arm64.go b/src/runtime/defs_freebsd_arm64.go index 5b9d504ba6..0759a1238f 100644 --- a/src/runtime/defs_freebsd_arm64.go +++ b/src/runtime/defs_freebsd_arm64.go @@ -13,10 +13,11 @@ const ( ) const ( - _EINTR = 0x4 - _EFAULT = 0xe - _EAGAIN = 0x23 - _ENOSYS = 0x4e + _EINTR = 0x4 + _EFAULT = 0xe + _EAGAIN = 0x23 + _ENOSYS = 0x4e + _ETIMEDOUT = 0x3c _O_NONBLOCK = 0x4 _O_CLOEXEC = 0x100000 diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go index 730973a202..1c60ee2a57 100644 --- a/src/runtime/os_freebsd.go +++ b/src/runtime/os_freebsd.go @@ -166,7 +166,7 @@ func futexsleep1(addr *uint32, val uint32, ns int64) { utp = &ut } ret := sys_umtx_op(addr, _UMTX_OP_WAIT_UINT_PRIVATE, val, unsafe.Sizeof(*utp), utp) - if ret >= 0 || ret == -_EINTR { + if ret >= 0 || ret == -_EINTR || ret == -_ETIMEDOUT { return } print("umtx_wait addr=", addr, " val=", val, " ret=", ret, "\n") @@ -208,7 +208,6 @@ func newosproc(mp *m) { var oset sigset sigprocmask(_SIG_SETMASK, &sigset_all, &oset) - // TODO: Check for error. ret := thr_new(¶m, int32(unsafe.Sizeof(param))) sigprocmask(_SIG_SETMASK, &oset, nil) if ret < 0 { diff --git a/src/runtime/sys_freebsd_386.s b/src/runtime/sys_freebsd_386.s index c346e719e1..97e6d9ab36 100644 --- a/src/runtime/sys_freebsd_386.s +++ b/src/runtime/sys_freebsd_386.s @@ -13,12 +13,16 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$-4 MOVL $454, AX INT $0x80 + JAE 2(PC) + NEGL AX MOVL AX, ret+20(FP) RET TEXT runtime·thr_new(SB),NOSPLIT,$-4 MOVL $455, AX INT $0x80 + JAE 2(PC) + NEGL AX MOVL AX, ret+8(FP) RET @@ -120,6 +124,8 @@ TEXT runtime·pipe2(SB),NOSPLIT,$12-16 MOVL flags+0(FP), BX MOVL BX, 8(SP) INT $0x80 + JAE 2(PC) + NEGL AX MOVL AX, errno+12(FP) RET diff --git a/src/runtime/sys_freebsd_amd64.s b/src/runtime/sys_freebsd_amd64.s index 010b2ec4d4..07734b0d7d 100644 --- a/src/runtime/sys_freebsd_amd64.s +++ b/src/runtime/sys_freebsd_amd64.s @@ -18,6 +18,8 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0 MOVQ ut+24(FP), R8 MOVL $454, AX SYSCALL + JCC 2(PC) + NEGQ AX MOVL AX, ret+32(FP) RET @@ -26,6 +28,8 @@ TEXT runtime·thr_new(SB),NOSPLIT,$0 MOVL size+8(FP), SI MOVL $455, AX SYSCALL + JCC 2(PC) + NEGQ AX MOVL AX, ret+16(FP) RET @@ -118,6 +122,8 @@ TEXT runtime·pipe2(SB),NOSPLIT,$0-20 MOVL flags+0(FP), SI MOVL $542, AX SYSCALL + JCC 2(PC) + NEGQ AX MOVL AX, errno+16(FP) RET diff --git a/src/runtime/sys_freebsd_arm.s b/src/runtime/sys_freebsd_arm.s index 1e12f9cfcb..b12e47c576 100644 --- a/src/runtime/sys_freebsd_arm.s +++ b/src/runtime/sys_freebsd_arm.s @@ -51,6 +51,7 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0 ADD $20, R13 // arg 5 is passed on stack MOVW $SYS__umtx_op, R7 SWI $0 + RSB.CS $0, R0 SUB $20, R13 // BCS error MOVW R0, ret+20(FP) @@ -61,6 +62,7 @@ TEXT runtime·thr_new(SB),NOSPLIT,$0 MOVW size+4(FP), R1 MOVW $SYS_thr_new, R7 SWI $0 + RSB.CS $0, R0 MOVW R0, ret+8(FP) RET @@ -144,6 +146,7 @@ TEXT runtime·pipe2(SB),NOSPLIT,$0-16 MOVW flags+0(FP), R1 MOVW $SYS_pipe2, R7 SWI $0 + RSB.CS $0, R0 MOVW R0, errno+12(FP) RET diff --git a/src/runtime/sys_freebsd_arm64.s b/src/runtime/sys_freebsd_arm64.s index 8a4f9b7fa1..1aa09e87ca 100644 --- a/src/runtime/sys_freebsd_arm64.s +++ b/src/runtime/sys_freebsd_arm64.s @@ -60,6 +60,9 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0 MOVD ut+24(FP), R4 MOVD $SYS__umtx_op, R8 SVC + BCC ok + NEG R0, R0 +ok: MOVW R0, ret+32(FP) RET @@ -69,6 +72,9 @@ TEXT runtime·thr_new(SB),NOSPLIT,$0 MOVW size+8(FP), R1 MOVD $SYS_thr_new, R8 SVC + BCC ok + NEG R0, R0 +ok: MOVW R0, ret+16(FP) RET -- cgit v1.3-5-g9baa From 301af2cb71d2731baa55653df67850ce85032e16 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Wed, 16 Dec 2020 13:45:48 -0500 Subject: [dev.regabi] runtime/race: adjust test pattern match for ABI wrapper Adjust the pattern matching in one of the race output test to allow for the possible introduction of an ABI wrapper. Normally for tests that match traceback output wrappers are not an issue since they are screened out by Go's traceback mechanism, but in this case the race runtime is doing the unwinding, so the wrapper may be visible. Change-Id: I45413b5c4701d4c28cc760fccc8203493dbe2874 Reviewed-on: https://go-review.googlesource.com/c/go/+/278756 Run-TryBot: Than McIntosh TryBot-Result: Go Bot Reviewed-by: Cherry Zhang Trust: Than McIntosh --- src/runtime/race/output_test.go | 82 +++++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 24 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/race/output_test.go b/src/runtime/race/output_test.go index 69496874c6..17dc32013f 100644 --- a/src/runtime/race/output_test.go +++ b/src/runtime/race/output_test.go @@ -7,6 +7,7 @@ package race_test import ( + "fmt" "internal/testenv" "os" "os/exec" @@ -71,9 +72,24 @@ func TestOutput(t *testing.T) { "GORACE="+test.gorace, ) got, _ := cmd.CombinedOutput() - if !regexp.MustCompile(test.re).MatchString(string(got)) { - t.Fatalf("failed test case %v, expect:\n%v\ngot:\n%s", - test.name, test.re, got) + matched := false + for _, re := range test.re { + if regexp.MustCompile(re).MatchString(string(got)) { + matched = true + break + } + } + if !matched { + exp := fmt.Sprintf("expect:\n%v\n", test.re[0]) + if len(test.re) > 1 { + exp = fmt.Sprintf("expected one of %d patterns:\n", + len(test.re)) + for k, re := range test.re { + exp += fmt.Sprintf("pattern %d:\n%v\n", k, re) + } + } + t.Fatalf("failed test case %v, %sgot:\n%s", + test.name, exp, got) } } } @@ -84,7 +100,7 @@ var tests = []struct { goos string gorace string source string - re string + re []string }{ {"simple", "run", "", "atexit_sleep_ms=0", ` package main @@ -107,7 +123,7 @@ func racer(x *int, done chan bool) { store(x, 42) done <- true } -`, `================== +`, []string{`================== WARNING: DATA RACE Write at 0x[0-9,a-f]+ by goroutine [0-9]: main\.store\(\) @@ -129,7 +145,7 @@ Goroutine [0-9] \(running\) created at: ================== Found 1 data race\(s\) exit status 66 -`}, +`}}, {"exitcode", "run", "", "atexit_sleep_ms=0 exitcode=13", ` package main @@ -143,7 +159,7 @@ func main() { x = 43 <-done } -`, `exit status 13`}, +`, []string{`exit status 13`}}, {"strip_path_prefix", "run", "", "atexit_sleep_ms=0 strip_path_prefix=/main.", ` package main @@ -157,9 +173,9 @@ func main() { x = 43 <-done } -`, ` +`, []string{` go:7 \+0x[0-9,a-f]+ -`}, +`}}, {"halt_on_error", "run", "", "atexit_sleep_ms=0 halt_on_error=1", ` package main @@ -173,10 +189,10 @@ func main() { x = 43 <-done } -`, ` +`, []string{` ================== exit status 66 -`}, +`}}, {"test_fails_on_race", "test", "", "atexit_sleep_ms=0", ` package main_test @@ -193,12 +209,12 @@ func TestFail(t *testing.T) { <-done t.Log(t.Failed()) } -`, ` +`, []string{` ================== --- FAIL: TestFail \(0...s\) .*main_test.go:14: true .*testing.go:.*: race detected during execution of test -FAIL`}, +FAIL`}}, {"slicebytetostring_pc", "run", "", "atexit_sleep_ms=0", ` package main @@ -211,11 +227,11 @@ func main() { data[0] = 1 <-done } -`, ` +`, []string{` runtime\.slicebytetostring\(\) .*/runtime/string\.go:.* main\.main\.func1\(\) - .*/main.go:7`}, + .*/main.go:7`}}, // Test for https://golang.org/issue/33309 {"midstack_inlining_traceback", "run", "linux", "atexit_sleep_ms=0", ` @@ -241,7 +257,7 @@ func g(c chan int) { func h(c chan int) { c <- x } -`, `================== +`, []string{`================== WARNING: DATA RACE Read at 0x[0-9,a-f]+ by goroutine [0-9]: main\.h\(\) @@ -261,7 +277,7 @@ Goroutine [0-9] \(running\) created at: ================== Found 1 data race\(s\) exit status 66 -`}, +`}}, // Test for https://golang.org/issue/17190 {"external_cgo_thread", "run", "linux", "atexit_sleep_ms=0", ` @@ -300,7 +316,25 @@ func main() { racy++ <- done } -`, `================== +`, []string{`================== +WARNING: DATA RACE +Read at 0x[0-9,a-f]+ by main goroutine: + main\.main\(\) + .*/main\.go:34 \+0x[0-9,a-f]+ + +Previous write at 0x[0-9,a-f]+ by goroutine [0-9]: + main\.goCallback\(\) + .*/main\.go:27 \+0x[0-9,a-f]+ + _cgoexp_[0-9a-z]+_goCallback\(\) + .*_cgo_gotypes\.go:[0-9]+ \+0x[0-9,a-f]+ + _cgoexp_[0-9a-z]+_goCallback\(\) + :1 \+0x[0-9,a-f]+ + +Goroutine [0-9] \(running\) created at: + runtime\.newextram\(\) + .*/runtime/proc.go:[0-9]+ \+0x[0-9,a-f]+ +==================`, + `================== WARNING: DATA RACE Read at 0x[0-9,a-f]+ by .*: main\..* @@ -313,7 +347,7 @@ Previous write at 0x[0-9,a-f]+ by .*: Goroutine [0-9] \(running\) created at: runtime\.newextram\(\) .*/runtime/proc.go:[0-9]+ \+0x[0-9,a-f]+ -==================`}, +==================`}}, {"second_test_passes", "test", "", "atexit_sleep_ms=0", ` package main_test import "testing" @@ -331,11 +365,11 @@ func TestFail(t *testing.T) { func TestPass(t *testing.T) { } -`, ` +`, []string{` ================== --- FAIL: TestFail \(0...s\) .*testing.go:.*: race detected during execution of test -FAIL`}, +FAIL`}}, {"mutex", "run", "", "atexit_sleep_ms=0", ` package main import ( @@ -366,7 +400,7 @@ func main() { } wg.Wait() if (data == iterations*(threads+1)) { fmt.Println("pass") } -}`, `pass`}, +}`, []string{`pass`}}, // Test for https://github.com/golang/go/issues/37355 {"chanmm", "run", "", "atexit_sleep_ms=0", ` package main @@ -395,7 +429,7 @@ func main() { wg.Wait() _ = data } -`, `================== +`, []string{`================== WARNING: DATA RACE Write at 0x[0-9,a-f]+ by goroutine [0-9]: main\.main\.func2\(\) @@ -408,5 +442,5 @@ Previous write at 0x[0-9,a-f]+ by main goroutine: Goroutine [0-9] \(running\) created at: main\.main\(\) .*/main.go:[0-9]+ \+0x[0-9,a-f]+ -==================`}, +==================`}}, } -- cgit v1.3-5-g9baa From cb28c96be8b8010dd979e0723bf5a94b11962a93 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Thu, 24 Sep 2020 13:14:46 -0400 Subject: [dev.regabi] cmd/compile,cmd/link: initial support for ABI wrappers Add compiler support for emitting ABI wrappers by creating real IR as opposed to introducing ABI aliases. At the moment these are "no-op" wrappers in the sense that they make a simple call (using the existing ABI) to their target. The assumption here is that once late call expansion can handle both ABI0 and the "new" ABIInternal (register version), it can expand the call to do the right thing. Note that the runtime contains functions that do not strictly follow the rules of the current Go ABI0; this has been handled in most cases by treating these as ABIInternal instead (these changes have been made in previous patches). Generation of ABI wrappers (as opposed to ABI aliases) is currently gated by GOEXPERIMENT=regabi -- wrapper generation is on by default if GOEXPERIMENT=regabi is set and off otherwise (but can be turned on using "-gcflags=all=-abiwrap -ldflags=-abiwrap"). Wrapper generation currently only workd on AMD64; explicitly enabling wrapper for other architectures (via the command line) is not supported. Also in this patch are a few other command line options for debugging (tracing and/or limiting wrapper creation). These will presumably go away at some point. Updates #27539, #40724. Change-Id: I1ee3226fc15a3c32ca2087b8ef8e41dbe6df4a75 Reviewed-on: https://go-review.googlesource.com/c/go/+/270863 Run-TryBot: Than McIntosh TryBot-Result: Go Bot Reviewed-by: Cherry Zhang Trust: Than McIntosh --- src/cmd/compile/internal/base/debug.go | 1 + src/cmd/compile/internal/base/flag.go | 3 + src/cmd/compile/internal/gc/gsubr.go | 191 +++++++++++++++++++++++++++----- src/cmd/compile/internal/gc/main.go | 23 ++++ src/cmd/compile/internal/gc/pgen.go | 7 +- src/cmd/compile/internal/gc/racewalk.go | 2 +- src/cmd/compile/internal/gc/ssa.go | 49 +++++++- src/cmd/compile/internal/types/sym.go | 17 +++ src/cmd/internal/obj/link.go | 6 + src/cmd/internal/obj/plist.go | 6 + src/cmd/internal/obj/textflag.go | 3 + src/cmd/internal/obj/x86/obj6.go | 4 +- src/cmd/link/internal/ld/main.go | 12 +- src/cmd/link/internal/ld/symtab.go | 37 ++++++- src/runtime/textflag.h | 2 + test/nosplit.go | 9 +- 16 files changed, 328 insertions(+), 44 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/compile/internal/base/debug.go b/src/cmd/compile/internal/base/debug.go index 45a552a4d9..3acdcea846 100644 --- a/src/cmd/compile/internal/base/debug.go +++ b/src/cmd/compile/internal/base/debug.go @@ -51,6 +51,7 @@ type DebugFlags struct { TypeAssert int `help:"print information about type assertion inlining"` TypecheckInl int `help:"eager typechecking of inline function bodies"` WB int `help:"print information about write barriers"` + ABIWrap int `help:"print information about ABI wrapper generation"` any bool // set when any of the values have been set } diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index aadc70f496..ce87ff730e 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -81,6 +81,8 @@ type CmdFlags struct { CompilingRuntime bool "flag:\"+\" help:\"compiling runtime\"" // Longer names + ABIWrap bool "help:\"enable generation of ABI wrappers\"" + ABIWrapLimit int "help:\"emit at most N ABI wrappers (for debugging)\"" AsmHdr string "help:\"write assembly header to `file`\"" Bench string "help:\"append benchmark times to `file`\"" BlockProfile string "help:\"write block profile to `file`\"" @@ -140,6 +142,7 @@ func ParseFlags() { Flag.LowerP = &Ctxt.Pkgpath Flag.LowerV = &Ctxt.Debugvlog + Flag.ABIWrap = objabi.Regabi_enabled != 0 Flag.Dwarf = objabi.GOARCH != "wasm" Flag.DwarfBASEntries = &Ctxt.UseBASEntries Flag.DwarfLocationLists = &Ctxt.Flag_locationlists diff --git a/src/cmd/compile/internal/gc/gsubr.go b/src/cmd/compile/internal/gc/gsubr.go index ddb431d5ab..f3ef14c99b 100644 --- a/src/cmd/compile/internal/gc/gsubr.go +++ b/src/cmd/compile/internal/gc/gsubr.go @@ -34,9 +34,12 @@ import ( "cmd/compile/internal/base" "cmd/compile/internal/ir" "cmd/compile/internal/ssa" + "cmd/compile/internal/types" "cmd/internal/obj" "cmd/internal/objabi" "cmd/internal/src" + "fmt" + "os" ) var sharedProgArray = new([10000]obj.Prog) // *T instead of T to work around issue 19839 @@ -187,32 +190,154 @@ func (pp *Progs) settext(fn *ir.Func) { ptxt.From.Sym = fn.LSym } +// makeABIWrapper creates a new function that wraps a cross-ABI call +// to "f". The wrapper is marked as an ABIWRAPPER. +func makeABIWrapper(f *ir.Func, wrapperABI obj.ABI) { + + // Q: is this needed? + savepos := base.Pos + savedclcontext := dclcontext + savedcurfn := Curfn + + base.Pos = autogeneratedPos + dclcontext = ir.PEXTERN + + // At the moment we don't support wrapping a method, we'd need machinery + // below to handle the receiver. Panic if we see this scenario. + ft := f.Nname.Ntype.Type() + if ft.NumRecvs() != 0 { + panic("makeABIWrapper support for wrapping methods not implemented") + } + + // Manufacture a new func type to use for the wrapper. + var noReceiver *ir.Field + tfn := ir.NewFuncType(base.Pos, + noReceiver, + structargs(ft.Params(), true), + structargs(ft.Results(), false)) + + // Reuse f's types.Sym to create a new ODCLFUNC/function. + fn := dclfunc(f.Nname.Sym(), tfn) + fn.SetDupok(true) + fn.SetWrapper(true) // ignore frame for panic+recover matching + + // Select LSYM now. + asym := base.Ctxt.LookupABI(f.LSym.Name, wrapperABI) + asym.Type = objabi.STEXT + if fn.LSym != nil { + panic("unexpected") + } + fn.LSym = asym + + // ABI0-to-ABIInternal wrappers will be mainly loading params from + // stack into registers (and/or storing stack locations back to + // registers after the wrapped call); in most cases they won't + // need to allocate stack space, so it should be OK to mark them + // as NOSPLIT in these cases. In addition, my assumption is that + // functions written in assembly are NOSPLIT in most (but not all) + // cases. In the case of an ABIInternal target that has too many + // parameters to fit into registers, the wrapper would need to + // allocate stack space, but this seems like an unlikely scenario. + // Hence: mark these wrappers NOSPLIT. + // + // ABIInternal-to-ABI0 wrappers on the other hand will be taking + // things in registers and pushing them onto the stack prior to + // the ABI0 call, meaning that they will always need to allocate + // stack space. If the compiler marks them as NOSPLIT this seems + // as though it could lead to situations where the the linker's + // nosplit-overflow analysis would trigger a link failure. On the + // other hand if they not tagged NOSPLIT then this could cause + // problems when building the runtime (since there may be calls to + // asm routine in cases where it's not safe to grow the stack). In + // most cases the wrapper would be (in effect) inlined, but are + // there (perhaps) indirect calls from the runtime that could run + // into trouble here. + // FIXME: at the moment all.bash does not pass when I leave out + // NOSPLIT for these wrappers, so all are currently tagged with NOSPLIT. + setupTextLSym(fn, obj.NOSPLIT|obj.ABIWRAPPER) + + // Generate call. Use tail call if no params and no returns, + // but a regular call otherwise. + // + // Note: ideally we would be using a tail call in cases where + // there are params but no returns for ABI0->ABIInternal wrappers, + // provided that all params fit into registers (e.g. we don't have + // to allocate any stack space). Doing this will require some + // extra work in typecheck/walk/ssa, might want to add a new node + // OTAILCALL or something to this effect. + var call ir.Node + if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 { + call = nodSym(ir.ORETJMP, nil, f.Nname.Sym()) + } else { + call = ir.Nod(ir.OCALL, f.Nname, nil) + call.PtrList().Set(paramNnames(tfn.Type())) + call.SetIsDDD(tfn.Type().IsVariadic()) + if tfn.Type().NumResults() > 0 { + n := ir.Nod(ir.ORETURN, nil, nil) + n.PtrList().Set1(call) + call = n + } + } + fn.PtrBody().Append(call) + + funcbody() + if base.Debug.DclStack != 0 { + testdclstack() + } + + typecheckFunc(fn) + Curfn = fn + typecheckslice(fn.Body().Slice(), ctxStmt) + + escapeFuncs([]*ir.Func{fn}, false) + + Target.Decls = append(Target.Decls, fn) + + // Restore previous context. + base.Pos = savepos + dclcontext = savedclcontext + Curfn = savedcurfn +} + // initLSym defines f's obj.LSym and initializes it based on the // properties of f. This includes setting the symbol flags and ABI and // creating and initializing related DWARF symbols. // // initLSym must be called exactly once per function and must be // called for both functions with bodies and functions without bodies. +// For body-less functions, we only create the LSym; for functions +// with bodies call a helper to setup up / populate the LSym. func initLSym(f *ir.Func, hasBody bool) { + // FIXME: for new-style ABI wrappers, we set up the lsym at the + // point the wrapper is created. + if f.LSym != nil && base.Flag.ABIWrap { + return + } + selectLSym(f, hasBody) + if hasBody { + setupTextLSym(f, 0) + } +} + +// selectLSym sets up the LSym for a given function, and +// makes calls to helpers to create ABI wrappers if needed. +func selectLSym(f *ir.Func, hasBody bool) { if f.LSym != nil { base.Fatalf("Func.initLSym called twice") } if nam := f.Nname; !ir.IsBlank(nam) { - f.LSym = nam.Sym().Linksym() - if f.Pragma&ir.Systemstack != 0 { - f.LSym.Set(obj.AttrCFunc, true) - } - var aliasABI obj.ABI - needABIAlias := false - defABI, hasDefABI := symabiDefs[f.LSym.Name] + var wrapperABI obj.ABI + needABIWrapper := false + defABI, hasDefABI := symabiDefs[nam.Sym().LinksymName()] if hasDefABI && defABI == obj.ABI0 { // Symbol is defined as ABI0. Create an // Internal -> ABI0 wrapper. - f.LSym.SetABI(obj.ABI0) - needABIAlias, aliasABI = true, obj.ABIInternal + f.LSym = nam.Sym().LinksymABI0() + needABIWrapper, wrapperABI = true, obj.ABIInternal } else { + f.LSym = nam.Sym().Linksym() // No ABI override. Check that the symbol is // using the expected ABI. want := obj.ABIInternal @@ -220,6 +345,9 @@ func initLSym(f *ir.Func, hasBody bool) { base.Fatalf("function symbol %s has the wrong ABI %v, expected %v", f.LSym.Name, f.LSym.ABI(), want) } } + if f.Pragma&ir.Systemstack != 0 { + f.LSym.Set(obj.AttrCFunc, true) + } isLinknameExported := nam.Sym().Linkname != "" && (hasBody || hasDefABI) if abi, ok := symabiRefs[f.LSym.Name]; (ok && abi == obj.ABI0) || isLinknameExported { @@ -235,32 +363,39 @@ func initLSym(f *ir.Func, hasBody bool) { // using linkname and we don't want to create // duplicate ABI wrappers. if f.LSym.ABI() != obj.ABI0 { - needABIAlias, aliasABI = true, obj.ABI0 + needABIWrapper, wrapperABI = true, obj.ABI0 } } - if needABIAlias { - // These LSyms have the same name as the - // native function, so we create them directly - // rather than looking them up. The uniqueness - // of f.lsym ensures uniqueness of asym. - asym := &obj.LSym{ - Name: f.LSym.Name, - Type: objabi.SABIALIAS, - R: []obj.Reloc{{Sym: f.LSym}}, // 0 size, so "informational" + if needABIWrapper { + if !useABIWrapGen(f) { + // Fallback: use alias instead. FIXME. + + // These LSyms have the same name as the + // native function, so we create them directly + // rather than looking them up. The uniqueness + // of f.lsym ensures uniqueness of asym. + asym := &obj.LSym{ + Name: f.LSym.Name, + Type: objabi.SABIALIAS, + R: []obj.Reloc{{Sym: f.LSym}}, // 0 size, so "informational" + } + asym.SetABI(wrapperABI) + asym.Set(obj.AttrDuplicateOK, true) + base.Ctxt.ABIAliases = append(base.Ctxt.ABIAliases, asym) + } else { + if base.Debug.ABIWrap != 0 { + fmt.Fprintf(os.Stderr, "=-= %v to %v wrapper for %s.%s\n", + wrapperABI, 1-wrapperABI, types.LocalPkg.Path, f.LSym.Name) + } + makeABIWrapper(f, wrapperABI) } - asym.SetABI(aliasABI) - asym.Set(obj.AttrDuplicateOK, true) - base.Ctxt.ABIAliases = append(base.Ctxt.ABIAliases, asym) } } +} - if !hasBody { - // For body-less functions, we only create the LSym. - return - } - - var flag int +// setupTextLsym initializes the LSym for a with-body text symbol. +func setupTextLSym(f *ir.Func, flag int) { if f.Dupok() { flag |= obj.DUPOK } diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 7f7cd63cdf..de2b3db36a 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -1144,3 +1144,26 @@ func initializeTypesPackage() { initUniverse() } + +// useNewABIWrapGen returns TRUE if the compiler should generate an +// ABI wrapper for the function 'f'. +func useABIWrapGen(f *ir.Func) bool { + if !base.Flag.ABIWrap { + return false + } + + // Support limit option for bisecting. + if base.Flag.ABIWrapLimit == 1 { + return false + } + if base.Flag.ABIWrapLimit < 1 { + return true + } + base.Flag.ABIWrapLimit-- + if base.Debug.ABIWrap != 0 && base.Flag.ABIWrapLimit == 1 { + fmt.Fprintf(os.Stderr, "=-= limit reached after new wrapper for %s\n", + f.LSym.Name) + } + + return true +} diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index 5b5288c389..dae9d79147 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -32,7 +32,6 @@ func emitptrargsmap(fn *ir.Func) { return } lsym := base.Ctxt.Lookup(fn.LSym.Name + ".args_stackmap") - nptr := int(fn.Type().ArgWidth() / int64(Widthptr)) bv := bvalloc(int32(nptr) * 2) nbitmap := 1 @@ -399,7 +398,11 @@ func debuginfo(fnsym *obj.LSym, infosym *obj.LSym, curfn interface{}) ([]dwarf.S fn := curfn.(*ir.Func) if fn.Nname != nil { - if expect := fn.Sym().Linksym(); fnsym != expect { + expect := fn.Sym().Linksym() + if fnsym.ABI() == obj.ABI0 { + expect = fn.Sym().LinksymABI0() + } + if fnsym != expect { base.Fatalf("unexpected fnsym: %v != %v", fnsym, expect) } } diff --git a/src/cmd/compile/internal/gc/racewalk.go b/src/cmd/compile/internal/gc/racewalk.go index 472deb16e3..61a65368af 100644 --- a/src/cmd/compile/internal/gc/racewalk.go +++ b/src/cmd/compile/internal/gc/racewalk.go @@ -61,7 +61,7 @@ func ispkgin(pkgs []string) bool { } func instrument(fn *ir.Func) { - if fn.Pragma&ir.Norace != 0 { + if fn.Pragma&ir.Norace != 0 || (fn.Sym().Linksym() != nil && fn.Sym().Linksym().ABIWrapper()) { return } diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index a5340e7f11..b4cf8b6dc7 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -1421,7 +1421,7 @@ func (s *state) stmt(n ir.Node) { case ir.ORETJMP: b := s.exit() b.Kind = ssa.BlockRetJmp // override BlockRet - b.Aux = n.Sym().Linksym() + b.Aux = callTargetLSym(n.Sym(), s.curfn.LSym) case ir.OCONTINUE, ir.OBREAK: var to *ssa.Block @@ -4826,11 +4826,11 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val } case sym != nil: if testLateExpansion { - aux := ssa.StaticAuxCall(sym.Linksym(), ACArgs, ACResults) + aux := ssa.StaticAuxCall(callTargetLSym(sym, s.curfn.LSym), ACArgs, ACResults) call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux) call.AddArgs(callArgs...) } else { - call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, ssa.StaticAuxCall(sym.Linksym(), ACArgs, ACResults), s.mem()) + call = s.newValue1A(ssa.OpStaticCall, types.TypeMem, ssa.StaticAuxCall(callTargetLSym(sym, s.curfn.LSym), ACArgs, ACResults), s.mem()) } default: s.Fatalf("bad call type %v %v", n.Op(), n) @@ -7291,3 +7291,46 @@ func clobberBase(n ir.Node) ir.Node { } return n } + +// callTargetLSym determines the correct LSym for 'callee' when called +// from function 'caller'. There are a couple of different scenarios +// to contend with here: +// +// 1. if 'caller' is an ABI wrapper, then we always want to use the +// LSym from the Func for the callee. +// +// 2. if 'caller' is not an ABI wrapper, then we looked at the callee +// to see if it corresponds to a "known" ABI0 symbol (e.g. assembly +// routine defined in the current package); if so, we want the call to +// directly target the ABI0 symbol (effectively bypassing the +// ABIInternal->ABI0 wrapper for 'callee'). +// +// 3. in all other cases, want the regular ABIInternal linksym +// +func callTargetLSym(callee *types.Sym, callerLSym *obj.LSym) *obj.LSym { + lsym := callee.Linksym() + if !base.Flag.ABIWrap { + return lsym + } + if ir.AsNode(callee.Def) == nil { + return lsym + } + ndclfunc := ir.AsNode(callee.Def).Name().Defn + if ndclfunc == nil { + return lsym + } + // check for case 1 above + if callerLSym.ABIWrapper() { + if nlsym := ndclfunc.Func().LSym; nlsym != nil { + lsym = nlsym + } + } else { + // check for case 2 above + nam := ndclfunc.Func().Nname + defABI, hasDefABI := symabiDefs[nam.Sym().LinksymName()] + if hasDefABI && defABI == obj.ABI0 { + lsym = nam.Sym().LinksymABI0() + } + } + return lsym +} diff --git a/src/cmd/compile/internal/types/sym.go b/src/cmd/compile/internal/types/sym.go index 19f06fcf5b..c512e3a003 100644 --- a/src/cmd/compile/internal/types/sym.go +++ b/src/cmd/compile/internal/types/sym.go @@ -93,6 +93,23 @@ func (sym *Sym) Linksym() *obj.LSym { return base.Ctxt.LookupInit(sym.LinksymName(), initPkg) } +// LinksymABI0 looks up or creates an ABI0 linker symbol for "sym", +// in cases where we want to specifically select the ABI0 version of +// a symbol (typically used only for ABI wrappers). +func (sym *Sym) LinksymABI0() *obj.LSym { + if sym == nil { + return nil + } + initPkg := func(r *obj.LSym) { + if sym.Linkname != "" { + r.Pkg = "_" + } else { + r.Pkg = sym.Pkg.Prefix + } + } + return base.Ctxt.LookupABIInit(sym.LinksymName(), obj.ABI0, initPkg) +} + // Less reports whether symbol a is ordered before symbol b. // // Symbols are ordered exported before non-exported, then by name, and diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index 7b5c990a5d..977c5c3303 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -635,6 +635,10 @@ const ( // ContentAddressable indicates this is a content-addressable symbol. AttrContentAddressable + // ABI wrapper is set for compiler-generated text symbols that + // convert between ABI0 and ABIInternal calling conventions. + AttrABIWrapper + // attrABIBase is the value at which the ABI is encoded in // Attribute. This must be last; all bits after this are // assumed to be an ABI value. @@ -660,6 +664,7 @@ func (a Attribute) TopFrame() bool { return a&AttrTopFrame != 0 } func (a Attribute) Indexed() bool { return a&AttrIndexed != 0 } func (a Attribute) UsedInIface() bool { return a&AttrUsedInIface != 0 } func (a Attribute) ContentAddressable() bool { return a&AttrContentAddressable != 0 } +func (a Attribute) ABIWrapper() bool { return a&AttrABIWrapper != 0 } func (a *Attribute) Set(flag Attribute, value bool) { if value { @@ -695,6 +700,7 @@ var textAttrStrings = [...]struct { {bit: AttrTopFrame, s: "TOPFRAME"}, {bit: AttrIndexed, s: ""}, {bit: AttrContentAddressable, s: ""}, + {bit: AttrABIWrapper, s: "ABIWRAPPER"}, } // TextAttrString formats a for printing in as part of a TEXT prog. diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go index 2b096996f7..679ce7eb8f 100644 --- a/src/cmd/internal/obj/plist.go +++ b/src/cmd/internal/obj/plist.go @@ -80,6 +80,11 @@ func Flushplist(ctxt *Link, plist *Plist, newprog ProgAlloc, myimportpath string if !strings.HasPrefix(s.Name, "\"\".") { continue } + if s.ABIWrapper() { + // Don't create an args_stackmap symbol reference for an ABI + // wrapper function + continue + } found := false for p := s.Func().Text; p != nil; p = p.Link { if p.As == AFUNCDATA && p.From.Type == TYPE_CONST && p.From.Offset == objabi.FUNCDATA_ArgsPointerMaps { @@ -134,6 +139,7 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) { s.Set(AttrNoSplit, flag&NOSPLIT != 0) s.Set(AttrReflectMethod, flag&REFLECTMETHOD != 0) s.Set(AttrWrapper, flag&WRAPPER != 0) + s.Set(AttrABIWrapper, flag&ABIWRAPPER != 0) s.Set(AttrNeedCtxt, flag&NEEDCTXT != 0) s.Set(AttrNoFrame, flag&NOFRAME != 0) s.Set(AttrTopFrame, flag&TOPFRAME != 0) diff --git a/src/cmd/internal/obj/textflag.go b/src/cmd/internal/obj/textflag.go index d2cec734b1..fcc4014aa2 100644 --- a/src/cmd/internal/obj/textflag.go +++ b/src/cmd/internal/obj/textflag.go @@ -51,4 +51,7 @@ const ( // Function is the top of the call stack. Call stack unwinders should stop // at this function. TOPFRAME = 2048 + + // Function is an ABI wrapper. + ABIWRAPPER = 4096 ) diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go index 184fb4308b..839aeb8fe3 100644 --- a/src/cmd/internal/obj/x86/obj6.go +++ b/src/cmd/internal/obj/x86/obj6.go @@ -637,7 +637,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { } } - if !p.From.Sym.NoSplit() || p.From.Sym.Wrapper() { + if !p.From.Sym.NoSplit() || (p.From.Sym.Wrapper() && !p.From.Sym.ABIWrapper()) { p = obj.Appendp(p, newprog) p = load_g_cx(ctxt, p, newprog) // load g into CX } @@ -690,7 +690,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.To.Reg = REG_BP } - if cursym.Func().Text.From.Sym.Wrapper() { + if cursym.Func().Text.From.Sym.Wrapper() && !cursym.Func().Text.From.Sym.ABIWrapper() { // if g._panic != nil && g._panic.argp == FP { // g._panic.argp = bottom-of-frame // } diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 5c8293810f..1420030eec 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -92,11 +92,10 @@ var ( FlagRound = flag.Int("R", -1, "set address rounding `quantum`") FlagTextAddr = flag.Int64("T", -1, "set text segment `address`") flagEntrySymbol = flag.String("E", "", "set `entry` symbol name") - - cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`") - memprofile = flag.String("memprofile", "", "write memory profile to `file`") - memprofilerate = flag.Int64("memprofilerate", 0, "set runtime.MemProfileRate to `rate`") - + cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`") + memprofile = flag.String("memprofile", "", "write memory profile to `file`") + memprofilerate = flag.Int64("memprofilerate", 0, "set runtime.MemProfileRate to `rate`") + flagAbiWrap = false benchmarkFlag = flag.String("benchmark", "", "set to 'mem' or 'cpu' to enable phase benchmarking") benchmarkFileFlag = flag.String("benchmarkprofile", "", "emit phase profiles to `base`_phase.{cpu,mem}prof") ) @@ -135,6 +134,9 @@ func Main(arch *sys.Arch, theArch Arch) { objabi.Flagfn1("X", "add string value `definition` of the form importpath.name=value", func(s string) { addstrdata1(ctxt, s) }) objabi.Flagcount("v", "print link trace", &ctxt.Debugvlog) objabi.Flagfn1("importcfg", "read import configuration from `file`", ctxt.readImportCfg) + if objabi.Regabi_enabled != 0 { + flag.BoolVar(&flagAbiWrap, "abiwrap", true, "support ABI wrapper functions") + } objabi.Flagparse(usage) diff --git a/src/cmd/link/internal/ld/symtab.go b/src/cmd/link/internal/ld/symtab.go index c98e4de03f..3b709baf75 100644 --- a/src/cmd/link/internal/ld/symtab.go +++ b/src/cmd/link/internal/ld/symtab.go @@ -102,6 +102,41 @@ func putelfsym(ctxt *Link, x loader.Sym, typ elf.SymType, curbind elf.SymBind) { elfshnum = xosect.Elfsect.(*ElfShdr).shnum } + sname := ldr.SymExtname(x) + + // For functions with ABI wrappers, we have to make sure that we + // don't wind up with two elf symbol table entries with the same + // name (since this will generated an error from the external + // linker). In the CgoExportStatic case, we want the ABI0 symbol + // to have the primary symbol table entry (since it's going to be + // called from C), so we rename the ABIInternal symbol. In all + // other cases, we rename the ABI0 symbol, since we want + // cross-load-module calls to target ABIInternal. + // + // TODO: generalize this for non-ELF (put the rename code in the + // loader, and store the rename result in SymExtname). + // + // TODO: avoid the ldr.Lookup calls below by instead using an aux + // sym or marker relocation to associate the wrapper with the + // wrapped function. + // + if flagAbiWrap { + if !ldr.IsExternal(x) && ldr.SymType(x) == sym.STEXT { + // First case + if ldr.SymVersion(x) == sym.SymVerABIInternal { + if s2 := ldr.Lookup(sname, sym.SymVerABI0); s2 != 0 && ldr.AttrCgoExportStatic(s2) && ldr.SymType(s2) == sym.STEXT { + sname = sname + ".abiinternal" + } + } + // Second case + if ldr.SymVersion(x) == sym.SymVerABI0 && !ldr.AttrCgoExportStatic(x) { + if s2 := ldr.Lookup(sname, sym.SymVerABIInternal); s2 != 0 && ldr.SymType(s2) == sym.STEXT { + sname = sname + ".abi0" + } + } + } + } + // One pass for each binding: elf.STB_LOCAL, elf.STB_GLOBAL, // maybe one day elf.STB_WEAK. bind := elf.STB_GLOBAL @@ -140,8 +175,6 @@ func putelfsym(ctxt *Link, x loader.Sym, typ elf.SymType, curbind elf.SymBind) { other |= 3 << 5 } - sname := ldr.SymExtname(x) - // When dynamically linking, we create Symbols by reading the names from // the symbol tables of the shared libraries and so the names need to // match exactly. Tools like DTrace will have to wait for now. diff --git a/src/runtime/textflag.h b/src/runtime/textflag.h index daca36d948..e727208cd0 100644 --- a/src/runtime/textflag.h +++ b/src/runtime/textflag.h @@ -35,3 +35,5 @@ // Function is the top of the call stack. Call stack unwinders should stop // at this function. #define TOPFRAME 2048 +// Function is an ABI wrapper. +#define ABIWRAPPER 4096 diff --git a/test/nosplit.go b/test/nosplit.go index faa7b8c2d8..8a3fa9bf35 100644 --- a/test/nosplit.go +++ b/test/nosplit.go @@ -353,7 +353,14 @@ TestCases: log.Fatal(err) } - cmd := exec.Command("go", "build") + // Turn off ABI0 wrapper generation for now. The problem here is + // that in these test cases main.main is an assembly routine, + // thus calls to it will have to go through an ABI wrapper. The + // ABI wrapper will consume some stack space, which throws off + // the numbers. + workaround := "-gcflags=-abiwrap=0" + + cmd := exec.Command("go", "build", workaround) cmd.Dir = dir output, err := cmd.CombinedOutput() if err == nil { -- cgit v1.3-5-g9baa From b0b0d9828308368e9fbd59ec5de55801f568f720 Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Thu, 12 Nov 2020 21:19:52 -0800 Subject: runtime: linux iscgo support for not blocking nptl signals Under linux+cgo, OS threads are launched via pthread_create(). This abstraction, under linux, requires we avoid blocking signals 32,33 and 34 indefinitely because they are needed to reliably execute POSIX-semantics threading in glibc and/or musl. When blocking signals the go runtime generally re-enables them quickly. However, when a thread exits (under cgo, this is via a return from mstart()), we avoid a deadlock in C-code by not blocking these three signals. Fixes #42494 Change-Id: I02dfb2480a1f97d11679e0c4b132b51bddbe4c14 Reviewed-on: https://go-review.googlesource.com/c/go/+/269799 Reviewed-by: Ian Lance Taylor Reviewed-by: Austin Clements Trust: Tobias Klauser --- src/runtime/os_js.go | 2 +- src/runtime/os_linux.go | 18 ++++++++++++++++++ src/runtime/os_plan9.go | 2 +- src/runtime/os_windows.go | 2 +- src/runtime/proc.go | 8 ++++---- src/runtime/signal_unix.go | 19 +++++++++++++++---- src/syscall/syscall_linux_test.go | 13 +++++++++++++ 7 files changed, 53 insertions(+), 11 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_js.go b/src/runtime/os_js.go index 94983b358d..91d18a078f 100644 --- a/src/runtime/os_js.go +++ b/src/runtime/os_js.go @@ -72,7 +72,7 @@ func clearSignalHandlers() { } //go:nosplit -func sigblock() { +func sigblock(exiting bool) { } // Called to initialize a new m (including the bootstrap m). diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 371db73502..f122d2c2ef 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -301,6 +301,24 @@ func getHugePageSize() uintptr { func osinit() { ncpu = getproccount() physHugePageSize = getHugePageSize() + if iscgo { + // #42494 glibc and musl reserve some signals for + // internal use and require they not be blocked by + // the rest of a normal C runtime. When the go runtime + // blocks...unblocks signals, temporarily, the blocked + // interval of time is generally very short. As such, + // these expectations of *libc code are mostly met by + // the combined go+cgo system of threads. However, + // when go causes a thread to exit, via a return from + // mstart(), the combined runtime can deadlock if + // these signals are blocked. Thus, don't block these + // signals when exiting threads. + // - glibc: SIGCANCEL (32), SIGSETXID (33) + // - musl: SIGTIMER (32), SIGCANCEL (33), SIGSYNCCALL (34) + sigdelset(&sigsetAllExiting, 32) + sigdelset(&sigsetAllExiting, 33) + sigdelset(&sigsetAllExiting, 34) + } osArchInit() } diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go index 62aecea060..a035526937 100644 --- a/src/runtime/os_plan9.go +++ b/src/runtime/os_plan9.go @@ -195,7 +195,7 @@ func msigrestore(sigmask sigset) { func clearSignalHandlers() { } -func sigblock() { +func sigblock(exiting bool) { } // Called to initialize a new m (including the bootstrap m). diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index ffb087f9db..d389d38ab9 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -886,7 +886,7 @@ func clearSignalHandlers() { } //go:nosplit -func sigblock() { +func sigblock(exiting bool) { } // Called to initialize a new m (including the bootstrap m). diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 5adcbf07dc..592d621241 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1313,7 +1313,7 @@ func mexit(osStack bool) { throw("locked m0 woke up") } - sigblock() + sigblock(true) unminit() // Free the gsignal stack. @@ -1754,7 +1754,7 @@ func needm() { // starting a new m to run Go code via newosproc. var sigmask sigset sigsave(&sigmask) - sigblock() + sigblock(false) // Lock extra list, take head, unlock popped list. // nilokay=false is safe here because of the invariant above, @@ -1903,7 +1903,7 @@ func dropm() { // Setg(nil) clears g, which is the signal handler's cue not to run Go handlers. // It's important not to try to handle a signal between those two steps. sigmask := mp.sigmask - sigblock() + sigblock(false) unminit() mnext := lockextra(true) @@ -3776,7 +3776,7 @@ func beforefork() { // group. See issue #18600. gp.m.locks++ sigsave(&gp.m.sigmask) - sigblock() + sigblock(false) // This function is called before fork in syscall package. // Code between fork and exec must not allocate memory nor even try to grow stack. diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index e8f39c3321..382ba37a87 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -1042,15 +1042,26 @@ func msigrestore(sigmask sigset) { sigprocmask(_SIG_SETMASK, &sigmask, nil) } -// sigblock blocks all signals in the current thread's signal mask. +// sigsetAllExiting is used by sigblock(true) when a thread is +// exiting. sigset_all is defined in OS specific code, and per GOOS +// behavior may override this default for sigsetAllExiting: see +// osinit(). +var sigsetAllExiting = sigset_all + +// sigblock blocks signals in the current thread's signal mask. // This is used to block signals while setting up and tearing down g -// when a non-Go thread calls a Go function. -// The OS-specific code is expected to define sigset_all. +// when a non-Go thread calls a Go function. When a thread is exiting +// we use the sigsetAllExiting value, otherwise the OS specific +// definition of sigset_all is used. // This is nosplit and nowritebarrierrec because it is called by needm // which may be called on a non-Go thread with no g available. //go:nosplit //go:nowritebarrierrec -func sigblock() { +func sigblock(exiting bool) { + if exiting { + sigprocmask(_SIG_SETMASK, &sigsetAllExiting, nil) + return + } sigprocmask(_SIG_SETMASK, &sigset_all, nil) } diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go index 153d0efef1..adeb7c9ebb 100644 --- a/src/syscall/syscall_linux_test.go +++ b/src/syscall/syscall_linux_test.go @@ -597,6 +597,14 @@ func compareStatus(filter, expect string) error { return nil } +// killAThread locks the goroutine to an OS thread and exits; this +// causes an OS thread to terminate. +func killAThread(c <-chan struct{}) { + runtime.LockOSThread() + <-c + return +} + // TestSetuidEtc performs tests on all of the wrapped system calls // that mirror to the 9 glibc syscalls with POSIX semantics. The test // here is considered authoritative and should compile and run @@ -647,6 +655,11 @@ func TestSetuidEtc(t *testing.T) { } for i, v := range vs { + // Generate some thread churn as we execute the tests. + c := make(chan struct{}) + go killAThread(c) + close(c) + if err := v.fn(); err != nil { t.Errorf("[%d] %q failed: %v", i, v.call, err) continue -- cgit v1.3-5-g9baa From fd6ba1c8a23d8a3fffb6c475b21f78510152ef5c Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Fri, 11 Dec 2020 22:42:11 -0800 Subject: os/signal: fix a deadlock with syscall.AllThreadsSyscall() use The syscall.AllThreadsSyscall() fixup mechanism needs to cooperate with signal handling to ensure a notetsleepg() thread can wake up to run the mDoFixup() function. Fixes #43149 Change-Id: I6651b25bc44a4de47d3fb71d0293d51aef8b79c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/277434 Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Trust: Austin Clements Reviewed-by: Ian Lance Taylor --- src/os/signal/signal_linux_test.go | 42 ++++++++++++++++++++++++++++++++++++++ src/runtime/proc.go | 1 + src/runtime/sigqueue.go | 34 ++++++++++++++++++++++++++++-- src/runtime/sigqueue_plan9.go | 7 +++++++ 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 src/os/signal/signal_linux_test.go (limited to 'src/runtime') diff --git a/src/os/signal/signal_linux_test.go b/src/os/signal/signal_linux_test.go new file mode 100644 index 0000000000..2e553d0b0f --- /dev/null +++ b/src/os/signal/signal_linux_test.go @@ -0,0 +1,42 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux + +package signal + +import ( + "os" + "syscall" + "testing" + "time" +) + +const prSetKeepCaps = 8 + +// This test validates that syscall.AllThreadsSyscall() can reliably +// reach all 'm' (threads) of the nocgo runtime even when one thread +// is blocked waiting to receive signals from the kernel. This monitors +// for a regression vs. the fix for #43149. +func TestAllThreadsSyscallSignals(t *testing.T) { + if _, _, err := syscall.AllThreadsSyscall(syscall.SYS_PRCTL, prSetKeepCaps, 0, 0); err == syscall.ENOTSUP { + t.Skip("AllThreadsSyscall disabled with cgo") + } + + sig := make(chan os.Signal, 1) + Notify(sig, os.Interrupt) + + for i := 0; i <= 100; i++ { + if _, _, errno := syscall.AllThreadsSyscall(syscall.SYS_PRCTL, prSetKeepCaps, uintptr(i&1), 0); errno != 0 { + t.Fatalf("[%d] failed to set KEEP_CAPS=%d: %v", i, i&1, errno) + } + } + + select { + case <-time.After(10 * time.Millisecond): + case <-sig: + t.Fatal("unexpected signal") + } + Stop(sig) +} diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 592d621241..ca78587aad 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1515,6 +1515,7 @@ func syscall_runtime_doAllThreadsSyscall(fn func(bool) bool) { if netpollinited() { netpollBreak() } + sigRecvPrepareForFixup() _g_ := getg() if raceenabled { // For m's running without racectx, we loan out the diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go index 0605f5da80..28b9e26d0f 100644 --- a/src/runtime/sigqueue.go +++ b/src/runtime/sigqueue.go @@ -12,12 +12,16 @@ // sigsend is called by the signal handler to queue a new signal. // signal_recv is called by the Go program to receive a newly queued signal. // Synchronization between sigsend and signal_recv is based on the sig.state -// variable. It can be in 3 states: sigIdle, sigReceiving and sigSending. +// variable. It can be in 4 states: sigIdle, sigReceiving, sigSending and sigFixup. // sigReceiving means that signal_recv is blocked on sig.Note and there are no // new pending signals. // sigSending means that sig.mask *may* contain new pending signals, // signal_recv can't be blocked in this state. // sigIdle means that there are no new pending signals and signal_recv is not blocked. +// sigFixup is a transient state that can only exist as a short +// transition from sigReceiving and then on to sigIdle: it is +// used to ensure the AllThreadsSyscall()'s mDoFixup() operation +// occurs on the sleeping m, waiting to receive a signal. // Transitions between states are done atomically with CAS. // When signal_recv is unblocked, it resets sig.Note and rechecks sig.mask. // If several sigsends and signal_recv execute concurrently, it can lead to @@ -59,6 +63,7 @@ const ( sigIdle = iota sigReceiving sigSending + sigFixup ) // sigsend delivers a signal from sighandler to the internal signal delivery queue. @@ -112,6 +117,9 @@ Send: notewakeup(&sig.note) break Send } + case sigFixup: + // nothing to do - we need to wait for sigIdle. + osyield() } } @@ -119,6 +127,19 @@ Send: return true } +// sigRecvPrepareForFixup is used to temporarily wake up the +// signal_recv() running thread while it is blocked waiting for the +// arrival of a signal. If it causes the thread to wake up, the +// sig.state travels through this sequence: sigReceiving -> sigFixup +// -> sigIdle -> sigReceiving and resumes. (This is only called while +// GC is disabled.) +//go:nosplit +func sigRecvPrepareForFixup() { + if atomic.Cas(&sig.state, sigReceiving, sigFixup) { + notewakeup(&sig.note) + } +} + // Called to receive the next queued signal. // Must only be called from a single goroutine at a time. //go:linkname signal_recv os/signal.signal_recv @@ -146,7 +167,16 @@ func signal_recv() uint32 { } notetsleepg(&sig.note, -1) noteclear(&sig.note) - break Receive + if !atomic.Cas(&sig.state, sigFixup, sigIdle) { + break Receive + } + // Getting here, the code will + // loop around again to sleep + // in state sigReceiving. This + // path is taken when + // sigRecvPrepareForFixup() + // has been called by another + // thread. } case sigSending: if atomic.Cas(&sig.state, sigSending, sigIdle) { diff --git a/src/runtime/sigqueue_plan9.go b/src/runtime/sigqueue_plan9.go index d5fe8f8b35..aebd2060e7 100644 --- a/src/runtime/sigqueue_plan9.go +++ b/src/runtime/sigqueue_plan9.go @@ -92,6 +92,13 @@ func sendNote(s *byte) bool { return true } +// sigRecvPrepareForFixup is a no-op on plan9. (This would only be +// called while GC is disabled.) +// +//go:nosplit +func sigRecvPrepareForFixup() { +} + // Called to receive the next queued signal. // Must only be called from a single goroutine at a time. //go:linkname signal_recv os/signal.signal_recv -- cgit v1.3-5-g9baa From fb96f07e1a45b9ec41158732a34aee8c2ccc2eaf Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 23 Dec 2020 17:12:44 +0000 Subject: runtime: fix nStackRoots comment about stack roots A comment in mgcmark.go indicates that we scan stacks a second time but we don't, at least not since changing to the hybrid write barrier. Change-Id: I9376adbb6d8b6dd9dc3cee62e077b5dfb8a3fdde Reviewed-on: https://go-review.googlesource.com/c/go/+/279797 Trust: Michael Knyszek Reviewed-by: Michael Pratt Reviewed-by: Austin Clements --- src/runtime/mgcmark.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index 5a24cdac88..52267e6fb0 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -101,8 +101,7 @@ func gcMarkRootPrepare() { // Gs may be created after this point, but it's okay that we // ignore them because they begin life without any roots, so // there's nothing to scan, and any roots they create during - // the concurrent phase will be scanned during mark - // termination. + // the concurrent phase will be caught by the write barrier. work.nStackRoots = int(atomic.Loaduintptr(&allglen)) work.markrootNext = 0 -- cgit v1.3-5-g9baa From 8db7e2fecdcd04af31c82d075c60ab6fdf6b7a48 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 22 Dec 2020 16:23:29 +0000 Subject: runtime: fix allocs-by-size and frees-by-size buckets Currently these two metrics are reported incorrectly, going by the documentation in the runtime/metrics package. We just copy in the size-class-based values from the runtime wholesale, but those implicitly have an inclusive upper-bound and exclusive lower-bound (e.g. 48-byte size class contains objects in the size range (32, 48]) but the API declares inclusive lower-bounds and exclusive upper-bounds. Also, the bottom bucket representing (-inf, 1) should always be empty. Extend the consistency check to verify this. Updates #43329. Change-Id: I11b5b062a34e13405ab662d15334bda91f779775 Reviewed-on: https://go-review.googlesource.com/c/go/+/279467 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Trust: Michael Knyszek Reviewed-by: Michael Pratt --- src/runtime/metrics.go | 13 ++++++++++++- src/runtime/metrics_test.go | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go index d3c0341aee..af86a0f03a 100644 --- a/src/runtime/metrics.go +++ b/src/runtime/metrics.go @@ -43,7 +43,18 @@ func initMetrics() { } sizeClassBuckets = make([]float64, _NumSizeClasses) for i := range sizeClassBuckets { - sizeClassBuckets[i] = float64(class_to_size[i]) + // Size classes have an inclusive upper-bound + // and exclusive lower bound (e.g. 48-byte size class is + // (32, 48]) whereas we want and inclusive lower-bound + // and exclusive upper-bound (e.g. 48-byte size class is + // [33, 49). We can achieve this by shifting all bucket + // boundaries up by 1. + // + // Also, a float64 can precisely represent integers with + // value up to 2^53 and size classes are relatively small + // (nowhere near 2^48 even) so this will give us exact + // boundaries. + sizeClassBuckets[i] = float64(class_to_size[i] + 1) } timeHistBuckets = timeHistogramMetricsBuckets() metrics = map[string]metricData{ diff --git a/src/runtime/metrics_test.go b/src/runtime/metrics_test.go index 167edd57fd..0ee469ae29 100644 --- a/src/runtime/metrics_test.go +++ b/src/runtime/metrics_test.go @@ -154,6 +154,12 @@ func TestReadMetricsConsistency(t *testing.T) { if totalVirtual.got != totalVirtual.want { t.Errorf(`"/memory/classes/total:bytes" does not match sum of /memory/classes/**: got %d, want %d`, totalVirtual.got, totalVirtual.want) } + if objects.alloc.Counts[0] > 0 { + t.Error("found counts for objects of non-positive size in allocs-by-size") + } + if objects.free.Counts[0] > 0 { + t.Error("found counts for objects of non-positive size in frees-by-size") + } if len(objects.alloc.Buckets) != len(objects.free.Buckets) { t.Error("allocs-by-size and frees-by-size buckets don't match in length") } else if len(objects.alloc.Counts) != len(objects.free.Counts) { -- cgit v1.3-5-g9baa From b116404444addc69b5ec987a2a64b92d4956eab0 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 22 Dec 2020 17:47:43 +0000 Subject: runtime: shift timeHistogram buckets and allow negative durations Today, timeHistogram, when copied, has the wrong set of counts for the bucket that should represent (-inf, 0), when in fact it contains [0, 1). In essence, the buckets are all shifted over by one from where they're supposed to be. But this also means that the existence of the overflow bucket is wrong: the top bucket is supposed to extend to infinity, and what we're really missing is an underflow bucket to represent the range (-inf, 0). We could just always zero this bucket and continue ignoring negative durations, but that likely isn't prudent. timeHistogram is intended to be used with differences in nanotime, but depending on how a platform is implemented (or due to a bug in that platform) it's possible to get a negative duration without having done anything wrong. We should just be resilient to that and be able to detect it. So this change removes the overflow bucket and replaces it with an underflow bucket, and timeHistogram no longer panics when faced with a negative duration. Fixes #43328. Fixes #43329. Change-Id: If336425d7d080fd37bf071e18746800e22d38108 Reviewed-on: https://go-review.googlesource.com/c/go/+/279468 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Trust: Michael Knyszek Reviewed-by: Michael Pratt --- src/runtime/export_test.go | 4 ++-- src/runtime/histogram.go | 30 +++++++++++++++--------------- src/runtime/histogram_test.go | 22 +++++++++++++++++----- src/runtime/metrics.go | 4 ++-- 4 files changed, 36 insertions(+), 24 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 44551dcaf1..22fef3134f 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -1201,12 +1201,12 @@ type TimeHistogram timeHistogram // Counts returns the counts for the given bucket, subBucket indices. // Returns true if the bucket was valid, otherwise returns the counts -// for the overflow bucket and false. +// for the underflow bucket and false. func (th *TimeHistogram) Count(bucket, subBucket uint) (uint64, bool) { t := (*timeHistogram)(th) i := bucket*TimeHistNumSubBuckets + subBucket if i >= uint(len(t.counts)) { - return t.overflow, false + return t.underflow, false } return t.counts[i], true } diff --git a/src/runtime/histogram.go b/src/runtime/histogram.go index 4020969eb9..d48e856cd0 100644 --- a/src/runtime/histogram.go +++ b/src/runtime/histogram.go @@ -69,17 +69,15 @@ const ( // for concurrent use. It is also safe to read all the values // atomically. type timeHistogram struct { - counts [timeHistNumSuperBuckets * timeHistNumSubBuckets]uint64 - overflow uint64 + counts [timeHistNumSuperBuckets * timeHistNumSubBuckets]uint64 + underflow uint64 } // record adds the given duration to the distribution. -// -// Although the duration is an int64 to facilitate ease-of-use -// with e.g. nanotime, the duration must be non-negative. func (h *timeHistogram) record(duration int64) { if duration < 0 { - throw("timeHistogram encountered negative duration") + atomic.Xadd64(&h.underflow, 1) + return } // The index of the exponential bucket is just the index // of the highest set bit adjusted for how many bits we @@ -92,15 +90,17 @@ func (h *timeHistogram) record(duration int64) { superBucket = uint(sys.Len64(uint64(duration))) - timeHistSubBucketBits if superBucket*timeHistNumSubBuckets >= uint(len(h.counts)) { // The bucket index we got is larger than what we support, so - // add into the special overflow bucket. - atomic.Xadd64(&h.overflow, 1) - return + // include this count in the highest bucket, which extends to + // infinity. + superBucket = timeHistNumSuperBuckets - 1 + subBucket = timeHistNumSubBuckets - 1 + } else { + // The linear subbucket index is just the timeHistSubBucketsBits + // bits after the top bit. To extract that value, shift down + // the duration such that we leave the top bit and the next bits + // intact, then extract the index. + subBucket = uint((duration >> (superBucket - 1)) % timeHistNumSubBuckets) } - // The linear subbucket index is just the timeHistSubBucketsBits - // bits after the top bit. To extract that value, shift down - // the duration such that we leave the top bit and the next bits - // intact, then extract the index. - subBucket = uint((duration >> (superBucket - 1)) % timeHistNumSubBuckets) } else { subBucket = uint(duration) } @@ -128,7 +128,7 @@ func timeHistogramMetricsBuckets() []float64 { // index to combine it with the bucketMin. subBucketShift := uint(0) if i > 1 { - // The first two buckets are exact with respect to integers, + // The first two super buckets are exact with respect to integers, // so we'll never have to shift the sub-bucket index. Thereafter, // we shift up by 1 with each subsequent bucket. subBucketShift = uint(i - 2) diff --git a/src/runtime/histogram_test.go b/src/runtime/histogram_test.go index 5f5b28f784..dbc64fa559 100644 --- a/src/runtime/histogram_test.go +++ b/src/runtime/histogram_test.go @@ -5,6 +5,7 @@ package runtime_test import ( + "math" . "runtime" "testing" ) @@ -32,8 +33,8 @@ func TestTimeHistogram(t *testing.T) { h.Record(base + v) } } - // Hit the overflow bucket. - h.Record(int64(^uint64(0) >> 1)) + // Hit the underflow bucket. + h.Record(int64(-1)) // Check to make sure there's exactly one count in each // bucket. @@ -41,7 +42,7 @@ func TestTimeHistogram(t *testing.T) { for j := uint(0); j < TimeHistNumSubBuckets; j++ { c, ok := h.Count(i, j) if !ok { - t.Errorf("hit overflow bucket unexpectedly: (%d, %d)", i, j) + t.Errorf("hit underflow bucket unexpectedly: (%d, %d)", i, j) } else if c != 1 { t.Errorf("bucket (%d, %d) has count that is not 1: %d", i, j, c) } @@ -49,10 +50,21 @@ func TestTimeHistogram(t *testing.T) { } c, ok := h.Count(TimeHistNumSuperBuckets, 0) if ok { - t.Errorf("expected to hit overflow bucket: (%d, %d)", TimeHistNumSuperBuckets, 0) + t.Errorf("expected to hit underflow bucket: (%d, %d)", TimeHistNumSuperBuckets, 0) } if c != 1 { - t.Errorf("overflow bucket has count that is not 1: %d", c) + t.Errorf("underflow bucket has count that is not 1: %d", c) } + + // Check overflow behavior. + // By hitting a high value, we should just be adding into the highest bucket. + h.Record(math.MaxInt64) + c, ok = h.Count(TimeHistNumSuperBuckets-1, TimeHistNumSubBuckets-1) + if !ok { + t.Error("hit underflow bucket in highest bucket unexpectedly") + } else if c != 2 { + t.Errorf("highest has count that is not 2: %d", c) + } + dummyTimeHistogram = TimeHistogram{} } diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go index af86a0f03a..1d191e6298 100644 --- a/src/runtime/metrics.go +++ b/src/runtime/metrics.go @@ -116,9 +116,9 @@ func initMetrics() { "/gc/pauses:seconds": { compute: func(_ *statAggregate, out *metricValue) { hist := out.float64HistOrInit(timeHistBuckets) - hist.counts[len(hist.counts)-1] = atomic.Load64(&memstats.gcPauseDist.overflow) + hist.counts[0] = atomic.Load64(&memstats.gcPauseDist.underflow) for i := range hist.buckets { - hist.counts[i] = atomic.Load64(&memstats.gcPauseDist.counts[i]) + hist.counts[i+1] = atomic.Load64(&memstats.gcPauseDist.counts[i]) } }, }, -- cgit v1.3-5-g9baa From 1d78139128d6d839d7da0aeb10b3e51b6c7c0749 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 25 Dec 2020 11:14:11 +0100 Subject: runtime/cgo: fix Android build with NDK 22 Fixes #42655 Change-Id: I7d2b70098a4ba4dcb325fb0be076043789b86135 Reviewed-on: https://go-review.googlesource.com/c/go/+/280312 Run-TryBot: Elias Naur TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Trust: Elias Naur --- src/runtime/cgo/gcc_linux_386.c | 2 +- src/runtime/cgo/gcc_linux_amd64.c | 2 +- src/runtime/cgo/gcc_linux_arm.c | 2 +- src/runtime/cgo/gcc_linux_arm64.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/cgo/gcc_linux_386.c b/src/runtime/cgo/gcc_linux_386.c index ece9f933c5..70c942aeb8 100644 --- a/src/runtime/cgo/gcc_linux_386.c +++ b/src/runtime/cgo/gcc_linux_386.c @@ -12,7 +12,7 @@ static void *threadentry(void*); static void (*setg_gcc)(void*); // This will be set in gcc_android.c for android-specific customization. -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); void x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) diff --git a/src/runtime/cgo/gcc_linux_amd64.c b/src/runtime/cgo/gcc_linux_amd64.c index 9134e0df92..f2bf6482cb 100644 --- a/src/runtime/cgo/gcc_linux_amd64.c +++ b/src/runtime/cgo/gcc_linux_amd64.c @@ -14,7 +14,7 @@ static void* threadentry(void*); static void (*setg_gcc)(void*); // This will be set in gcc_android.c for android-specific customization. -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); void x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) diff --git a/src/runtime/cgo/gcc_linux_arm.c b/src/runtime/cgo/gcc_linux_arm.c index 61855b96b2..5bc0fee90d 100644 --- a/src/runtime/cgo/gcc_linux_arm.c +++ b/src/runtime/cgo/gcc_linux_arm.c @@ -10,7 +10,7 @@ static void *threadentry(void*); -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); static void (*setg_gcc)(void*); void diff --git a/src/runtime/cgo/gcc_linux_arm64.c b/src/runtime/cgo/gcc_linux_arm64.c index 261c884ac9..17ff274fbb 100644 --- a/src/runtime/cgo/gcc_linux_arm64.c +++ b/src/runtime/cgo/gcc_linux_arm64.c @@ -12,7 +12,7 @@ static void *threadentry(void*); -void (*x_cgo_inittls)(void **tlsg, void **tlsbase); +void (*x_cgo_inittls)(void **tlsg, void **tlsbase) __attribute__((common)); static void (*setg_gcc)(void*); void -- cgit v1.3-5-g9baa From 6b37b15d9520f9fa2b819e66a37fac4b2d08da78 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 17 Nov 2020 11:55:53 -0500 Subject: runtime: don't take allglock in tracebackothers tracebackothers is called from fatal throw/panic. A fatal throw may be taken with allglock held (notably in the allocator when allglock is held), which would cause a deadlock in tracebackothers when we try to take allglock again. Locking allglock here is also often a lock order violation w.r.t. the locks held when throw was called. Avoid the deadlock and ordering issues by skipping locking altogether. It is OK to miss concurrently created Gs (which are generally avoided by freezetheworld(), and which were possible previously anyways if created after the loop). Fatal throw/panic freezetheworld(), which should freeze other threads that may be racing to modify allgs. However, freezetheworld() does _not_ guarantee that it stops all other threads, so we can't simply drop the lock. Fixes #42669 Updates #43175 Change-Id: I657aec46ed35fd5d1b3f1ba25b500128ab26b088 Reviewed-on: https://go-review.googlesource.com/c/go/+/270861 Reviewed-by: Michael Knyszek Trust: Michael Pratt --- src/runtime/mgcmark.go | 1 - src/runtime/proc.go | 43 +++++++++++++++++++++++++++++++++++++++---- src/runtime/runtime2.go | 1 - src/runtime/traceback.go | 27 +++++++++++++++++---------- 4 files changed, 56 insertions(+), 16 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index 52267e6fb0..46fae5de72 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -132,7 +132,6 @@ fail: println("gp", gp, "goid", gp.goid, "status", readgstatus(gp), "gcscandone", gp.gcscandone) - unlock(&allglock) // Avoid self-deadlock with traceback. throw("scan missed a g") } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index ca78587aad..5a942a6831 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -490,8 +490,29 @@ func lockedOSThread() bool { } var ( - allgs []*g + // allgs contains all Gs ever created (including dead Gs), and thus + // never shrinks. + // + // Access via the slice is protected by allglock or stop-the-world. + // Readers that cannot take the lock may (carefully!) use the atomic + // variables below. allglock mutex + allgs []*g + + // allglen and allgptr are atomic variables that contain len(allg) and + // &allg[0] respectively. Proper ordering depends on totally-ordered + // loads and stores. Writes are protected by allglock. + // + // allgptr is updated before allglen. Readers should read allglen + // before allgptr to ensure that allglen is always <= len(allgptr). New + // Gs appended during the race can be missed. For a consistent view of + // all Gs, allglock must be held. + // + // allgptr copies should always be stored as a concrete type or + // unsafe.Pointer, not uintptr, to ensure that GC can still reach it + // even if it points to a stale array. + allglen uintptr + allgptr **g ) func allgadd(gp *g) { @@ -501,10 +522,25 @@ func allgadd(gp *g) { lock(&allglock) allgs = append(allgs, gp) - allglen = uintptr(len(allgs)) + if &allgs[0] != allgptr { + atomicstorep(unsafe.Pointer(&allgptr), unsafe.Pointer(&allgs[0])) + } + atomic.Storeuintptr(&allglen, uintptr(len(allgs))) unlock(&allglock) } +// atomicAllG returns &allgs[0] and len(allgs) for use with atomicAllGIndex. +func atomicAllG() (**g, uintptr) { + length := atomic.Loaduintptr(&allglen) + ptr := (**g)(atomic.Loadp(unsafe.Pointer(&allgptr))) + return ptr, length +} + +// atomicAllGIndex returns ptr[i] with the allgptr returned from atomicAllG. +func atomicAllGIndex(ptr **g, i uintptr) *g { + return *(**g)(add(unsafe.Pointer(ptr), i*sys.PtrSize)) +} + const ( // Number of goroutine ids to grab from sched.goidgen to local per-P cache at once. // 16 seems to provide enough amortization, but other than that it's mostly arbitrary number. @@ -4266,7 +4302,7 @@ func badunlockosthread() { } func gcount() int32 { - n := int32(allglen) - sched.gFree.n - int32(atomic.Load(&sched.ngsys)) + n := int32(atomic.Loaduintptr(&allglen)) - sched.gFree.n - int32(atomic.Load(&sched.ngsys)) for _, _p_ := range allp { n -= _p_.gFree.n } @@ -4970,7 +5006,6 @@ func checkdead() { case _Grunnable, _Grunning, _Gsyscall: - unlock(&allglock) print("runtime: checkdead: find g ", gp.goid, " in status ", s, "\n") throw("checkdead: runnable g") } diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index c9376827da..109f0da131 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -1052,7 +1052,6 @@ func (w waitReason) String() string { } var ( - allglen uintptr allm *m gomaxprocs int32 ncpu int32 diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 0825e9e707..2601cd697f 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -917,17 +917,25 @@ func tracebackothers(me *g) { level, _, _ := gotraceback() // Show the current goroutine first, if we haven't already. - g := getg() - gp := g.m.curg - if gp != nil && gp != me { + curgp := getg().m.curg + if curgp != nil && curgp != me { print("\n") - goroutineheader(gp) - traceback(^uintptr(0), ^uintptr(0), 0, gp) + goroutineheader(curgp) + traceback(^uintptr(0), ^uintptr(0), 0, curgp) } - lock(&allglock) - for _, gp := range allgs { - if gp == me || gp == g.m.curg || readgstatus(gp) == _Gdead || isSystemGoroutine(gp, false) && level < 2 { + // We can't take allglock here because this may be during fatal + // throw/panic, where locking allglock could be out-of-order or a + // direct deadlock. + // + // Instead, use atomic access to allgs which requires no locking. We + // don't lock against concurrent creation of new Gs, but even with + // allglock we may miss Gs created after this loop. + ptr, length := atomicAllG() + for i := uintptr(0); i < length; i++ { + gp := atomicAllGIndex(ptr, i) + + if gp == me || gp == curgp || readgstatus(gp) == _Gdead || isSystemGoroutine(gp, false) && level < 2 { continue } print("\n") @@ -936,14 +944,13 @@ func tracebackothers(me *g) { // called from a signal handler initiated during a // systemstack call. The original G is still in the // running state, and we want to print its stack. - if gp.m != g.m && readgstatus(gp)&^_Gscan == _Grunning { + if gp.m != getg().m && readgstatus(gp)&^_Gscan == _Grunning { print("\tgoroutine running on other thread; stack unavailable\n") printcreatedby(gp) } else { traceback(^uintptr(0), ^uintptr(0), 0, gp) } } - unlock(&allglock) } // tracebackHexdump hexdumps part of stk around frame.sp and frame.fp -- cgit v1.3-5-g9baa From 4c668b25c6517ff12b61c11cad1f22ddc89a9791 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 6 Jan 2021 18:22:17 +0000 Subject: runtime/metrics: fix panic message for Float64Histogram The panic message erroneously refers to float64 values. Change-Id: I83380f41d6c28a72bc69a94b9bcdf9d42b1503c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/281236 Trust: Michael Knyszek Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Michael Pratt --- src/runtime/metrics/value.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics/value.go b/src/runtime/metrics/value.go index 0b056b4ea8..61e8a192a3 100644 --- a/src/runtime/metrics/value.go +++ b/src/runtime/metrics/value.go @@ -63,7 +63,7 @@ func (v Value) Float64() float64 { // If v.Kind() != KindFloat64Histogram, this method panics. func (v Value) Float64Histogram() *Float64Histogram { if v.kind != KindFloat64Histogram { - panic("called Float64 on non-float64 metric value") + panic("called Float64Histogram on non-Float64Histogram metric value") } return (*Float64Histogram)(v.pointer) } -- cgit v1.3-5-g9baa From df81a15819d5b264e6451976a2884953e8d28b20 Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Wed, 18 Nov 2020 10:28:18 +0800 Subject: runtime: check mips64 VDSO clock_gettime return code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We introduced VDSO feature for mips64x in Go1.14, however Linux kernel didn't ship VDSO safe fallback until 4.13. This CL checks vdso return code it may fix this issue. name old time/op new time/op delta Now 174ns ± 0% 176ns ± 0% +1.20% (p=0.000 n=8+9) NowUnixNano 175ns ± 0% 177ns ± 0% +1.13% (p=0.000 n=9+7) FormatNow 1.01µs ± 1% 1.02µs ± 3% ~ (p=0.181 n=10+10) Fixes #39046 Change-Id: Ibcefe4c8334f634c7ef18fa70f3c7dbe8306f224 Reviewed-on: https://go-review.googlesource.com/c/go/+/270717 Run-TryBot: Meng Zhuo Reviewed-by: Ian Lance Taylor Trust: Michael Pratt Trust: Meng Zhuo --- src/runtime/sys_linux_mips64x.s | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index afad056d06..c3e9f37694 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -250,6 +250,14 @@ noswitch: BEQ R25, fallback JAL (R25) + // check on vdso call return for kernel compatibility + // see https://golang.org/issues/39046 + // if we get any error make fallback permanent. + BEQ R2, R0, finish + MOVV R0, runtime·vdsoClockgettimeSym(SB) + MOVW $0, R4 // CLOCK_REALTIME + MOVV $0(R29), R5 + JMP fallback finish: MOVV 0(R29), R3 // sec @@ -311,6 +319,12 @@ noswitch: BEQ R25, fallback JAL (R25) + // see walltime1 for detail + BEQ R2, R0, finish + MOVV R0, runtime·vdsoClockgettimeSym(SB) + MOVW $1, R4 // CLOCK_MONOTONIC + MOVV $0(R29), R5 + JMP fallback finish: MOVV 0(R29), R3 // sec -- cgit v1.3-5-g9baa From ae9771713383c1ee01a544cd50cfdbc22841380a Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 6 Jan 2021 23:05:22 +0000 Subject: runtime,runtime/metrics: use explicit histogram boundaries This change modifies the semantics of runtime/metrics.Float64Histogram.Buckets to remove implicit buckets to that extend to positive and negative infinity and instead defines all bucket boundaries as explicitly listed. Bucket boundaries remain the same as before except /gc/heap/allocs-by-size:objects and /gc/heap/frees-by-size:objects no longer have a bucket that extends to negative infinity. This change simplifies the Float64Histogram API, making it both easier to understand and easier to use. Also, add a test for allocs-by-size and frees-by-size that checks them against MemStats. Fixes #43443. Change-Id: I5620f15bd084562dadf288f733c4a8cace21910c Reviewed-on: https://go-review.googlesource.com/c/go/+/281238 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Austin Clements Reviewed-by: Michael Pratt Trust: Michael Knyszek --- src/runtime/histogram.go | 32 ++++++++++++++++++++++++++++---- src/runtime/metrics.go | 32 +++++++++++++++++++++++--------- src/runtime/metrics/histogram.go | 29 ++++++++++++++++------------- src/runtime/metrics_test.go | 36 ++++++++++++++++++++++++++++++++---- 4 files changed, 99 insertions(+), 30 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/histogram.go b/src/runtime/histogram.go index d48e856cd0..42baa6c5e2 100644 --- a/src/runtime/histogram.go +++ b/src/runtime/histogram.go @@ -7,6 +7,7 @@ package runtime import ( "runtime/internal/atomic" "runtime/internal/sys" + "unsafe" ) const ( @@ -69,7 +70,13 @@ const ( // for concurrent use. It is also safe to read all the values // atomically. type timeHistogram struct { - counts [timeHistNumSuperBuckets * timeHistNumSubBuckets]uint64 + counts [timeHistNumSuperBuckets * timeHistNumSubBuckets]uint64 + + // underflow counts all the times we got a negative duration + // sample. Because of how time works on some platforms, it's + // possible to measure negative durations. We could ignore them, + // but we record them anyway because it's better to have some + // signal that it's happening than just missing samples. underflow uint64 } @@ -107,14 +114,30 @@ func (h *timeHistogram) record(duration int64) { atomic.Xadd64(&h.counts[superBucket*timeHistNumSubBuckets+subBucket], 1) } +const ( + fInf = 0x7FF0000000000000 + fNegInf = 0xFFF0000000000000 +) + +func float64Inf() float64 { + inf := uint64(fInf) + return *(*float64)(unsafe.Pointer(&inf)) +} + +func float64NegInf() float64 { + inf := uint64(fNegInf) + return *(*float64)(unsafe.Pointer(&inf)) +} + // timeHistogramMetricsBuckets generates a slice of boundaries for // the timeHistogram. These boundaries are represented in seconds, // not nanoseconds like the timeHistogram represents durations. func timeHistogramMetricsBuckets() []float64 { - b := make([]float64, timeHistTotalBuckets-1) + b := make([]float64, timeHistTotalBuckets+1) + b[0] = float64NegInf() for i := 0; i < timeHistNumSuperBuckets; i++ { superBucketMin := uint64(0) - // The (inclusive) minimum for the first bucket is 0. + // The (inclusive) minimum for the first non-negative bucket is 0. if i > 0 { // The minimum for the second bucket will be // 1 << timeHistSubBucketBits, indicating that all @@ -141,8 +164,9 @@ func timeHistogramMetricsBuckets() []float64 { // Convert the subBucketMin which is in nanoseconds to a float64 seconds value. // These values will all be exactly representable by a float64. - b[i*timeHistNumSubBuckets+j] = float64(subBucketMin) / 1e9 + b[i*timeHistNumSubBuckets+j+1] = float64(subBucketMin) / 1e9 } } + b[len(b)-1] = float64Inf() return b } diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go index 1d191e6298..4d37a56f4c 100644 --- a/src/runtime/metrics.go +++ b/src/runtime/metrics.go @@ -41,8 +41,13 @@ func initMetrics() { if metricsInit { return } - sizeClassBuckets = make([]float64, _NumSizeClasses) - for i := range sizeClassBuckets { + + sizeClassBuckets = make([]float64, _NumSizeClasses, _NumSizeClasses+1) + // Skip size class 0 which is a stand-in for large objects, but large + // objects are tracked separately (and they actually get placed in + // the last bucket, not the first). + sizeClassBuckets[0] = 1 // The smallest allocation is 1 byte in size. + for i := 1; i < _NumSizeClasses; i++ { // Size classes have an inclusive upper-bound // and exclusive lower bound (e.g. 48-byte size class is // (32, 48]) whereas we want and inclusive lower-bound @@ -56,6 +61,8 @@ func initMetrics() { // boundaries. sizeClassBuckets[i] = float64(class_to_size[i] + 1) } + sizeClassBuckets = append(sizeClassBuckets, float64Inf()) + timeHistBuckets = timeHistogramMetricsBuckets() metrics = map[string]metricData{ "/gc/cycles/automatic:gc-cycles": { @@ -84,8 +91,10 @@ func initMetrics() { compute: func(in *statAggregate, out *metricValue) { hist := out.float64HistOrInit(sizeClassBuckets) hist.counts[len(hist.counts)-1] = uint64(in.heapStats.largeAllocCount) - for i := range hist.buckets { - hist.counts[i] = uint64(in.heapStats.smallAllocCount[i]) + // Cut off the first index which is ostensibly for size class 0, + // but large objects are tracked separately so it's actually unused. + for i, count := range in.heapStats.smallAllocCount[1:] { + hist.counts[i] = uint64(count) } }, }, @@ -94,8 +103,10 @@ func initMetrics() { compute: func(in *statAggregate, out *metricValue) { hist := out.float64HistOrInit(sizeClassBuckets) hist.counts[len(hist.counts)-1] = uint64(in.heapStats.largeFreeCount) - for i := range hist.buckets { - hist.counts[i] = uint64(in.heapStats.smallFreeCount[i]) + // Cut off the first index which is ostensibly for size class 0, + // but large objects are tracked separately so it's actually unused. + for i, count := range in.heapStats.smallFreeCount[1:] { + hist.counts[i] = uint64(count) } }, }, @@ -116,8 +127,11 @@ func initMetrics() { "/gc/pauses:seconds": { compute: func(_ *statAggregate, out *metricValue) { hist := out.float64HistOrInit(timeHistBuckets) + // The bottom-most bucket, containing negative values, is tracked + // as a separately as underflow, so fill that in manually and then + // iterate over the rest. hist.counts[0] = atomic.Load64(&memstats.gcPauseDist.underflow) - for i := range hist.buckets { + for i := range memstats.gcPauseDist.counts { hist.counts[i+1] = atomic.Load64(&memstats.gcPauseDist.counts[i]) } }, @@ -437,8 +451,8 @@ func (v *metricValue) float64HistOrInit(buckets []float64) *metricFloat64Histogr v.pointer = unsafe.Pointer(hist) } hist.buckets = buckets - if len(hist.counts) != len(hist.buckets)+1 { - hist.counts = make([]uint64, len(buckets)+1) + if len(hist.counts) != len(hist.buckets)-1 { + hist.counts = make([]uint64, len(buckets)-1) } return hist } diff --git a/src/runtime/metrics/histogram.go b/src/runtime/metrics/histogram.go index e1364e1e26..956422bf84 100644 --- a/src/runtime/metrics/histogram.go +++ b/src/runtime/metrics/histogram.go @@ -6,25 +6,28 @@ package metrics // Float64Histogram represents a distribution of float64 values. type Float64Histogram struct { - // Counts contains the weights for each histogram bucket. The length of - // Counts is equal to the length of Buckets (in the metric description) - // plus one to account for the implicit minimum bucket. + // Counts contains the weights for each histogram bucket. // - // Given N buckets, the following is the mathematical relationship between - // Counts and Buckets. - // count[0] is the weight of the range (-inf, bucket[0]) - // count[n] is the weight of the range [bucket[n], bucket[n+1]), for 0 < n < N-1 - // count[N-1] is the weight of the range [bucket[N-1], inf) + // Given N buckets, Count[n] is the weight of the range + // [bucket[n], bucket[n+1]), for 0 <= n < N. Counts []uint64 - // Buckets contains the boundaries between histogram buckets, in increasing order. + // Buckets contains the boundaries of the histogram buckets, in increasing order. // - // Because this slice contains boundaries, there are len(Buckets)+1 counts: - // a count for all values less than the first boundary, a count covering each - // [slice[i], slice[i+1]) interval, and a count for all values greater than or - // equal to the last boundary. + // Buckets[0] is the inclusive lower bound of the minimum bucket while + // Buckets[len(Buckets)-1] is the exclusive upper bound of the maximum bucket. + // Hence, there are len(Buckets)-1 counts. Furthermore, len(Buckets) != 1, always, + // since at least two boundaries are required to describe one bucket (and 0 + // boundaries are used to describe 0 buckets). + // + // Buckets[0] is permitted to have value -Inf and Buckets[len(Buckets)-1] is + // permitted to have value Inf. // // For a given metric name, the value of Buckets is guaranteed not to change // between calls until program exit. + // + // This slice value is permitted to alias with other Float64Histograms' Buckets + // fields, so the values within should only ever be read. If they need to be + // modified, the user must make a copy. Buckets []float64 } diff --git a/src/runtime/metrics_test.go b/src/runtime/metrics_test.go index 0ee469ae29..5109058ed1 100644 --- a/src/runtime/metrics_test.go +++ b/src/runtime/metrics_test.go @@ -70,6 +70,34 @@ func TestReadMetrics(t *testing.T) { checkUint64(t, name, samples[i].Value.Uint64(), mstats.BuckHashSys) case "/memory/classes/total:bytes": checkUint64(t, name, samples[i].Value.Uint64(), mstats.Sys) + case "/gc/heap/allocs-by-size:objects": + hist := samples[i].Value.Float64Histogram() + // Skip size class 0 in BySize, because it's always empty and not represented + // in the histogram. + for i, sc := range mstats.BySize[1:] { + if b, s := hist.Buckets[i+1], float64(sc.Size+1); b != s { + t.Errorf("bucket does not match size class: got %f, want %f", b, s) + // The rest of the checks aren't expected to work anyway. + continue + } + if c, m := hist.Counts[i], sc.Mallocs; c != m { + t.Errorf("histogram counts do not much BySize for class %d: got %d, want %d", i, c, m) + } + } + case "/gc/heap/frees-by-size:objects": + hist := samples[i].Value.Float64Histogram() + // Skip size class 0 in BySize, because it's always empty and not represented + // in the histogram. + for i, sc := range mstats.BySize[1:] { + if b, s := hist.Buckets[i+1], float64(sc.Size+1); b != s { + t.Errorf("bucket does not match size class: got %f, want %f", b, s) + // The rest of the checks aren't expected to work anyway. + continue + } + if c, f := hist.Counts[i], sc.Frees; c != f { + t.Errorf("histogram counts do not much BySize for class %d: got %d, want %d", i, c, f) + } + } case "/gc/heap/objects:objects": checkUint64(t, name, samples[i].Value.Uint64(), mstats.HeapObjects) case "/gc/heap/goal:bytes": @@ -154,11 +182,11 @@ func TestReadMetricsConsistency(t *testing.T) { if totalVirtual.got != totalVirtual.want { t.Errorf(`"/memory/classes/total:bytes" does not match sum of /memory/classes/**: got %d, want %d`, totalVirtual.got, totalVirtual.want) } - if objects.alloc.Counts[0] > 0 { - t.Error("found counts for objects of non-positive size in allocs-by-size") + if b, c := len(objects.alloc.Buckets), len(objects.alloc.Counts); b != c+1 { + t.Errorf("allocs-by-size has wrong bucket or counts length: %d buckets, %d counts", b, c) } - if objects.free.Counts[0] > 0 { - t.Error("found counts for objects of non-positive size in frees-by-size") + if b, c := len(objects.free.Buckets), len(objects.free.Counts); b != c+1 { + t.Errorf("frees-by-size has wrong bucket or counts length: %d buckets, %d counts", b, c) } if len(objects.alloc.Buckets) != len(objects.free.Buckets) { t.Error("allocs-by-size and frees-by-size buckets don't match in length") -- cgit v1.3-5-g9baa From 32afcc94363e15ee2ef0cffec962191a15e73094 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 7 Jan 2021 17:24:39 +0000 Subject: runtime/metrics: change unit on *-by-size metrics to match bucket unit This change modifies the *-by-size metrics' units to be based off the bucket's unit (bytes) as opposed to the unit of the counts (objects). This convention is more in-line with distributions in other metrics systems. Change-Id: Id3b68a09f52f0e1ff9f4346f613ae1cbd9f52f73 Reviewed-on: https://go-review.googlesource.com/c/go/+/282352 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Austin Clements Reviewed-by: Michael Pratt Trust: Michael Knyszek --- src/runtime/metrics.go | 4 ++-- src/runtime/metrics/description.go | 9 +++++++-- src/runtime/metrics/doc.go | 4 ++-- src/runtime/metrics_test.go | 8 ++++---- 4 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go index 4d37a56f4c..3e8dbda0ca 100644 --- a/src/runtime/metrics.go +++ b/src/runtime/metrics.go @@ -86,7 +86,7 @@ func initMetrics() { out.scalar = in.sysStats.gcCyclesDone }, }, - "/gc/heap/allocs-by-size:objects": { + "/gc/heap/allocs-by-size:bytes": { deps: makeStatDepSet(heapStatsDep), compute: func(in *statAggregate, out *metricValue) { hist := out.float64HistOrInit(sizeClassBuckets) @@ -98,7 +98,7 @@ func initMetrics() { } }, }, - "/gc/heap/frees-by-size:objects": { + "/gc/heap/frees-by-size:bytes": { deps: makeStatDepSet(heapStatsDep), compute: func(in *statAggregate, out *metricValue) { hist := out.float64HistOrInit(sizeClassBuckets) diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go index 32af5d1727..01c8a685ee 100644 --- a/src/runtime/metrics/description.go +++ b/src/runtime/metrics/description.go @@ -23,6 +23,11 @@ type Description struct { // Examples of units might be "seconds", "bytes", "bytes/second", "cpu-seconds", // "byte*cpu-seconds", and "bytes/second/second". // + // For histograms, multiple units may apply. For instance, the units of the buckets and + // the count. By convention, for histograms, the units of the count are always "samples" + // with the type of sample evident by the metric's name, while the unit in the name + // specifies the buckets' unit. + // // A complete name might look like "/memory/heap/free:bytes". Name string @@ -69,12 +74,12 @@ var allDesc = []Description{ Cumulative: true, }, { - Name: "/gc/heap/allocs-by-size:objects", + Name: "/gc/heap/allocs-by-size:bytes", Description: "Distribution of all objects allocated by approximate size.", Kind: KindFloat64Histogram, }, { - Name: "/gc/heap/frees-by-size:objects", + Name: "/gc/heap/frees-by-size:bytes", Description: "Distribution of all objects freed by approximate size.", Kind: KindFloat64Histogram, }, diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go index a68184ee82..021a0bddca 100644 --- a/src/runtime/metrics/doc.go +++ b/src/runtime/metrics/doc.go @@ -61,10 +61,10 @@ Below is the full list of supported metrics, ordered lexicographically. /gc/cycles/total:gc-cycles Count of all completed GC cycles. - /gc/heap/allocs-by-size:objects + /gc/heap/allocs-by-size:bytes Distribution of all objects allocated by approximate size. - /gc/heap/frees-by-size:objects + /gc/heap/frees-by-size:bytes Distribution of all objects freed by approximate size. /gc/heap/goal:bytes diff --git a/src/runtime/metrics_test.go b/src/runtime/metrics_test.go index 5109058ed1..8a3cf019bd 100644 --- a/src/runtime/metrics_test.go +++ b/src/runtime/metrics_test.go @@ -70,7 +70,7 @@ func TestReadMetrics(t *testing.T) { checkUint64(t, name, samples[i].Value.Uint64(), mstats.BuckHashSys) case "/memory/classes/total:bytes": checkUint64(t, name, samples[i].Value.Uint64(), mstats.Sys) - case "/gc/heap/allocs-by-size:objects": + case "/gc/heap/allocs-by-size:bytes": hist := samples[i].Value.Float64Histogram() // Skip size class 0 in BySize, because it's always empty and not represented // in the histogram. @@ -84,7 +84,7 @@ func TestReadMetrics(t *testing.T) { t.Errorf("histogram counts do not much BySize for class %d: got %d, want %d", i, c, m) } } - case "/gc/heap/frees-by-size:objects": + case "/gc/heap/frees-by-size:bytes": hist := samples[i].Value.Float64Histogram() // Skip size class 0 in BySize, because it's always empty and not represented // in the histogram. @@ -161,9 +161,9 @@ func TestReadMetricsConsistency(t *testing.T) { totalVirtual.got = samples[i].Value.Uint64() case "/gc/heap/objects:objects": objects.total = samples[i].Value.Uint64() - case "/gc/heap/allocs-by-size:objects": + case "/gc/heap/allocs-by-size:bytes": objects.alloc = samples[i].Value.Float64Histogram() - case "/gc/heap/frees-by-size:objects": + case "/gc/heap/frees-by-size:bytes": objects.free = samples[i].Value.Float64Histogram() case "/gc/cycles:gc-cycles": gc.numGC = samples[i].Value.Uint64() -- cgit v1.3-5-g9baa From 8f6a9acbb3f63a77175eaa153cace5f3b6d611b2 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Fri, 8 Jan 2021 16:56:24 +0000 Subject: runtime/metrics: remove unused StopTheWorld Description field This change removes the as-of-yet unused StopTheWorld field in the Description struct. Adding a new field to a struct is much easier than removing it, so let's save it for when we actually need it. Change-Id: I8074b8569187c1a148500575fa8a661534e875d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/282632 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Trust: Michael Knyszek Reviewed-by: Michael Pratt Reviewed-by: Austin Clements --- api/go1.16.txt | 1 - src/runtime/metrics/description.go | 4 ---- 2 files changed, 5 deletions(-) (limited to 'src/runtime') diff --git a/api/go1.16.txt b/api/go1.16.txt index baac5379f8..8a8c6b8860 100644 --- a/api/go1.16.txt +++ b/api/go1.16.txt @@ -395,7 +395,6 @@ pkg runtime/metrics, type Description struct, Cumulative bool pkg runtime/metrics, type Description struct, Description string pkg runtime/metrics, type Description struct, Kind ValueKind pkg runtime/metrics, type Description struct, Name string -pkg runtime/metrics, type Description struct, StopTheWorld bool pkg runtime/metrics, type Float64Histogram struct pkg runtime/metrics, type Float64Histogram struct, Buckets []float64 pkg runtime/metrics, type Float64Histogram struct, Counts []uint64 diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go index 01c8a685ee..716802e9a2 100644 --- a/src/runtime/metrics/description.go +++ b/src/runtime/metrics/description.go @@ -46,10 +46,6 @@ type Description struct { // // This flag thus indicates whether or not it's useful to compute a rate from this value. Cumulative bool - - // StopTheWorld is whether or not the metric requires a stop-the-world - // event in order to collect it. - StopTheWorld bool } // The English language descriptions below must be kept in sync with the -- cgit v1.3-5-g9baa From 6250833911fc979a4ca5ba8b7f0612d054a3aeec Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Fri, 8 Jan 2021 17:12:50 +0000 Subject: runtime/metrics: mark histogram metrics as cumulative All the current histogram metrics accumulate counts from program start to infinity, and can be reasonably used to compute rates (also to generate windowed distributions). Change-Id: I5196c59867de34fba41bb8552606fa315460cef9 Reviewed-on: https://go-review.googlesource.com/c/go/+/282633 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Trust: Michael Knyszek Reviewed-by: Michael Pratt Reviewed-by: Austin Clements --- src/runtime/metrics/description.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/metrics/description.go b/src/runtime/metrics/description.go index 716802e9a2..1175156104 100644 --- a/src/runtime/metrics/description.go +++ b/src/runtime/metrics/description.go @@ -73,11 +73,13 @@ var allDesc = []Description{ Name: "/gc/heap/allocs-by-size:bytes", Description: "Distribution of all objects allocated by approximate size.", Kind: KindFloat64Histogram, + Cumulative: true, }, { Name: "/gc/heap/frees-by-size:bytes", Description: "Distribution of all objects freed by approximate size.", Kind: KindFloat64Histogram, + Cumulative: true, }, { Name: "/gc/heap/goal:bytes", @@ -93,6 +95,7 @@ var allDesc = []Description{ Name: "/gc/pauses:seconds", Description: "Distribution individual GC-related stop-the-world pause latencies.", Kind: KindFloat64Histogram, + Cumulative: true, }, { Name: "/memory/classes/heap/free:bytes", -- cgit v1.3-5-g9baa From 682a1d2176b02337460aeede0ff9e49429525195 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 15 Jan 2021 16:29:00 +0100 Subject: runtime: detect errors in DuplicateHandle These functions rely on DuplicateHandle succeeding, but they don't check the return value, which might be masking subtle bugs that cause other problems down the line. Updates #43720. Change-Id: I77f0e6645affa534777ffc173144a52e4afa5f81 Reviewed-on: https://go-review.googlesource.com/c/go/+/284135 Run-TryBot: Jason A. Donenfeld Reviewed-by: Alex Brainman Reviewed-by: Austin Clements Trust: Alex Brainman Trust: Jason A. Donenfeld --- src/runtime/os_windows.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index d389d38ab9..16ff285e88 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -893,7 +893,10 @@ func sigblock(exiting bool) { // Called on the new thread, cannot allocate memory. func minit() { var thandle uintptr - stdcall7(_DuplicateHandle, currentProcess, currentThread, currentProcess, uintptr(unsafe.Pointer(&thandle)), 0, 0, _DUPLICATE_SAME_ACCESS) + if stdcall7(_DuplicateHandle, currentProcess, currentThread, currentProcess, uintptr(unsafe.Pointer(&thandle)), 0, 0, _DUPLICATE_SAME_ACCESS) == 0 { + print("runtime.minit: duplicatehandle failed; errno=", getlasterror(), "\n") + throw("runtime.minit: duplicatehandle failed") + } // Configure usleep timer, if possible. var timer uintptr @@ -1134,8 +1137,12 @@ func profileloop1(param uintptr) uint32 { } // Acquire our own handle to the thread. var thread uintptr - stdcall7(_DuplicateHandle, currentProcess, mp.thread, currentProcess, uintptr(unsafe.Pointer(&thread)), 0, 0, _DUPLICATE_SAME_ACCESS) + if stdcall7(_DuplicateHandle, currentProcess, mp.thread, currentProcess, uintptr(unsafe.Pointer(&thread)), 0, 0, _DUPLICATE_SAME_ACCESS) == 0 { + print("runtime.profileloop1: duplicatehandle failed; errno=", getlasterror(), "\n") + throw("runtime.profileloop1: duplicatehandle failed") + } unlock(&mp.threadLock) + // mp may exit between the DuplicateHandle // above and the SuspendThread. The handle // will remain valid, but SuspendThread may @@ -1214,7 +1221,10 @@ func preemptM(mp *m) { return } var thread uintptr - stdcall7(_DuplicateHandle, currentProcess, mp.thread, currentProcess, uintptr(unsafe.Pointer(&thread)), 0, 0, _DUPLICATE_SAME_ACCESS) + if stdcall7(_DuplicateHandle, currentProcess, mp.thread, currentProcess, uintptr(unsafe.Pointer(&thread)), 0, 0, _DUPLICATE_SAME_ACCESS) == 0 { + print("runtime.preemptM: duplicatehandle failed; errno=", getlasterror(), "\n") + throw("runtime.preemptM: duplicatehandle failed") + } unlock(&mp.threadLock) // Prepare thread context buffer. This must be aligned to 16 bytes. -- cgit v1.3-5-g9baa From a956a0e909e1d60c8d55339e5e591a9d1db885c4 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Fri, 15 Jan 2021 14:12:35 -0800 Subject: [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames Went in a semi-automated way through the clearest renames of functions, and updated comments and error messages where it made sense. Change-Id: Ied8e152b562b705da7f52f715991a77dab60da35 Reviewed-on: https://go-review.googlesource.com/c/go/+/284216 Trust: Dan Scales Run-TryBot: Dan Scales TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/cmd/asm/internal/asm/parse.go | 2 +- src/cmd/compile/internal/base/flag.go | 2 +- src/cmd/compile/internal/base/print.go | 2 +- src/cmd/compile/internal/bitvec/bv.go | 2 +- src/cmd/compile/internal/escape/escape.go | 4 +-- src/cmd/compile/internal/gc/compile.go | 2 +- src/cmd/compile/internal/gc/main.go | 8 ++--- src/cmd/compile/internal/gc/obj.go | 2 +- src/cmd/compile/internal/inline/inl.go | 10 +++--- src/cmd/compile/internal/ir/const.go | 2 +- src/cmd/compile/internal/ir/func.go | 2 +- src/cmd/compile/internal/ir/stmt.go | 4 +-- src/cmd/compile/internal/liveness/bvset.go | 2 +- src/cmd/compile/internal/liveness/plive.go | 2 +- src/cmd/compile/internal/noder/import.go | 2 +- src/cmd/compile/internal/noder/noder.go | 8 ++--- src/cmd/compile/internal/objw/prog.go | 2 +- src/cmd/compile/internal/pkginit/init.go | 4 +-- src/cmd/compile/internal/reflectdata/alg.go | 2 +- src/cmd/compile/internal/reflectdata/reflect.go | 20 +++++------ src/cmd/compile/internal/ssagen/abi.go | 2 +- src/cmd/compile/internal/ssagen/nowb.go | 4 +-- src/cmd/compile/internal/ssagen/pgen.go | 2 +- src/cmd/compile/internal/ssagen/ssa.go | 8 ++--- src/cmd/compile/internal/staticdata/data.go | 30 ++++++++-------- src/cmd/compile/internal/staticdata/embed.go | 2 +- src/cmd/compile/internal/staticinit/sched.go | 2 +- src/cmd/compile/internal/test/abiutilsaux_test.go | 2 +- .../test/testdata/reproducible/issue38068.go | 2 +- src/cmd/compile/internal/typebits/typebits.go | 12 +++---- src/cmd/compile/internal/typecheck/const.go | 2 +- src/cmd/compile/internal/typecheck/dcl.go | 12 +++---- src/cmd/compile/internal/typecheck/expr.go | 6 ++-- src/cmd/compile/internal/typecheck/func.go | 20 +++++------ src/cmd/compile/internal/typecheck/iimport.go | 4 +-- src/cmd/compile/internal/typecheck/stmt.go | 8 ++--- src/cmd/compile/internal/typecheck/subr.go | 10 +++--- src/cmd/compile/internal/typecheck/syms.go | 4 +-- src/cmd/compile/internal/typecheck/typecheck.go | 8 ++--- src/cmd/compile/internal/types/alg.go | 4 +-- src/cmd/compile/internal/types/fmt.go | 2 +- src/cmd/compile/internal/types/size.go | 41 +++++++++++----------- src/cmd/compile/internal/types/type.go | 4 +-- src/cmd/compile/internal/walk/builtin.go | 6 ++-- src/cmd/compile/internal/walk/closure.go | 2 +- src/cmd/compile/internal/walk/compare.go | 4 +-- src/cmd/compile/internal/walk/convert.go | 4 +-- src/cmd/compile/internal/walk/expr.go | 14 ++++---- src/cmd/compile/internal/walk/order.go | 6 ++-- src/cmd/compile/internal/walk/range.go | 8 ++--- src/cmd/compile/internal/walk/select.go | 4 +-- src/cmd/compile/internal/walk/switch.go | 4 +-- src/cmd/compile/internal/walk/walk.go | 10 +++--- src/cmd/internal/goobj/mkbuiltin.go | 4 +-- src/cmd/internal/obj/textflag.go | 2 +- src/embed/embed.go | 4 +-- src/reflect/type.go | 2 +- src/runtime/runtime2.go | 2 +- src/runtime/type.go | 2 +- 59 files changed, 176 insertions(+), 177 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/asm/internal/asm/parse.go b/src/cmd/asm/internal/asm/parse.go index 154cf9c7a7..f1d37bc2c8 100644 --- a/src/cmd/asm/internal/asm/parse.go +++ b/src/cmd/asm/internal/asm/parse.go @@ -305,7 +305,7 @@ func (p *Parser) pseudo(word string, operands [][]lex.Token) bool { // references and writes symabis information to w. // // The symabis format is documented at -// cmd/compile/internal/gc.readSymABIs. +// cmd/compile/internal/ssagen.ReadSymABIs. func (p *Parser) symDefRef(w io.Writer, word string, operands [][]lex.Token) { switch word { case "TEXT": diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index d35b8452f9..c38bbe6272 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -174,7 +174,7 @@ func ParseFlags() { if (*Flag.Shared || *Flag.Dynlink || *Flag.LinkShared) && !Ctxt.Arch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.I386, sys.PPC64, sys.RISCV64, sys.S390X) { log.Fatalf("%s/%s does not support -shared", objabi.GOOS, objabi.GOARCH) } - parseSpectre(Flag.Spectre) // left as string for recordFlags + parseSpectre(Flag.Spectre) // left as string for RecordFlags Ctxt.Flag_shared = Ctxt.Flag_dynlink || Ctxt.Flag_shared Ctxt.Flag_optimize = Flag.N == 0 diff --git a/src/cmd/compile/internal/base/print.go b/src/cmd/compile/internal/base/print.go index 9855dfdad0..668c600d31 100644 --- a/src/cmd/compile/internal/base/print.go +++ b/src/cmd/compile/internal/base/print.go @@ -121,7 +121,7 @@ func ErrorfAt(pos src.XPos, format string, args ...interface{}) { lasterror.syntax = pos } else { // only one of multiple equal non-syntax errors per line - // (flusherrors shows only one of them, so we filter them + // (FlushErrors shows only one of them, so we filter them // here as best as we can (they may not appear in order) // so that we don't count them here and exit early, and // then have nothing to show for.) diff --git a/src/cmd/compile/internal/bitvec/bv.go b/src/cmd/compile/internal/bitvec/bv.go index 1e084576d1..bcac1fe351 100644 --- a/src/cmd/compile/internal/bitvec/bv.go +++ b/src/cmd/compile/internal/bitvec/bv.go @@ -37,7 +37,7 @@ func NewBulk(nbit int32, count int32) Bulk { nword := (nbit + wordBits - 1) / wordBits size := int64(nword) * int64(count) if int64(int32(size*4)) != size*4 { - base.Fatalf("bvbulkalloc too big: nbit=%d count=%d nword=%d size=%d", nbit, count, nword, size) + base.Fatalf("NewBulk too big: nbit=%d count=%d nword=%d size=%d", nbit, count, nword, size) } return Bulk{ words: make([]uint32, size), diff --git a/src/cmd/compile/internal/escape/escape.go b/src/cmd/compile/internal/escape/escape.go index 79e5a98c91..96c2e02146 100644 --- a/src/cmd/compile/internal/escape/escape.go +++ b/src/cmd/compile/internal/escape/escape.go @@ -856,7 +856,7 @@ func (e *escape) discards(l ir.Nodes) { } } -// addr evaluates an addressable expression n and returns an EscHole +// addr evaluates an addressable expression n and returns a hole // that represents storing into the represented location. func (e *escape) addr(n ir.Node) hole { if n == nil || ir.IsBlank(n) { @@ -1785,7 +1785,7 @@ func (l leaks) Encode() string { return s } -// parseLeaks parses a binary string representing an EscLeaks. +// parseLeaks parses a binary string representing a leaks func parseLeaks(s string) leaks { var l leaks if !strings.HasPrefix(s, "esc:") { diff --git a/src/cmd/compile/internal/gc/compile.go b/src/cmd/compile/internal/gc/compile.go index 6e347bf0f1..ba67c58c45 100644 --- a/src/cmd/compile/internal/gc/compile.go +++ b/src/cmd/compile/internal/gc/compile.go @@ -72,7 +72,7 @@ func enqueueFunc(fn *ir.Func) { func prepareFunc(fn *ir.Func) { // Set up the function's LSym early to avoid data races with the assemblers. // Do this before walk, as walk needs the LSym to set attributes/relocations - // (e.g. in markTypeUsedInInterface). + // (e.g. in MarkTypeUsedInInterface). ssagen.InitLSym(fn, true) // Calculate parameter offsets. diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 9ecdd510b1..e9ac243527 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -121,7 +121,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { log.Fatalf("compiler not built with support for -t") } - // Enable inlining (after recordFlags, to avoid recording the rewritten -l). For now: + // Enable inlining (after RecordFlags, to avoid recording the rewritten -l). For now: // default: inlining on. (Flag.LowerL == 1) // -l: inlining off (Flag.LowerL == 0) // -l=2, -l=3: inlining on again, with extra debugging (Flag.LowerL > 1) @@ -193,7 +193,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { typecheck.Target = new(ir.Package) typecheck.NeedITab = func(t, iface *types.Type) { reflectdata.ITabAddr(t, iface) } - typecheck.NeedRuntimeType = reflectdata.NeedRuntimeType // TODO(rsc): typenamesym for lock? + typecheck.NeedRuntimeType = reflectdata.NeedRuntimeType // TODO(rsc): TypeSym for lock? base.AutogeneratedPos = makePos(src.NewFileBase("", ""), 1, 0) @@ -261,7 +261,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { escape.Funcs(typecheck.Target.Decls) // Collect information for go:nowritebarrierrec - // checking. This must happen before transformclosure. + // checking. This must happen before transforming closures during Walk // We'll do the final check after write barriers are // inserted. if base.Flag.CompilingRuntime { @@ -269,7 +269,7 @@ func Main(archInit func(*ssagen.ArchInfo)) { } // Prepare for SSA compilation. - // This must be before peekitabs, because peekitabs + // This must be before CompileITabs, because CompileITabs // can trigger function compilation. typecheck.InitRuntime() ssagen.InitConfig() diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index 3e55b7688e..847d849666 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -121,7 +121,7 @@ func dumpdata() { reflectdata.WriteBasicTypes() dumpembeds() - // Calls to dumpsignats can generate functions, + // Calls to WriteRuntimeTypes can generate functions, // like method wrappers and hash and equality routines. // Compile any generated functions, process any new resulting types, repeat. // This can't loop forever, because there is no way to generate an infinite diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 1811feebe9..4bb849cdae 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -4,7 +4,7 @@ // // The inlining facility makes 2 passes: first caninl determines which // functions are suitable for inlining, and for those that are it -// saves a copy of the body. Then inlcalls walks each function body to +// saves a copy of the body. Then InlineCalls walks each function body to // expand calls to inlinable functions. // // The Debug.l flag controls the aggressiveness. Note that main() swaps level 0 and 1, @@ -79,7 +79,7 @@ func InlinePackage() { // fn and ->nbody will already have been typechecked. func CanInline(fn *ir.Func) { if fn.Nname == nil { - base.Fatalf("caninl no nname %+v", fn) + base.Fatalf("CanInline no nname %+v", fn) } var reason string // reason, if any, that the function was not inlined @@ -144,7 +144,7 @@ func CanInline(fn *ir.Func) { } if fn.Typecheck() == 0 { - base.Fatalf("caninl on non-typechecked function %v", fn) + base.Fatalf("CanInline on non-typechecked function %v", fn) } n := fn.Nname @@ -200,11 +200,11 @@ func Inline_Flood(n *ir.Name, exportsym func(*ir.Name)) { return } if n.Op() != ir.ONAME || n.Class != ir.PFUNC { - base.Fatalf("inlFlood: unexpected %v, %v, %v", n, n.Op(), n.Class) + base.Fatalf("Inline_Flood: unexpected %v, %v, %v", n, n.Op(), n.Class) } fn := n.Func if fn == nil { - base.Fatalf("inlFlood: missing Func on %v", n) + base.Fatalf("Inline_Flood: missing Func on %v", n) } if fn.Inl == nil { return diff --git a/src/cmd/compile/internal/ir/const.go b/src/cmd/compile/internal/ir/const.go index bfa0136232..eaa4d5b6b1 100644 --- a/src/cmd/compile/internal/ir/const.go +++ b/src/cmd/compile/internal/ir/const.go @@ -77,7 +77,7 @@ func ConstOverflow(v constant.Value, t *types.Type) bool { ft := types.FloatForComplex(t) return ConstOverflow(constant.Real(v), ft) || ConstOverflow(constant.Imag(v), ft) } - base.Fatalf("doesoverflow: %v, %v", v, t) + base.Fatalf("ConstOverflow: %v, %v", v, t) panic("unreachable") } diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go index 30cddd298e..4afdadf57b 100644 --- a/src/cmd/compile/internal/ir/func.go +++ b/src/cmd/compile/internal/ir/func.go @@ -63,7 +63,7 @@ type Func struct { Exit Nodes // ONAME nodes for all params/locals for this func/closure, does NOT - // include closurevars until transformclosure runs. + // include closurevars until transforming closures during walk. // Names must be listed PPARAMs, PPARAMOUTs, then PAUTOs, // with PPARAMs and PPARAMOUTs in order corresponding to the function signature. // However, as anonymous or blank PPARAMs are not actually declared, diff --git a/src/cmd/compile/internal/ir/stmt.go b/src/cmd/compile/internal/ir/stmt.go index b13c6b7795..4e4c0df993 100644 --- a/src/cmd/compile/internal/ir/stmt.go +++ b/src/cmd/compile/internal/ir/stmt.go @@ -343,7 +343,7 @@ type SelectStmt struct { HasBreak bool // TODO(rsc): Instead of recording here, replace with a block? - Compiled Nodes // compiled form, after walkswitch + Compiled Nodes // compiled form, after walkSwitch } func NewSelectStmt(pos src.XPos, cases []*CommClause) *SelectStmt { @@ -376,7 +376,7 @@ type SwitchStmt struct { HasBreak bool // TODO(rsc): Instead of recording here, replace with a block? - Compiled Nodes // compiled form, after walkswitch + Compiled Nodes // compiled form, after walkSwitch } func NewSwitchStmt(pos src.XPos, tag Node, cases []*CaseClause) *SwitchStmt { diff --git a/src/cmd/compile/internal/liveness/bvset.go b/src/cmd/compile/internal/liveness/bvset.go index 21bc1fee4d..3431f54ede 100644 --- a/src/cmd/compile/internal/liveness/bvset.go +++ b/src/cmd/compile/internal/liveness/bvset.go @@ -47,7 +47,7 @@ func (m *bvecSet) grow() { m.index = newIndex } -// add adds bv to the set and returns its index in m.extractUniqe. +// add adds bv to the set and returns its index in m.extractUnique. // The caller must not modify bv after this. func (m *bvecSet) add(bv bitvec.BitVec) int { if len(m.uniq)*4 >= len(m.index) { diff --git a/src/cmd/compile/internal/liveness/plive.go b/src/cmd/compile/internal/liveness/plive.go index abc9583d5a..c70db6ed18 100644 --- a/src/cmd/compile/internal/liveness/plive.go +++ b/src/cmd/compile/internal/liveness/plive.go @@ -1060,7 +1060,7 @@ func (lv *liveness) printDebug() { func (lv *liveness) emit() (argsSym, liveSym *obj.LSym) { // Size args bitmaps to be just large enough to hold the largest pointer. // First, find the largest Xoffset node we care about. - // (Nodes without pointers aren't in lv.vars; see livenessShouldTrack.) + // (Nodes without pointers aren't in lv.vars; see ShouldTrack.) var maxArgNode *ir.Name for _, n := range lv.vars { switch n.Class { diff --git a/src/cmd/compile/internal/noder/import.go b/src/cmd/compile/internal/noder/import.go index 08f19a4028..ca041a156c 100644 --- a/src/cmd/compile/internal/noder/import.go +++ b/src/cmd/compile/internal/noder/import.go @@ -418,7 +418,7 @@ func clearImports() { if types.IsDotAlias(s) { // throw away top-level name left over // from previous import . "x" - // We'll report errors after type checking in checkDotImports. + // We'll report errors after type checking in CheckDotImports. s.Def = nil continue } diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go index edd30a1fc1..99c0e4adde 100644 --- a/src/cmd/compile/internal/noder/noder.go +++ b/src/cmd/compile/internal/noder/noder.go @@ -86,7 +86,7 @@ func ParseFiles(filenames []string) uint { if base.SyntaxErrors() != 0 { base.ErrorExit() } - // Always run testdclstack here, even when debug_dclstack is not set, as a sanity measure. + // Always run CheckDclstack here, even when debug_dclstack is not set, as a sanity measure. types.CheckDclstack() } @@ -638,7 +638,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) ir.Node { } } else { f.Shortname = name - name = ir.BlankNode.Sym() // filled in by typecheckfunc + name = ir.BlankNode.Sym() // filled in by tcFunc } f.Nname = ir.NewNameAt(p.pos(fun.Name), name) @@ -1084,7 +1084,7 @@ func (p *noder) stmtsFall(stmts []syntax.Stmt, fallOK bool) []ir.Node { if s == nil { } else if s.Op() == ir.OBLOCK && len(s.(*ir.BlockStmt).List) > 0 { // Inline non-empty block. - // Empty blocks must be preserved for checkreturn. + // Empty blocks must be preserved for CheckReturn. nodes = append(nodes, s.(*ir.BlockStmt).List...) } else { nodes = append(nodes, s) @@ -1860,7 +1860,7 @@ func (p *noder) funcLit(expr *syntax.FuncLit) ir.Node { fn := ir.NewFunc(p.pos(expr)) fn.SetIsHiddenClosure(ir.CurFunc != nil) - fn.Nname = ir.NewNameAt(p.pos(expr), ir.BlankNode.Sym()) // filled in by typecheckclosure + fn.Nname = ir.NewNameAt(p.pos(expr), ir.BlankNode.Sym()) // filled in by tcClosure fn.Nname.Func = fn fn.Nname.Ntype = xtype fn.Nname.Defn = fn diff --git a/src/cmd/compile/internal/objw/prog.go b/src/cmd/compile/internal/objw/prog.go index 8d24f94aa5..b5ac4dda1e 100644 --- a/src/cmd/compile/internal/objw/prog.go +++ b/src/cmd/compile/internal/objw/prog.go @@ -205,7 +205,7 @@ func (pp *Progs) Append(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16, func (pp *Progs) SetText(fn *ir.Func) { if pp.Text != nil { - base.Fatalf("Progs.settext called twice") + base.Fatalf("Progs.SetText called twice") } ptxt := pp.Prog(obj.ATEXT) pp.Text = ptxt diff --git a/src/cmd/compile/internal/pkginit/init.go b/src/cmd/compile/internal/pkginit/init.go index 5bc66c7e1b..7cad262214 100644 --- a/src/cmd/compile/internal/pkginit/init.go +++ b/src/cmd/compile/internal/pkginit/init.go @@ -60,10 +60,10 @@ func Task() *ir.Name { fns = append(fns, fn.Linksym()) } if typecheck.InitTodoFunc.Dcl != nil { - // We only generate temps using initTodo if there + // We only generate temps using InitTodoFunc if there // are package-scope initialization statements, so // something's weird if we get here. - base.Fatalf("initTodo still has declarations") + base.Fatalf("InitTodoFunc still has declarations") } typecheck.InitTodoFunc = nil diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index d576053753..fcd824f164 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -689,7 +689,7 @@ func EqString(s, t ir.Node) (eqlen *ir.BinaryExpr, eqmem *ir.CallExpr) { // eqtab must be evaluated before eqdata, and shortcircuiting is required. func EqInterface(s, t ir.Node) (eqtab *ir.BinaryExpr, eqdata *ir.CallExpr) { if !types.Identical(s.Type(), t.Type()) { - base.Fatalf("eqinterface %v %v", s.Type(), t.Type()) + base.Fatalf("EqInterface %v %v", s.Type(), t.Type()) } // func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool) // func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool) diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go index 989bcf9ab9..efe863cc3f 100644 --- a/src/cmd/compile/internal/reflectdata/reflect.go +++ b/src/cmd/compile/internal/reflectdata/reflect.go @@ -32,7 +32,7 @@ type itabEntry struct { // symbols of each method in // the itab, sorted by byte offset; - // filled in by peekitabs + // filled in by CompileITabs entries []*obj.LSym } @@ -401,7 +401,7 @@ func dimportpath(p *types.Pkg) { } // If we are compiling the runtime package, there are two runtime packages around - // -- localpkg and Runtimepkg. We don't want to produce import path symbols for + // -- localpkg and Pkgs.Runtime. We don't want to produce import path symbols for // both of them, so just produce one for localpkg. if base.Ctxt.Pkgpath == "runtime" && p == ir.Pkgs.Runtime { return @@ -811,7 +811,7 @@ func TypeSymPrefix(prefix string, t *types.Type) *types.Sym { func TypeSym(t *types.Type) *types.Sym { if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() { - base.Fatalf("typenamesym %v", t) + base.Fatalf("TypeSym %v", t) } if t.Kind() == types.TFUNC && t.Recv() != nil { base.Fatalf("misuse of method type: %v", t) @@ -853,7 +853,7 @@ func TypePtr(t *types.Type) *ir.AddrExpr { func ITabAddr(t, itype *types.Type) *ir.AddrExpr { if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() { - base.Fatalf("itabname(%v, %v)", t, itype) + base.Fatalf("ITabAddr(%v, %v)", t, itype) } s := ir.Pkgs.Itab.Lookup(t.ShortString() + "," + itype.ShortString()) if s.Def == nil { @@ -936,7 +936,7 @@ func formalType(t *types.Type) *types.Type { func writeType(t *types.Type) *obj.LSym { t = formalType(t) if t.IsUntyped() { - base.Fatalf("dtypesym %v", t) + base.Fatalf("writeType %v", t) } s := types.TypeSym(t) @@ -1275,7 +1275,7 @@ func genfun(t, it *types.Type) []*obj.LSym { } // ITabSym uses the information gathered in -// peekitabs to de-virtualize interface methods. +// CompileITabs to de-virtualize interface methods. // Since this is called by the SSA backend, it shouldn't // generate additional Nodes, Syms, etc. func ITabSym(it *obj.LSym, offset int64) *obj.LSym { @@ -1312,7 +1312,7 @@ func NeedRuntimeType(t *types.Type) { } func WriteRuntimeTypes() { - // Process signatset. Use a loop, as dtypesym adds + // Process signatset. Use a loop, as writeType adds // entries to signatset while it is being processed. signats := make([]typeAndStr, len(signatslice)) for len(signatslice) > 0 { @@ -1617,13 +1617,13 @@ func (p *gcProg) emit(t *types.Type, offset int64) { } switch t.Kind() { default: - base.Fatalf("GCProg.emit: unexpected type %v", t) + base.Fatalf("gcProg.emit: unexpected type %v", t) case types.TSTRING: p.w.Ptr(offset / int64(types.PtrSize)) case types.TINTER: - // Note: the first word isn't a pointer. See comment in plive.go:onebitwalktype1. + // Note: the first word isn't a pointer. See comment in typebits.Set p.w.Ptr(offset/int64(types.PtrSize) + 1) case types.TSLICE: @@ -1632,7 +1632,7 @@ func (p *gcProg) emit(t *types.Type, offset int64) { case types.TARRAY: if t.NumElem() == 0 { // should have been handled by haspointers check above - base.Fatalf("GCProg.emit: empty array") + base.Fatalf("gcProg.emit: empty array") } // Flatten array-of-array-of-array to just a big array by multiplying counts. diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go index 7ff8e21a48..274c543ca5 100644 --- a/src/cmd/compile/internal/ssagen/abi.go +++ b/src/cmd/compile/internal/ssagen/abi.go @@ -154,7 +154,7 @@ func InitLSym(f *ir.Func, hasBody bool) { // makes calls to helpers to create ABI wrappers if needed. func selectLSym(f *ir.Func, hasBody bool) { if f.LSym != nil { - base.FatalfAt(f.Pos(), "Func.initLSym called twice on %v", f) + base.FatalfAt(f.Pos(), "InitLSym called twice on %v", f) } if nam := f.Nname; !ir.IsBlank(nam) { diff --git a/src/cmd/compile/internal/ssagen/nowb.go b/src/cmd/compile/internal/ssagen/nowb.go index 60cfb2f698..a2434366a0 100644 --- a/src/cmd/compile/internal/ssagen/nowb.go +++ b/src/cmd/compile/internal/ssagen/nowb.go @@ -45,7 +45,7 @@ type nowritebarrierrecCall struct { } // newNowritebarrierrecChecker creates a nowritebarrierrecChecker. It -// must be called before transformclosure and walk. +// must be called before walk func newNowritebarrierrecChecker() *nowritebarrierrecChecker { c := &nowritebarrierrecChecker{ extraCalls: make(map[*ir.Func][]nowritebarrierrecCall), @@ -54,7 +54,7 @@ func newNowritebarrierrecChecker() *nowritebarrierrecChecker { // Find all systemstack calls and record their targets. In // general, flow analysis can't see into systemstack, but it's // important to handle it for this check, so we model it - // directly. This has to happen before transformclosure since + // directly. This has to happen before transforming closures in walk since // it's a lot harder to work out the argument after. for _, n := range typecheck.Target.Decls { if n.Op() != ir.ODCLFUNC { diff --git a/src/cmd/compile/internal/ssagen/pgen.go b/src/cmd/compile/internal/ssagen/pgen.go index bbd319d735..182f8408cf 100644 --- a/src/cmd/compile/internal/ssagen/pgen.go +++ b/src/cmd/compile/internal/ssagen/pgen.go @@ -96,7 +96,7 @@ func (s *ssafn) AllocFrame(f *ssa.Func) { if n, ok := v.Aux.(*ir.Name); ok { switch n.Class { case ir.PPARAM, ir.PPARAMOUT: - // Don't modify nodfp; it is a global. + // Don't modify RegFP; it is a global. if n != ir.RegFP { n.SetUsed(true) } diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index 097cfacc23..7726ecac55 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -1508,10 +1508,10 @@ func (s *state) stmt(n ir.Node) { // Currently doesn't really work because (*p)[:len(*p)] appears here as: // tmp = len(*p) // (*p)[:tmp] - //if j != nil && (j.Op == OLEN && samesafeexpr(j.Left, n.Left)) { + //if j != nil && (j.Op == OLEN && SameSafeExpr(j.Left, n.Left)) { // j = nil //} - //if k != nil && (k.Op == OCAP && samesafeexpr(k.Left, n.Left)) { + //if k != nil && (k.Op == OCAP && SameSafeExpr(k.Left, n.Left)) { // k = nil //} if i == nil { @@ -6462,7 +6462,7 @@ func (s *State) DebugFriendlySetPosFrom(v *ssa.Value) { // in the generated code. if p.IsStmt() != src.PosIsStmt { p = p.WithNotStmt() - // Calls use the pos attached to v, but copy the statement mark from SSAGenState + // Calls use the pos attached to v, but copy the statement mark from State } s.SetPos(p) } else { @@ -7260,7 +7260,7 @@ func (e *ssafn) SplitInterface(name ssa.LocalSlot) (ssa.LocalSlot, ssa.LocalSlot if n.Type().IsEmptyInterface() { f = ".type" } - c := e.SplitSlot(&name, f, 0, u) // see comment in plive.go:onebitwalktype1. + c := e.SplitSlot(&name, f, 0, u) // see comment in typebits.Set d := e.SplitSlot(&name, ".data", u.Size(), t) return c, d } diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go index 4b12590fde..4dbc11c3c4 100644 --- a/src/cmd/compile/internal/staticdata/data.go +++ b/src/cmd/compile/internal/staticdata/data.go @@ -29,13 +29,13 @@ import ( // Neither n nor a is modified. func InitAddr(n *ir.Name, noff int64, a *ir.Name, aoff int64) { if n.Op() != ir.ONAME { - base.Fatalf("addrsym n op %v", n.Op()) + base.Fatalf("InitAddr n op %v", n.Op()) } if n.Sym() == nil { - base.Fatalf("addrsym nil n sym") + base.Fatalf("InitAddr nil n sym") } if a.Op() != ir.ONAME { - base.Fatalf("addrsym a op %v", a.Op()) + base.Fatalf("InitAddr a op %v", a.Op()) } s := n.Linksym() s.WriteAddr(base.Ctxt, noff, types.PtrSize, a.Linksym(), aoff) @@ -45,13 +45,13 @@ func InitAddr(n *ir.Name, noff int64, a *ir.Name, aoff int64) { // Neither n nor f is modified. func InitFunc(n *ir.Name, noff int64, f *ir.Name) { if n.Op() != ir.ONAME { - base.Fatalf("pfuncsym n op %v", n.Op()) + base.Fatalf("InitFunc n op %v", n.Op()) } if n.Sym() == nil { - base.Fatalf("pfuncsym nil n sym") + base.Fatalf("InitFunc nil n sym") } if f.Class != ir.PFUNC { - base.Fatalf("pfuncsym class not PFUNC %d", f.Class) + base.Fatalf("InitFunc class not PFUNC %d", f.Class) } s := n.Linksym() s.WriteAddr(base.Ctxt, noff, types.PtrSize, FuncLinksym(f), 0) @@ -62,7 +62,7 @@ func InitFunc(n *ir.Name, noff int64, f *ir.Name) { func InitSlice(n *ir.Name, noff int64, arr *ir.Name, lencap int64) { s := n.Linksym() if arr.Op() != ir.ONAME { - base.Fatalf("slicesym non-name arr %v", arr) + base.Fatalf("InitSlice non-name arr %v", arr) } s.WriteAddr(base.Ctxt, noff, types.PtrSize, arr.Linksym(), 0) s.WriteInt(base.Ctxt, noff+types.SliceLenOffset, types.PtrSize, lencap) @@ -71,7 +71,7 @@ func InitSlice(n *ir.Name, noff int64, arr *ir.Name, lencap int64) { func InitSliceBytes(nam *ir.Name, off int64, s string) { if nam.Op() != ir.ONAME { - base.Fatalf("slicebytes %v", nam) + base.Fatalf("InitSliceBytes %v", nam) } InitSlice(nam, off, slicedata(nam.Pos(), s), int64(len(s))) } @@ -243,14 +243,14 @@ func FuncSym(s *types.Sym) *types.Sym { // except for the types package, which is protected separately. // Reusing funcsymsmu to also cover this package lookup // avoids a general, broader, expensive package lookup mutex. - // Note makefuncsym also does package look-up of func sym names, + // Note NeedFuncSym also does package look-up of func sym names, // but that it is only called serially, from the front end. funcsymsmu.Lock() sf, existed := s.Pkg.LookupOK(ir.FuncSymName(s)) // Don't export s·f when compiling for dynamic linking. // When dynamically linking, the necessary function - // symbols will be created explicitly with makefuncsym. - // See the makefuncsym comment for details. + // symbols will be created explicitly with NeedFuncSym. + // See the NeedFuncSym comment for details. if !base.Ctxt.Flag_dynlink && !existed { funcsyms = append(funcsyms, s) } @@ -310,16 +310,16 @@ func WriteFuncSyms() { // Neither n nor c is modified. func InitConst(n *ir.Name, noff int64, c ir.Node, wid int) { if n.Op() != ir.ONAME { - base.Fatalf("litsym n op %v", n.Op()) + base.Fatalf("InitConst n op %v", n.Op()) } if n.Sym() == nil { - base.Fatalf("litsym nil n sym") + base.Fatalf("InitConst nil n sym") } if c.Op() == ir.ONIL { return } if c.Op() != ir.OLITERAL { - base.Fatalf("litsym c op %v", c.Op()) + base.Fatalf("InitConst c op %v", c.Op()) } s := n.Linksym() switch u := c.Val(); u.Kind() { @@ -358,6 +358,6 @@ func InitConst(n *ir.Name, noff int64, c ir.Node, wid int) { s.WriteInt(base.Ctxt, noff+int64(types.PtrSize), types.PtrSize, int64(len(i))) default: - base.Fatalf("litsym unhandled OLITERAL %v", c) + base.Fatalf("InitConst unhandled OLITERAL %v", c) } } diff --git a/src/cmd/compile/internal/staticdata/embed.go b/src/cmd/compile/internal/staticdata/embed.go index 2e551f0b2c..2e15841fe2 100644 --- a/src/cmd/compile/internal/staticdata/embed.go +++ b/src/cmd/compile/internal/staticdata/embed.go @@ -82,7 +82,7 @@ func embedKindApprox(typ ir.Node) int { // These are not guaranteed to match only string and []byte - // maybe the local package has redefined one of those words. // But it's the best we can do now during the noder. - // The stricter check happens later, in initEmbed calling embedKind. + // The stricter check happens later, in WriteEmbed calling embedKind. if typ.Sym() != nil && typ.Sym().Name == "string" && typ.Sym().Pkg == types.LocalPkg { return embedString } diff --git a/src/cmd/compile/internal/staticinit/sched.go b/src/cmd/compile/internal/staticinit/sched.go index 64946ad247..8c195742e6 100644 --- a/src/cmd/compile/internal/staticinit/sched.go +++ b/src/cmd/compile/internal/staticinit/sched.go @@ -455,7 +455,7 @@ var statuniqgen int // name generator for static temps // StaticName returns a name backed by a (writable) static data symbol. // Use readonlystaticname for read-only node. func StaticName(t *types.Type) *ir.Name { - // Don't use lookupN; it interns the resulting string, but these are all unique. + // Don't use LookupNum; it interns the resulting string, but these are all unique. n := typecheck.NewName(typecheck.Lookup(fmt.Sprintf("%s%d", obj.StaticNamePref, statuniqgen))) statuniqgen++ typecheck.Declare(n, ir.PEXTERN) diff --git a/src/cmd/compile/internal/test/abiutilsaux_test.go b/src/cmd/compile/internal/test/abiutilsaux_test.go index 7b84e73947..10fb668745 100644 --- a/src/cmd/compile/internal/test/abiutilsaux_test.go +++ b/src/cmd/compile/internal/test/abiutilsaux_test.go @@ -127,7 +127,7 @@ func abitest(t *testing.T, ft *types.Type, exp expectedDump) { emptyResString := emptyRes.String() // Walk the results and make sure the offsets assigned match - // up with those assiged by dowidth. This checks to make sure that + // up with those assiged by CalcSize. This checks to make sure that // when we have no available registers the ABI assignment degenerates // back to the original ABI0. diff --git a/src/cmd/compile/internal/test/testdata/reproducible/issue38068.go b/src/cmd/compile/internal/test/testdata/reproducible/issue38068.go index db5ca7dcbe..b87daed8e9 100644 --- a/src/cmd/compile/internal/test/testdata/reproducible/issue38068.go +++ b/src/cmd/compile/internal/test/testdata/reproducible/issue38068.go @@ -53,7 +53,7 @@ func G(x *A, n int) { return } // Address-taken local of type A, which will insure that the - // compiler's dtypesym() routine will create a method wrapper. + // compiler's writeType() routine will create a method wrapper. var a, b A a.next = x a.prev = &b diff --git a/src/cmd/compile/internal/typebits/typebits.go b/src/cmd/compile/internal/typebits/typebits.go index 63a2bb3ffa..1c1b077423 100644 --- a/src/cmd/compile/internal/typebits/typebits.go +++ b/src/cmd/compile/internal/typebits/typebits.go @@ -15,7 +15,7 @@ import ( // on future calls with the same type t. func Set(t *types.Type, off int64, bv bitvec.BitVec) { if t.Align > 0 && off&int64(t.Align-1) != 0 { - base.Fatalf("onebitwalktype1: invalid initial alignment: type %v has alignment %d, but offset is %v", t, t.Align, off) + base.Fatalf("typebits.Set: invalid initial alignment: type %v has alignment %d, but offset is %v", t, t.Align, off) } if !t.HasPointers() { // Note: this case ensures that pointers to go:notinheap types @@ -26,14 +26,14 @@ func Set(t *types.Type, off int64, bv bitvec.BitVec) { switch t.Kind() { case types.TPTR, types.TUNSAFEPTR, types.TFUNC, types.TCHAN, types.TMAP: if off&int64(types.PtrSize-1) != 0 { - base.Fatalf("onebitwalktype1: invalid alignment, %v", t) + base.Fatalf("typebits.Set: invalid alignment, %v", t) } bv.Set(int32(off / int64(types.PtrSize))) // pointer case types.TSTRING: // struct { byte *str; intgo len; } if off&int64(types.PtrSize-1) != 0 { - base.Fatalf("onebitwalktype1: invalid alignment, %v", t) + base.Fatalf("typebits.Set: invalid alignment, %v", t) } bv.Set(int32(off / int64(types.PtrSize))) //pointer in first slot @@ -42,7 +42,7 @@ func Set(t *types.Type, off int64, bv bitvec.BitVec) { // or, when isnilinter(t)==true: // struct { Type *type; void *data; } if off&int64(types.PtrSize-1) != 0 { - base.Fatalf("onebitwalktype1: invalid alignment, %v", t) + base.Fatalf("typebits.Set: invalid alignment, %v", t) } // The first word of an interface is a pointer, but we don't // treat it as such. @@ -61,7 +61,7 @@ func Set(t *types.Type, off int64, bv bitvec.BitVec) { case types.TSLICE: // struct { byte *array; uintgo len; uintgo cap; } if off&int64(types.PtrSize-1) != 0 { - base.Fatalf("onebitwalktype1: invalid TARRAY alignment, %v", t) + base.Fatalf("typebits.Set: invalid TARRAY alignment, %v", t) } bv.Set(int32(off / int64(types.PtrSize))) // pointer in first slot (BitsPointer) @@ -82,6 +82,6 @@ func Set(t *types.Type, off int64, bv bitvec.BitVec) { } default: - base.Fatalf("onebitwalktype1: unexpected type, %v", t) + base.Fatalf("typebits.Set: unexpected type, %v", t) } } diff --git a/src/cmd/compile/internal/typecheck/const.go b/src/cmd/compile/internal/typecheck/const.go index d6bf101974..1a8e58383a 100644 --- a/src/cmd/compile/internal/typecheck/const.go +++ b/src/cmd/compile/internal/typecheck/const.go @@ -623,7 +623,7 @@ func OrigInt(n ir.Node, v int64) ir.Node { return OrigConst(n, constant.MakeInt64(v)) } -// defaultlit on both nodes simultaneously; +// DefaultLit on both nodes simultaneously; // if they're both ideal going in they better // get the same type going out. // force means must assign concrete (non-ideal) type. diff --git a/src/cmd/compile/internal/typecheck/dcl.go b/src/cmd/compile/internal/typecheck/dcl.go index c7d7506fd1..c324238bf1 100644 --- a/src/cmd/compile/internal/typecheck/dcl.go +++ b/src/cmd/compile/internal/typecheck/dcl.go @@ -41,7 +41,7 @@ func Declare(n *ir.Name, ctxt ir.Class) { s := n.Sym() - // kludgy: typecheckok means we're past parsing. Eg genwrapper may declare out of package names later. + // kludgy: TypecheckAllowed means we're past parsing. Eg reflectdata.methodWrapper may declare out of package names later. if !inimport && !TypecheckAllowed && s.Pkg != types.LocalPkg { base.ErrorfAt(n.Pos(), "cannot declare name %v", s) } @@ -308,7 +308,7 @@ func fakeRecvField() *types.Field { return types.NewField(src.NoXPos, nil, types.FakeRecvType()) } -var funcStack []funcStackEnt // stack of previous values of Curfn/dclcontext +var funcStack []funcStackEnt // stack of previous values of ir.CurFunc/DeclContext type funcStackEnt struct { curfn *ir.Func @@ -398,14 +398,14 @@ func Temp(t *types.Type) *ir.Name { // make a new Node off the books func TempAt(pos src.XPos, curfn *ir.Func, t *types.Type) *ir.Name { if curfn == nil { - base.Fatalf("no curfn for tempAt") + base.Fatalf("no curfn for TempAt") } if curfn.Op() == ir.OCLOSURE { - ir.Dump("tempAt", curfn) - base.Fatalf("adding tempAt to wrong closure function") + ir.Dump("TempAt", curfn) + base.Fatalf("adding TempAt to wrong closure function") } if t == nil { - base.Fatalf("tempAt called with nil type") + base.Fatalf("TempAt called with nil type") } if t.Kind() == types.TFUNC && t.Recv() != nil { base.Fatalf("misuse of method type: %v", t) diff --git a/src/cmd/compile/internal/typecheck/expr.go b/src/cmd/compile/internal/typecheck/expr.go index 12bfae67a8..339fb00aa4 100644 --- a/src/cmd/compile/internal/typecheck/expr.go +++ b/src/cmd/compile/internal/typecheck/expr.go @@ -68,7 +68,7 @@ func tcShift(n, l, r ir.Node) (ir.Node, ir.Node, *types.Type) { return l, r, nil } - // no defaultlit for left + // no DefaultLit for left // the outer context gives the type t = l.Type() if (l.Type() == types.UntypedFloat || l.Type() == types.UntypedComplex) && r.Op() == ir.OLITERAL { @@ -201,7 +201,7 @@ func tcArith(n ir.Node, op ir.Op, l, r ir.Node) (ir.Node, ir.Node, *types.Type) // n.Left = tcCompLit(n.Left) func tcCompLit(n *ir.CompLitExpr) (res ir.Node) { if base.EnableTrace && base.Flag.LowerT { - defer tracePrint("typecheckcomplit", n)(&res) + defer tracePrint("tcCompLit", n)(&res) } lno := base.Pos @@ -838,7 +838,7 @@ func tcStar(n *ir.StarExpr, top int) ir.Node { } if l.Op() == ir.OTYPE { n.SetOTYPE(types.NewPtr(l.Type())) - // Ensure l.Type gets dowidth'd for the backend. Issue 20174. + // Ensure l.Type gets CalcSize'd for the backend. Issue 20174. types.CheckSize(l.Type()) return n } diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go index 03a10f594a..c832d9700f 100644 --- a/src/cmd/compile/internal/typecheck/func.go +++ b/src/cmd/compile/internal/typecheck/func.go @@ -100,7 +100,7 @@ func PartialCallType(n *ir.SelectorExpr) *types.Type { return t } -// Lazy typechecking of imported bodies. For local functions, caninl will set ->typecheck +// Lazy typechecking of imported bodies. For local functions, CanInline will set ->typecheck // because they're a copy of an already checked body. func ImportedBody(fn *ir.Func) { lno := ir.SetPos(fn.Nname) @@ -122,14 +122,14 @@ func ImportedBody(fn *ir.Func) { ImportBody(fn) - // typecheckinl is only for imported functions; + // Stmts(fn.Inl.Body) below is only for imported functions; // their bodies may refer to unsafe as long as the package // was marked safe during import (which was checked then). - // the ->inl of a local function has been typechecked before caninl copied it. + // the ->inl of a local function has been typechecked before CanInline copied it. pkg := fnpkg(fn.Nname) if pkg == types.LocalPkg || pkg == nil { - return // typecheckinl on local function + return // ImportedBody on local function } if base.Flag.LowerM > 2 || base.Debug.Export != 0 { @@ -141,10 +141,10 @@ func ImportedBody(fn *ir.Func) { Stmts(fn.Inl.Body) ir.CurFunc = savefn - // During expandInline (which imports fn.Func.Inl.Body), - // declarations are added to fn.Func.Dcl by funcHdr(). Move them + // During ImportBody (which imports fn.Func.Inl.Body), + // declarations are added to fn.Func.Dcl by funcBody(). Move them // to fn.Func.Inl.Dcl for consistency with how local functions - // behave. (Append because typecheckinl may be called multiple + // behave. (Append because ImportedBody may be called multiple // times.) fn.Inl.Dcl = append(fn.Inl.Dcl, fn.Dcl...) fn.Dcl = nil @@ -296,7 +296,7 @@ func tcClosure(clo *ir.ClosureExpr, top int) { fn.SetClosureCalled(top&ctxCallee != 0) // Do not typecheck fn twice, otherwise, we will end up pushing - // fn to Target.Decls multiple times, causing initLSym called twice. + // fn to Target.Decls multiple times, causing InitLSym called twice. // See #30709 if fn.Typecheck() == 1 { clo.SetType(fn.Type()) @@ -343,10 +343,10 @@ func tcClosure(clo *ir.ClosureExpr, top int) { // type check function definition // To be called by typecheck, not directly. -// (Call typecheckFunc instead.) +// (Call typecheck.Func instead.) func tcFunc(n *ir.Func) { if base.EnableTrace && base.Flag.LowerT { - defer tracePrint("typecheckfunc", n)(nil) + defer tracePrint("tcFunc", n)(nil) } n.Nname = AssignExpr(n.Nname).(*ir.Name) diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go index 396d09263a..c2610229ec 100644 --- a/src/cmd/compile/internal/typecheck/iimport.go +++ b/src/cmd/compile/internal/typecheck/iimport.go @@ -37,7 +37,7 @@ var ( // and offset where that identifier's declaration can be read. DeclImporter = map[*types.Sym]iimporterAndOffset{} - // inlineImporter is like declImporter, but for inline bodies + // inlineImporter is like DeclImporter, but for inline bodies // for function and method symbols. inlineImporter = map[*types.Sym]iimporterAndOffset{} ) @@ -334,7 +334,7 @@ func (r *importReader) doDecl(sym *types.Sym) *ir.Name { recv := r.param() mtyp := r.signature(recv) - // methodSym already marked m.Sym as a function. + // MethodSym already marked m.Sym as a function. m := ir.NewNameAt(mpos, ir.MethodSym(recv.Type, msym)) m.Class = ir.PFUNC m.SetType(mtyp) diff --git a/src/cmd/compile/internal/typecheck/stmt.go b/src/cmd/compile/internal/typecheck/stmt.go index 8baa5dda78..14ed175be9 100644 --- a/src/cmd/compile/internal/typecheck/stmt.go +++ b/src/cmd/compile/internal/typecheck/stmt.go @@ -25,7 +25,7 @@ func typecheckrangeExpr(n *ir.RangeStmt) { } t := RangeExprType(n.X.Type()) - // delicate little dance. see typecheckas2 + // delicate little dance. see tcAssignList if n.Key != nil && !ir.DeclaredBy(n.Key, n) { n.Key = AssignExpr(n.Key) } @@ -90,7 +90,7 @@ func typecheckrangeExpr(n *ir.RangeStmt) { // fill in the var's type. func tcAssign(n *ir.AssignStmt) { if base.EnableTrace && base.Flag.LowerT { - defer tracePrint("typecheckas", n)(nil) + defer tracePrint("tcAssign", n)(nil) } if n.Y == nil { @@ -110,7 +110,7 @@ func tcAssign(n *ir.AssignStmt) { func tcAssignList(n *ir.AssignListStmt) { if base.EnableTrace && base.Flag.LowerT { - defer tracePrint("typecheckas2", n)(nil) + defer tracePrint("tcAssignList", n)(nil) } assign(n, n.Lhs, n.Rhs) @@ -119,7 +119,7 @@ func tcAssignList(n *ir.AssignListStmt) { func assign(stmt ir.Node, lhs, rhs []ir.Node) { // delicate little dance. // the definition of lhs may refer to this assignment - // as its definition, in which case it will call typecheckas. + // as its definition, in which case it will call tcAssign. // in that case, do not call typecheck back, or it will cycle. // if the variable has a type (ntype) then typechecking // will not look at defn, so it is okay (and desirable, diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go index 569075d684..b6a0870672 100644 --- a/src/cmd/compile/internal/typecheck/subr.go +++ b/src/cmd/compile/internal/typecheck/subr.go @@ -81,7 +81,7 @@ func markAddrOf(n ir.Node) ir.Node { // main typecheck has completed. // The argument to OADDR needs to be typechecked because &x[i] takes // the address of x if x is an array, but not if x is a slice. - // Note: outervalue doesn't work correctly until n is typechecked. + // Note: OuterValue doesn't work correctly until n is typechecked. n = typecheck(n, ctxExpr) if x := ir.OuterValue(n); x.Op() == ir.ONAME { x.Name().SetAddrtaken(true) @@ -368,10 +368,10 @@ func assignop(src, dst *types.Type) (ir.Op, string) { var missing, have *types.Field var ptr int if implements(src, dst, &missing, &have, &ptr) { - // Call itabname so that (src, dst) + // Call NeedITab/ITabAddr so that (src, dst) // gets added to itabs early, which allows // us to de-virtualize calls through this - // type/interface pair later. See peekitabs in reflect.go + // type/interface pair later. See CompileITabs in reflect.go if types.IsDirectIface(src) && !dst.IsEmptyInterface() { NeedITab(src, dst) } @@ -441,7 +441,7 @@ func assignop(src, dst *types.Type) (ir.Op, string) { } } - // 6. rule about untyped constants - already converted by defaultlit. + // 6. rule about untyped constants - already converted by DefaultLit. // 7. Any typed value can be assigned to the blank identifier. if dst.Kind() == types.TBLANK { @@ -835,7 +835,7 @@ func lookdot0(s *types.Sym, t *types.Type, save **types.Field, ignorecase bool) var slist []symlink // Code to help generate trampoline functions for methods on embedded -// types. These are approx the same as the corresponding adddot +// types. These are approx the same as the corresponding AddImplicitDots // routines except that they expect to be called with unique tasks and // they return the actual methods. diff --git a/src/cmd/compile/internal/typecheck/syms.go b/src/cmd/compile/internal/typecheck/syms.go index 28db40db91..f6ff2ee5da 100644 --- a/src/cmd/compile/internal/typecheck/syms.go +++ b/src/cmd/compile/internal/typecheck/syms.go @@ -15,7 +15,7 @@ import ( func LookupRuntime(name string) *ir.Name { s := ir.Pkgs.Runtime.Lookup(name) if s == nil || s.Def == nil { - base.Fatalf("syslook: can't find runtime.%s", name) + base.Fatalf("LookupRuntime: can't find runtime.%s", name) } return ir.AsNode(s.Def).(*ir.Name) } @@ -33,7 +33,7 @@ func SubstArgTypes(old *ir.Name, types_ ...*types.Type) *ir.Name { n.Class = old.Class n.SetType(types.SubstAny(old.Type(), &types_)) if len(types_) > 0 { - base.Fatalf("substArgTypes: too many argument types") + base.Fatalf("SubstArgTypes: too many argument types") } return n } diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go index 814af59772..3530e76972 100644 --- a/src/cmd/compile/internal/typecheck/typecheck.go +++ b/src/cmd/compile/internal/typecheck/typecheck.go @@ -456,7 +456,7 @@ func typecheck(n ir.Node, top int) (res ir.Node) { } // indexlit implements typechecking of untyped values as -// array/slice indexes. It is almost equivalent to defaultlit +// array/slice indexes. It is almost equivalent to DefaultLit // but also accepts untyped numeric values representable as // value of type int (see also checkmake for comparison). // The result of indexlit MUST be assigned back to n, e.g. @@ -938,7 +938,7 @@ func typecheckargs(n ir.InitNode) { // If we're outside of function context, then this call will // be executed during the generated init function. However, // init.go hasn't yet created it. Instead, associate the - // temporary variables with initTodo for now, and init.go + // temporary variables with InitTodoFunc for now, and init.go // will reassociate them later when it's appropriate. static := ir.CurFunc == nil if static { @@ -1890,7 +1890,7 @@ func checkmake(t *types.Type, arg string, np *ir.Node) bool { return false } - // Do range checks for constants before defaultlit + // Do range checks for constants before DefaultLit // to avoid redundant "constant NNN overflows int" errors. if n.Op() == ir.OLITERAL { v := toint(n.Val()) @@ -1904,7 +1904,7 @@ func checkmake(t *types.Type, arg string, np *ir.Node) bool { } } - // defaultlit is necessary for non-constants too: n might be 1.1<ninit when walking n, // because we might replace n with some other node // and would lose the init list. - base.Fatalf("walkexpr init == &n->ninit") + base.Fatalf("walkExpr init == &n->ninit") } if len(n.Init()) != 0 { @@ -81,7 +81,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node { switch n.Op() { default: ir.Dump("walk", n) - base.Fatalf("walkexpr: switch 1 unknown op %+v", n.Op()) + base.Fatalf("walkExpr: switch 1 unknown op %+v", n.Op()) panic("unreachable") case ir.ONONAME, ir.OGETG: @@ -91,7 +91,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node { // TODO(mdempsky): Just return n; see discussion on CL 38655. // Perhaps refactor to use Node.mayBeShared for these instead. // If these return early, make sure to still call - // stringsym for constant strings. + // StringSym for constant strings. return n case ir.OMETHEXPR: @@ -221,7 +221,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node { return walkIndexMap(n, init) case ir.ORECV: - base.Fatalf("walkexpr ORECV") // should see inside OAS only + base.Fatalf("walkExpr ORECV") // should see inside OAS only panic("unreachable") case ir.OSLICEHEADER: @@ -413,7 +413,7 @@ func safeExpr(n ir.Node, init *ir.Nodes) ir.Node { // make a copy; must not be used as an lvalue if ir.IsAddressable(n) { - base.Fatalf("missing lvalue case in safeexpr: %v", n) + base.Fatalf("missing lvalue case in safeExpr: %v", n) } return cheapExpr(n, init) } @@ -428,7 +428,7 @@ func walkAddString(n *ir.AddStringExpr, init *ir.Nodes) ir.Node { c := len(n.List) if c < 2 { - base.Fatalf("addstr count %d too small", c) + base.Fatalf("walkAddString count %d too small", c) } buf := typecheck.NodNil() @@ -534,7 +534,7 @@ func walkCall1(n *ir.CallExpr, init *ir.Nodes) { // Determine param type. t := params.Field(i).Type if base.Flag.Cfg.Instrumenting || fncall(arg, t) { - // make assignment of fncall to tempAt + // make assignment of fncall to Temp tmp := typecheck.Temp(t) a := convas(ir.NewAssignStmt(base.Pos, tmp, arg), init) tempAssigns = append(tempAssigns, a) diff --git a/src/cmd/compile/internal/walk/order.go b/src/cmd/compile/internal/walk/order.go index 38a9bec6e3..78063c4db2 100644 --- a/src/cmd/compile/internal/walk/order.go +++ b/src/cmd/compile/internal/walk/order.go @@ -849,7 +849,7 @@ func (o *orderState) stmt(n ir.Node) { n.X = o.copyExpr(r) // n.Prealloc is the temp for the iterator. - // hiter contains pointers and needs to be zeroed. + // MapIterType contains pointers and needs to be zeroed. n.Prealloc = o.newTemp(reflectdata.MapIterType(xt), true) } n.Key = o.exprInPlace(n.Key) @@ -962,7 +962,7 @@ func (o *orderState) stmt(n ir.Node) { cas.Body.Prepend(o.cleanTempNoPop(t)...) // TODO(mdempsky): Is this actually necessary? - // walkselect appears to walk Ninit. + // walkSelect appears to walk Ninit. cas.Body.Prepend(ir.TakeInit(cas)...) } @@ -986,7 +986,7 @@ func (o *orderState) stmt(n ir.Node) { o.cleanTemp(t) // TODO(rsc): Clean temporaries more aggressively. - // Note that because walkswitch will rewrite some of the + // Note that because walkSwitch will rewrite some of the // switch into a binary search, this is not as easy as it looks. // (If we ran that code here we could invoke order.stmt on // the if-else chain instead.) diff --git a/src/cmd/compile/internal/walk/range.go b/src/cmd/compile/internal/walk/range.go index 9225c429f0..2b28e7442d 100644 --- a/src/cmd/compile/internal/walk/range.go +++ b/src/cmd/compile/internal/walk/range.go @@ -71,7 +71,7 @@ func walkRange(nrange *ir.RangeStmt) ir.Node { } if v1 == nil && v2 != nil { - base.Fatalf("walkrange: v2 != nil while v1 == nil") + base.Fatalf("walkRange: v2 != nil while v1 == nil") } var ifGuard *ir.IfStmt @@ -80,7 +80,7 @@ func walkRange(nrange *ir.RangeStmt) ir.Node { var init []ir.Node switch t.Kind() { default: - base.Fatalf("walkrange") + base.Fatalf("walkRange") case types.TARRAY, types.TSLICE: if nn := arrayClear(nrange, v1, v2, a); nn != nil { @@ -168,7 +168,7 @@ func walkRange(nrange *ir.RangeStmt) ir.Node { hit := nrange.Prealloc th := hit.Type() - keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:hiter + keysym := th.Field(0).Sym // depends on layout of iterator struct. See reflect.go:MapIterType elemsym := th.Field(1).Sym // ditto fn := typecheck.LookupRuntime("mapiterinit") @@ -388,7 +388,7 @@ func mapClear(m ir.Node) ir.Node { // // in which the evaluation of a is side-effect-free. // -// Parameters are as in walkrange: "for v1, v2 = range a". +// Parameters are as in walkRange: "for v1, v2 = range a". func arrayClear(loop *ir.RangeStmt, v1, v2, a ir.Node) ir.Node { if base.Flag.N != 0 || base.Flag.Cfg.Instrumenting { return nil diff --git a/src/cmd/compile/internal/walk/select.go b/src/cmd/compile/internal/walk/select.go index 776b020155..56ba0fa758 100644 --- a/src/cmd/compile/internal/walk/select.go +++ b/src/cmd/compile/internal/walk/select.go @@ -14,7 +14,7 @@ import ( func walkSelect(sel *ir.SelectStmt) { lno := ir.SetPos(sel) if len(sel.Compiled) != 0 { - base.Fatalf("double walkselect") + base.Fatalf("double walkSelect") } init := ir.TakeInit(sel) @@ -218,7 +218,7 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node { } } if nsends+nrecvs != ncas { - base.Fatalf("walkselectcases: miscount: %v + %v != %v", nsends, nrecvs, ncas) + base.Fatalf("walkSelectCases: miscount: %v + %v != %v", nsends, nrecvs, ncas) } // run the select diff --git a/src/cmd/compile/internal/walk/switch.go b/src/cmd/compile/internal/walk/switch.go index 0cc1830d3f..162de018f6 100644 --- a/src/cmd/compile/internal/walk/switch.go +++ b/src/cmd/compile/internal/walk/switch.go @@ -49,8 +49,8 @@ func walkSwitchExpr(sw *ir.SwitchStmt) { // Given "switch string(byteslice)", // with all cases being side-effect free, // use a zero-cost alias of the byte slice. - // Do this before calling walkexpr on cond, - // because walkexpr will lower the string + // Do this before calling walkExpr on cond, + // because walkExpr will lower the string // conversion into a runtime call. // See issue 24937 for more discussion. if cond.Op() == ir.OBYTES2STR && allCaseExprsAreSideEffectFree(sw) { diff --git a/src/cmd/compile/internal/walk/walk.go b/src/cmd/compile/internal/walk/walk.go index 4ba81b82fe..f95440d60d 100644 --- a/src/cmd/compile/internal/walk/walk.go +++ b/src/cmd/compile/internal/walk/walk.go @@ -208,7 +208,7 @@ func mapfast(t *types.Type) int { func walkAppendArgs(n *ir.CallExpr, init *ir.Nodes) { walkExprListSafe(n.Args, init) - // walkexprlistsafe will leave OINDEX (s[n]) alone if both s + // walkExprListSafe will leave OINDEX (s[n]) alone if both s // and n are name or literal, but those may index the slice we're // modifying here. Fix explicitly. ls := n.Args @@ -240,8 +240,8 @@ func appendWalkStmt(init *ir.Nodes, stmt ir.Node) { op := stmt.Op() n := typecheck.Stmt(stmt) if op == ir.OAS || op == ir.OAS2 { - // If the assignment has side effects, walkexpr will append them - // directly to init for us, while walkstmt will wrap it in an OBLOCK. + // If the assignment has side effects, walkExpr will append them + // directly to init for us, while walkStmt will wrap it in an OBLOCK. // We need to append them directly. // TODO(rsc): Clean this up. n = walkExpr(n, init) @@ -256,7 +256,7 @@ func appendWalkStmt(init *ir.Nodes, stmt ir.Node) { const maxOpenDefers = 8 // backingArrayPtrLen extracts the pointer and length from a slice or string. -// This constructs two nodes referring to n, so n must be a cheapexpr. +// This constructs two nodes referring to n, so n must be a cheapExpr. func backingArrayPtrLen(n ir.Node) (ptr, length ir.Node) { var init ir.Nodes c := cheapExpr(n, &init) @@ -423,7 +423,7 @@ func runtimeField(name string, offset int64, typ *types.Type) *types.Field { // ifaceData loads the data field from an interface. // The concrete type must be known to have type t. -// It follows the pointer if !isdirectiface(t). +// It follows the pointer if !IsDirectIface(t). func ifaceData(pos src.XPos, n ir.Node, t *types.Type) ir.Node { if t.IsInterface() { base.Fatalf("ifaceData interface: %v", t) diff --git a/src/cmd/internal/goobj/mkbuiltin.go b/src/cmd/internal/goobj/mkbuiltin.go index 07c3406681..22608e7e69 100644 --- a/src/cmd/internal/goobj/mkbuiltin.go +++ b/src/cmd/internal/goobj/mkbuiltin.go @@ -118,8 +118,8 @@ func mkbuiltin(w io.Writer) { // addBasicTypes returns the symbol names for basic types that are // defined in the runtime and referenced in other packages. -// Needs to be kept in sync with reflect.go:dumpbasictypes() and -// reflect.go:dtypesym() in the compiler. +// Needs to be kept in sync with reflect.go:WriteBasicTypes() and +// reflect.go:writeType() in the compiler. func enumerateBasicTypes() []extra { names := [...]string{ "int8", "uint8", "int16", "uint16", diff --git a/src/cmd/internal/obj/textflag.go b/src/cmd/internal/obj/textflag.go index fcc4014aa2..2f55793285 100644 --- a/src/cmd/internal/obj/textflag.go +++ b/src/cmd/internal/obj/textflag.go @@ -33,7 +33,7 @@ const ( // This function uses its incoming context register. NEEDCTXT = 64 - // When passed to ggloblsym, causes Local to be set to true on the LSym it creates. + // When passed to objw.Global, causes Local to be set to true on the LSym it creates. LOCAL = 128 // Allocate a word of thread local storage and store the offset from the diff --git a/src/embed/embed.go b/src/embed/embed.go index 29e0adf1a6..5f35cd13b6 100644 --- a/src/embed/embed.go +++ b/src/embed/embed.go @@ -133,7 +133,7 @@ import ( // See the package documentation for more details about initializing an FS. type FS struct { // The compiler knows the layout of this struct. - // See cmd/compile/internal/gc's initEmbed. + // See cmd/compile/internal/staticdata's WriteEmbed. // // The files list is sorted by name but not by simple string comparison. // Instead, each file's name takes the form "dir/elem" or "dir/elem/". @@ -203,7 +203,7 @@ var ( // It implements fs.FileInfo and fs.DirEntry. type file struct { // The compiler knows the layout of this struct. - // See cmd/compile/internal/gc's initEmbed. + // See cmd/compile/internal/staticdata's WriteEmbed. name string data string hash [16]byte // truncated SHA256 hash diff --git a/src/reflect/type.go b/src/reflect/type.go index 1f1e70d485..13e3d71228 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -1890,7 +1890,7 @@ func MapOf(key, elem Type) Type { // Make a map type. // Note: flag values must match those used in the TMAP case - // in ../cmd/compile/internal/gc/reflect.go:dtypesym. + // in ../cmd/compile/internal/gc/reflect.go:writeType. var imap interface{} = (map[unsafe.Pointer]unsafe.Pointer)(nil) mt := **(**mapType)(unsafe.Pointer(&imap)) mt.str = resolveReflectName(newName(s, "", false)) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index c9376827da..9c3ceabd18 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -853,7 +853,7 @@ type funcinl struct { // layout of Itab known to compilers // allocated in non-garbage-collected memory // Needs to be in sync with -// ../cmd/compile/internal/gc/reflect.go:/^func.dumptabs. +// ../cmd/compile/internal/gc/reflect.go:/^func.WriteTabs. type itab struct { inter *interfacetype _type *_type diff --git a/src/runtime/type.go b/src/runtime/type.go index 81455f3532..18fc4bbfad 100644 --- a/src/runtime/type.go +++ b/src/runtime/type.go @@ -383,7 +383,7 @@ type maptype struct { } // Note: flag values must match those used in the TMAP case -// in ../cmd/compile/internal/gc/reflect.go:dtypesym. +// in ../cmd/compile/internal/gc/reflect.go:writeType. func (mt *maptype) indirectkey() bool { // store ptr to key instead of key itself return mt.flags&1 != 0 } -- cgit v1.3-5-g9baa From dbab07983596c705d2ef12806e0f9d630063e571 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 15 Jan 2021 13:01:37 +0100 Subject: runtime: free Windows event handles after last lock is dropped Calls to lock may need to use global members of mOS that also need to be cleaned up before the thread exits. Before this commit, these resources would leak. Moving them to be cleaned up in unminit, however, would race with gstack on unix. So this creates a new helper, mdestroy, to release resources that must be destroyed only after locks are no longer required. We also move highResTimer lifetime to the same semantics, since it doesn't help to constantly acquire and release the timer object during dropm. Updates #43720. Change-Id: Ib3f598f3fda1b2bbcb608099616fa4f85bc1c289 Reviewed-on: https://go-review.googlesource.com/c/go/+/284137 Run-TryBot: Jason A. Donenfeld TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor Reviewed-by: Austin Clements Trust: Alex Brainman Trust: Jason A. Donenfeld --- src/runtime/os3_solaris.go | 5 +++++ src/runtime/os_aix.go | 5 +++++ src/runtime/os_darwin.go | 5 +++++ src/runtime/os_dragonfly.go | 5 +++++ src/runtime/os_freebsd.go | 5 +++++ src/runtime/os_js.go | 5 +++++ src/runtime/os_linux.go | 5 +++++ src/runtime/os_netbsd.go | 5 +++++ src/runtime/os_openbsd.go | 5 +++++ src/runtime/os_plan9.go | 5 +++++ src/runtime/os_windows.go | 38 ++++++++++++++++++++++++++------------ src/runtime/proc.go | 4 ++++ 12 files changed, 80 insertions(+), 12 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index d6e36fbfbb..6ba11afd93 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -227,6 +227,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func sigtramp() //go:nosplit diff --git a/src/runtime/os_aix.go b/src/runtime/os_aix.go index 0c501be96a..303f0876de 100644 --- a/src/runtime/os_aix.go +++ b/src/runtime/os_aix.go @@ -180,6 +180,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + // tstart is a function descriptor to _tstart defined in assembly. var tstart funcDescriptor diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index e0a43c28aa..9ca17c20df 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -325,6 +325,11 @@ func unminit() { } } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + //go:nosplit func osyield() { usleep(1) diff --git a/src/runtime/os_dragonfly.go b/src/runtime/os_dragonfly.go index 6578fcbeb1..383df54bd4 100644 --- a/src/runtime/os_dragonfly.go +++ b/src/runtime/os_dragonfly.go @@ -203,6 +203,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func sigtramp() type sigactiont struct { diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go index 1c60ee2a57..09065ccb68 100644 --- a/src/runtime/os_freebsd.go +++ b/src/runtime/os_freebsd.go @@ -319,6 +319,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func sigtramp() type sigactiont struct { diff --git a/src/runtime/os_js.go b/src/runtime/os_js.go index 91d18a078f..24261e88a2 100644 --- a/src/runtime/os_js.go +++ b/src/runtime/os_js.go @@ -84,6 +84,11 @@ func minit() { func unminit() { } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func osinit() { ncpu = 1 getg().m.procid = 2 diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index f122d2c2ef..058c7daf9c 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -375,6 +375,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + //#ifdef GOARCH_386 //#define sa_handler k_sa_handler //#endif diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go index f7f90cedc1..2b742a3711 100644 --- a/src/runtime/os_netbsd.go +++ b/src/runtime/os_netbsd.go @@ -290,6 +290,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func sigtramp() type sigactiont struct { diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index d7960f4c91..490077bc29 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -257,6 +257,11 @@ func unminit() { unminitSignals() } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + func sigtramp() type sigactiont struct { diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go index a035526937..2a84a73716 100644 --- a/src/runtime/os_plan9.go +++ b/src/runtime/os_plan9.go @@ -213,6 +213,11 @@ func minit() { func unminit() { } +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +func mdestroy(mp *m) { +} + var sysstat = []byte("/dev/sysstat\x00") func getproccount() int32 { diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 16ff285e88..83d0d63e5d 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -898,20 +898,18 @@ func minit() { throw("runtime.minit: duplicatehandle failed") } + mp := getg().m + lock(&mp.threadLock) + mp.thread = thandle + // Configure usleep timer, if possible. - var timer uintptr - if haveHighResTimer { - timer = createHighResTimer() - if timer == 0 { + if mp.highResTimer == 0 && haveHighResTimer { + mp.highResTimer = createHighResTimer() + if mp.highResTimer == 0 { print("runtime: CreateWaitableTimerEx failed; errno=", getlasterror(), "\n") throw("CreateWaitableTimerEx when creating timer failed") } } - - mp := getg().m - lock(&mp.threadLock) - mp.thread = thandle - mp.highResTimer = timer unlock(&mp.threadLock) // Query the true stack base from the OS. Currently we're @@ -947,13 +945,29 @@ func minit() { func unminit() { mp := getg().m lock(&mp.threadLock) - stdcall1(_CloseHandle, mp.thread) - mp.thread = 0 + if mp.thread != 0 { + stdcall1(_CloseHandle, mp.thread) + mp.thread = 0 + } + unlock(&mp.threadLock) +} + +// Called from exitm, but not from drop, to undo the effect of thread-owned +// resources in minit, semacreate, or elsewhere. Do not take locks after calling this. +//go:nosplit +func mdestroy(mp *m) { if mp.highResTimer != 0 { stdcall1(_CloseHandle, mp.highResTimer) mp.highResTimer = 0 } - unlock(&mp.threadLock) + if mp.waitsema != 0 { + stdcall1(_CloseHandle, mp.waitsema) + mp.waitsema = 0 + } + if mp.resumesema != 0 { + stdcall1(_CloseHandle, mp.resumesema) + mp.resumesema = 0 + } } // Calling stdcall on os stack. diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 5a942a6831..b776f88936 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1407,6 +1407,10 @@ found: } } + // Destroy all allocated resources. After this is called, we may no + // longer take any locks. + mdestroy(m) + if osStack { // Return from mstart and let the system thread // library free the g0 stack and terminate the thread. -- cgit v1.3-5-g9baa From 9fed39d2814073a9389a614342f603bab9963bff Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 24 Aug 2020 18:04:13 +1000 Subject: runtime: factor out mStackIsSystemAllocated Rather than repeat long lists of GOOS values, factor out the code that checks if a runtime starts on a system allocated stack. Note that this adds aix to one case, which appears to have been previously missed. Change-Id: I5cecb0bb47dd79cde8d723e5a42ba541e43cbfff Reviewed-on: https://go-review.googlesource.com/c/go/+/250179 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Joel Sing TryBot-Result: Go Bot --- src/runtime/proc.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index b776f88936..477152d899 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1206,6 +1206,16 @@ func startTheWorldWithSema(emitTraceEvent bool) int64 { return startTime } +// mStackIsSystemAllocated indicates whether this runtime starts on a +// system-allocated stack. +func mStackIsSystemAllocated() bool { + switch GOOS { + case "aix", "darwin", "plan9", "illumos", "ios", "solaris", "windows": + return true + } + return false +} + // mstart is the entry-point for new Ms. // // This must not split the stack because we may not even have stack @@ -1240,8 +1250,7 @@ func mstart() { mstart1() // Exit this thread. - switch GOOS { - case "windows", "solaris", "illumos", "plan9", "darwin", "ios", "aix": + if mStackIsSystemAllocated() { // Windows, Solaris, illumos, Darwin, AIX and Plan 9 always system-allocate // the stack, but put it in _g_.stack before mstart, // so the logic above hasn't set osStack yet. @@ -1724,7 +1733,7 @@ func allocm(_p_ *p, fn func(), id int64) *m { // In case of cgo or Solaris or illumos or Darwin, pthread_create will make us a stack. // Windows and Plan 9 will layout sched stack on OS stack. - if iscgo || GOOS == "solaris" || GOOS == "illumos" || GOOS == "windows" || GOOS == "plan9" || GOOS == "darwin" || GOOS == "ios" { + if iscgo || mStackIsSystemAllocated() { mp.g0 = malg(-1) } else { mp.g0 = malg(8192 * sys.StackGuardMultiplier) -- cgit v1.3-5-g9baa From 61debffd977889cd3f7f63b4f71d5a8ef1fc604e Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 4 Oct 2020 01:44:41 +1000 Subject: runtime: factor out usesLibcall Rather than inline lists of GOOS values, factor out the code that checks if a runtime makes system calls via libcall. Change-Id: Ib19d7e63a2b4b8314f1841c0ff26e1b3a16b4b22 Reviewed-on: https://go-review.googlesource.com/c/go/+/259239 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Joel Sing TryBot-Result: Go Bot --- src/runtime/proc.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 477152d899..46aa3b04a5 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1206,6 +1206,16 @@ func startTheWorldWithSema(emitTraceEvent bool) int64 { return startTime } +// usesLibcall indicates whether this runtime performs system calls +// via libcall. +func usesLibcall() bool { + switch GOOS { + case "aix", "darwin", "illumos", "ios", "solaris", "windows": + return true + } + return false +} + // mStackIsSystemAllocated indicates whether this runtime starts on a // system-allocated stack. func mStackIsSystemAllocated() bool { @@ -4481,7 +4491,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { // Normal traceback is impossible or has failed. // See if it falls into several common cases. n = 0 - if (GOOS == "windows" || GOOS == "solaris" || GOOS == "illumos" || GOOS == "darwin" || GOOS == "ios" || GOOS == "aix") && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 { + if usesLibcall() && mp.libcallg != 0 && mp.libcallpc != 0 && mp.libcallsp != 0 { // Libcall, i.e. runtime syscall on windows. // Collect Go stack that leads to the call. n = gentraceback(mp.libcallpc, mp.libcallsp, 0, mp.libcallg.ptr(), 0, &stk[0], len(stk), nil, nil, 0) -- cgit v1.3-5-g9baa From d047c91a6c0f22af00d1c1e770a9d85201392656 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 24 Aug 2020 03:13:54 +1000 Subject: cmd/link,runtime: switch openbsd/amd64 to pthreads This switches openbsd/amd64 to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: I1105d5c392aa3e4c445d99c8cb80b927712e3529 Reviewed-on: https://go-review.googlesource.com/c/go/+/250180 Trust: Joel Sing Run-TryBot: Joel Sing TryBot-Result: Go Bot Reviewed-by: Cherry Zhang --- src/cmd/link/internal/ld/data.go | 4 +- src/cmd/link/internal/ld/lib.go | 1 + src/cmd/link/internal/ld/main.go | 8 ++ src/runtime/asm_amd64.s | 4 + src/runtime/defs_openbsd.go | 9 ++ src/runtime/defs_openbsd_amd64.go | 9 ++ src/runtime/os_openbsd.go | 34 ------ src/runtime/os_openbsd_libc.go | 58 ++++++++++ src/runtime/os_openbsd_syscall.go | 45 ++++++++ src/runtime/proc.go | 5 + src/runtime/sys_darwin.go | 44 -------- src/runtime/sys_libc.go | 53 +++++++++ src/runtime/sys_openbsd.go | 77 +++++++++++++ src/runtime/sys_openbsd_amd64.s | 229 ++++++++++++++++++++++++-------------- 14 files changed, 418 insertions(+), 162 deletions(-) create mode 100644 src/runtime/os_openbsd_libc.go create mode 100644 src/runtime/os_openbsd_syscall.go create mode 100644 src/runtime/sys_libc.go create mode 100644 src/runtime/sys_openbsd.go (limited to 'src/runtime') diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 3c5091e6a0..6013e0ab0a 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -206,8 +206,8 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) { } // We need to be able to reference dynimport symbols when linking against - // shared libraries, and Solaris, Darwin and AIX need it always - if !target.IsSolaris() && !target.IsDarwin() && !target.IsAIX() && rs != 0 && rst == sym.SDYNIMPORT && !target.IsDynlinkingGo() && !ldr.AttrSubSymbol(rs) { + // shared libraries, and AIX, Darwin, OpenBSD and Solaris always need it. + if !target.IsAIX() && !target.IsDarwin() && !target.IsSolaris() && !target.IsOpenbsd() && rs != 0 && rst == sym.SDYNIMPORT && !target.IsDynlinkingGo() && !ldr.AttrSubSymbol(rs) { if !(target.IsPPC64() && target.IsExternal() && ldr.SymName(rs) == ".TOC.") { st.err.Errorf(s, "unhandled relocation for %s (type %d (%s) rtype %d (%s))", ldr.SymName(rs), rst, rst, rt, sym.RelocName(target.Arch, rt)) } diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index dd5e8ab2c5..014969664b 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -1273,6 +1273,7 @@ func (ctxt *Link) hostlink() { } case objabi.Hopenbsd: argv = append(argv, "-Wl,-nopie") + argv = append(argv, "-pthread") case objabi.Hwindows: if windowsgui { argv = append(argv, "-mwindows") diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index 5c8293810f..64f52bc52f 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -183,6 +183,14 @@ func Main(arch *sys.Arch, theArch Arch) { interpreter = *flagInterpreter + if *flagBuildid == "" && ctxt.Target.IsOpenbsd() { + // TODO(jsing): Remove once direct syscalls are no longer in use. + // OpenBSD 6.7 onwards will not permit direct syscalls from a + // dynamically linked binary unless it identifies the binary + // contains a .note.go.buildid ELF note. See issue #36435. + *flagBuildid = "go-openbsd" + } + // enable benchmarking var bench *benchmark.Metrics if len(*benchmarkFlag) != 0 { diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 196252e1dd..4ac87089f2 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -181,6 +181,10 @@ needtls: // skip TLS setup on Darwin JMP ok #endif +#ifdef GOOS_openbsd + // skip TLS setup on OpenBSD + JMP ok +#endif LEAQ runtime·m0+m_tls(SB), DI CALL runtime·settls(SB) diff --git a/src/runtime/defs_openbsd.go b/src/runtime/defs_openbsd.go index 53e9d59a3c..57717abf7e 100644 --- a/src/runtime/defs_openbsd.go +++ b/src/runtime/defs_openbsd.go @@ -54,6 +54,8 @@ const ( SA_RESTART = C.SA_RESTART SA_ONSTACK = C.SA_ONSTACK + PTHREAD_CREATE_DETACHED = C.PTHREAD_CREATE_DETACHED + SIGHUP = C.SIGHUP SIGINT = C.SIGINT SIGQUIT = C.SIGQUIT @@ -129,3 +131,10 @@ type Timeval C.struct_timeval type Itimerval C.struct_itimerval type KeventT C.struct_kevent + +type Pthread C.pthread_t +type PthreadAttr C.pthread_attr_t +type PthreadCond C.pthread_cond_t +type PthreadCondAttr C.pthread_condattr_t +type PthreadMutex C.pthread_mutex_t +type PthreadMutexAttr C.pthread_mutexattr_t diff --git a/src/runtime/defs_openbsd_amd64.go b/src/runtime/defs_openbsd_amd64.go index c187a98ae0..01ca934cea 100644 --- a/src/runtime/defs_openbsd_amd64.go +++ b/src/runtime/defs_openbsd_amd64.go @@ -30,6 +30,8 @@ const ( _SA_RESTART = 0x2 _SA_ONSTACK = 0x1 + _PTHREAD_CREATE_DETACHED = 0x1 + _SIGHUP = 0x1 _SIGINT = 0x2 _SIGQUIT = 0x3 @@ -177,3 +179,10 @@ type keventt struct { data int64 udata *byte } + +type pthread uintptr +type pthreadattr uintptr +type pthreadcond uintptr +type pthreadcondattr uintptr +type pthreadmutex uintptr +type pthreadmutexattr uintptr diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index 490077bc29..61be627c27 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -6,7 +6,6 @@ package runtime import ( "runtime/internal/atomic" - "runtime/internal/sys" "unsafe" ) @@ -47,9 +46,6 @@ func raiseproc(sig uint32) func getthrid() int32 func thrkill(tid int32, sig int) -//go:noescape -func tfork(param *tforkt, psize uintptr, mm *m, gg *g, fn uintptr) int32 - //go:noescape func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 @@ -183,36 +179,6 @@ func semawakeup(mp *m) { } } -// May run with m.p==nil, so write barriers are not allowed. -//go:nowritebarrier -func newosproc(mp *m) { - stk := unsafe.Pointer(mp.g0.stack.hi) - if false { - print("newosproc stk=", stk, " m=", mp, " g=", mp.g0, " id=", mp.id, " ostk=", &mp, "\n") - } - - // Stack pointer must point inside stack area (as marked with MAP_STACK), - // rather than at the top of it. - param := tforkt{ - tf_tcb: unsafe.Pointer(&mp.tls[0]), - tf_tid: nil, // minit will record tid - tf_stack: uintptr(stk) - sys.PtrSize, - } - - var oset sigset - sigprocmask(_SIG_SETMASK, &sigset_all, &oset) - ret := tfork(¶m, unsafe.Sizeof(param), mp, mp.g0, funcPC(mstart)) - sigprocmask(_SIG_SETMASK, &oset, nil) - - if ret < 0 { - print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n") - if ret == -_EAGAIN { - println("runtime: may need to increase max user processes (ulimit -p)") - } - throw("runtime.newosproc") - } -} - func osinit() { ncpu = getncpu() physPageSize = getPageSize() diff --git a/src/runtime/os_openbsd_libc.go b/src/runtime/os_openbsd_libc.go new file mode 100644 index 0000000000..60735644f0 --- /dev/null +++ b/src/runtime/os_openbsd_libc.go @@ -0,0 +1,58 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package runtime + +import ( + "unsafe" +) + +var failThreadCreate = []byte("runtime: failed to create new OS thread\n") + +// mstart_stub provides glue code to call mstart from pthread_create. +func mstart_stub() + +// May run with m.p==nil, so write barriers are not allowed. +//go:nowritebarrierrec +func newosproc(mp *m) { + if false { + print("newosproc m=", mp, " g=", mp.g0, " id=", mp.id, " ostk=", &mp, "\n") + } + + // Initialize an attribute object. + var attr pthreadattr + if err := pthread_attr_init(&attr); err != 0 { + write(2, unsafe.Pointer(&failThreadCreate[0]), int32(len(failThreadCreate))) + exit(1) + } + + // Find out OS stack size for our own stack guard. + var stacksize uintptr + if pthread_attr_getstacksize(&attr, &stacksize) != 0 { + write(2, unsafe.Pointer(&failThreadCreate[0]), int32(len(failThreadCreate))) + exit(1) + } + mp.g0.stack.hi = stacksize // for mstart + + // Tell the pthread library we won't join with this thread. + if pthread_attr_setdetachstate(&attr, _PTHREAD_CREATE_DETACHED) != 0 { + write(2, unsafe.Pointer(&failThreadCreate[0]), int32(len(failThreadCreate))) + exit(1) + } + + // Finally, create the thread. It starts at mstart_stub, which does some low-level + // setup and then calls mstart. + var oset sigset + sigprocmask(_SIG_SETMASK, &sigset_all, &oset) + err := pthread_create(&attr, funcPC(mstart_stub), unsafe.Pointer(mp)) + sigprocmask(_SIG_SETMASK, &oset, nil) + if err != 0 { + write(2, unsafe.Pointer(&failThreadCreate[0]), int32(len(failThreadCreate))) + exit(1) + } + + pthread_attr_destroy(&attr) +} diff --git a/src/runtime/os_openbsd_syscall.go b/src/runtime/os_openbsd_syscall.go new file mode 100644 index 0000000000..e91a97ca8e --- /dev/null +++ b/src/runtime/os_openbsd_syscall.go @@ -0,0 +1,45 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,!amd64 + +package runtime + +import ( + "runtime/internal/sys" + "unsafe" +) + +//go:noescape +func tfork(param *tforkt, psize uintptr, mm *m, gg *g, fn uintptr) int32 + +// May run with m.p==nil, so write barriers are not allowed. +//go:nowritebarrier +func newosproc(mp *m) { + stk := unsafe.Pointer(mp.g0.stack.hi) + if false { + print("newosproc stk=", stk, " m=", mp, " g=", mp.g0, " id=", mp.id, " ostk=", &mp, "\n") + } + + // Stack pointer must point inside stack area (as marked with MAP_STACK), + // rather than at the top of it. + param := tforkt{ + tf_tcb: unsafe.Pointer(&mp.tls[0]), + tf_tid: nil, // minit will record tid + tf_stack: uintptr(stk) - sys.PtrSize, + } + + var oset sigset + sigprocmask(_SIG_SETMASK, &sigset_all, &oset) + ret := tfork(¶m, unsafe.Sizeof(param), mp, mp.g0, funcPC(mstart)) + sigprocmask(_SIG_SETMASK, &oset, nil) + + if ret < 0 { + print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n") + if ret == -_EAGAIN { + println("runtime: may need to increase max user processes (ulimit -p)") + } + throw("runtime.newosproc") + } +} diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 46aa3b04a5..26cf7c7335 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1222,6 +1222,11 @@ func mStackIsSystemAllocated() bool { switch GOOS { case "aix", "darwin", "plan9", "illumos", "ios", "solaris", "windows": return true + case "openbsd": + switch GOARCH { + case "amd64": + return true + } } return false } diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go index 55845bf2e5..4a3f2fc453 100644 --- a/src/runtime/sys_darwin.go +++ b/src/runtime/sys_darwin.go @@ -6,50 +6,6 @@ package runtime import "unsafe" -// Call fn with arg as its argument. Return what fn returns. -// fn is the raw pc value of the entry point of the desired function. -// Switches to the system stack, if not already there. -// Preserves the calling point as the location where a profiler traceback will begin. -//go:nosplit -func libcCall(fn, arg unsafe.Pointer) int32 { - // Leave caller's PC/SP/G around for traceback. - gp := getg() - var mp *m - if gp != nil { - mp = gp.m - } - if mp != nil && mp.libcallsp == 0 { - mp.libcallg.set(gp) - mp.libcallpc = getcallerpc() - // sp must be the last, because once async cpu profiler finds - // all three values to be non-zero, it will use them - mp.libcallsp = getcallersp() - } else { - // Make sure we don't reset libcallsp. This makes - // libcCall reentrant; We remember the g/pc/sp for the - // first call on an M, until that libcCall instance - // returns. Reentrance only matters for signals, as - // libc never calls back into Go. The tricky case is - // where we call libcX from an M and record g/pc/sp. - // Before that call returns, a signal arrives on the - // same M and the signal handling code calls another - // libc function. We don't want that second libcCall - // from within the handler to be recorded, and we - // don't want that call's completion to zero - // libcallsp. - // We don't need to set libcall* while we're in a sighandler - // (even if we're not currently in libc) because we block all - // signals while we're handling a signal. That includes the - // profile signal, which is the one that uses the libcall* info. - mp = nil - } - res := asmcgocall(fn, arg) - if mp != nil { - mp.libcallsp = 0 - } - return res -} - // The X versions of syscall expect the libc call to return a 64-bit result. // Otherwise (the non-X version) expects a 32-bit result. // This distinction is required because an error is indicated by returning -1, diff --git a/src/runtime/sys_libc.go b/src/runtime/sys_libc.go new file mode 100644 index 0000000000..c97a97d77b --- /dev/null +++ b/src/runtime/sys_libc.go @@ -0,0 +1,53 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin openbsd,amd64 + +package runtime + +import "unsafe" + +// Call fn with arg as its argument. Return what fn returns. +// fn is the raw pc value of the entry point of the desired function. +// Switches to the system stack, if not already there. +// Preserves the calling point as the location where a profiler traceback will begin. +//go:nosplit +func libcCall(fn, arg unsafe.Pointer) int32 { + // Leave caller's PC/SP/G around for traceback. + gp := getg() + var mp *m + if gp != nil { + mp = gp.m + } + if mp != nil && mp.libcallsp == 0 { + mp.libcallg.set(gp) + mp.libcallpc = getcallerpc() + // sp must be the last, because once async cpu profiler finds + // all three values to be non-zero, it will use them + mp.libcallsp = getcallersp() + } else { + // Make sure we don't reset libcallsp. This makes + // libcCall reentrant; We remember the g/pc/sp for the + // first call on an M, until that libcCall instance + // returns. Reentrance only matters for signals, as + // libc never calls back into Go. The tricky case is + // where we call libcX from an M and record g/pc/sp. + // Before that call returns, a signal arrives on the + // same M and the signal handling code calls another + // libc function. We don't want that second libcCall + // from within the handler to be recorded, and we + // don't want that call's completion to zero + // libcallsp. + // We don't need to set libcall* while we're in a sighandler + // (even if we're not currently in libc) because we block all + // signals while we're handling a signal. That includes the + // profile signal, which is the one that uses the libcall* info. + mp = nil + } + res := asmcgocall(fn, arg) + if mp != nil { + mp.libcallsp = 0 + } + return res +} diff --git a/src/runtime/sys_openbsd.go b/src/runtime/sys_openbsd.go new file mode 100644 index 0000000000..4dfab7d7b0 --- /dev/null +++ b/src/runtime/sys_openbsd.go @@ -0,0 +1,77 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package runtime + +import "unsafe" + +// The *_trampoline functions convert from the Go calling convention to the C calling convention +// and then call the underlying libc function. These are defined in sys_openbsd_$ARCH.s. + +//go:nosplit +//go:cgo_unsafe_args +func pthread_attr_init(attr *pthreadattr) int32 { + return libcCall(unsafe.Pointer(funcPC(pthread_attr_init_trampoline)), unsafe.Pointer(&attr)) +} +func pthread_attr_init_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_attr_destroy(attr *pthreadattr) int32 { + return libcCall(unsafe.Pointer(funcPC(pthread_attr_destroy_trampoline)), unsafe.Pointer(&attr)) +} +func pthread_attr_destroy_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_attr_getstacksize(attr *pthreadattr, size *uintptr) int32 { + return libcCall(unsafe.Pointer(funcPC(pthread_attr_getstacksize_trampoline)), unsafe.Pointer(&attr)) +} +func pthread_attr_getstacksize_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_attr_setdetachstate(attr *pthreadattr, state int) int32 { + return libcCall(unsafe.Pointer(funcPC(pthread_attr_setdetachstate_trampoline)), unsafe.Pointer(&attr)) +} +func pthread_attr_setdetachstate_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_create(attr *pthreadattr, start uintptr, arg unsafe.Pointer) int32 { + return libcCall(unsafe.Pointer(funcPC(pthread_create_trampoline)), unsafe.Pointer(&attr)) +} +func pthread_create_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_self() (t pthread) { + libcCall(unsafe.Pointer(funcPC(pthread_self_trampoline)), unsafe.Pointer(&t)) + return +} +func pthread_self_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func pthread_kill(t pthread, sig uint32) { + libcCall(unsafe.Pointer(funcPC(pthread_kill_trampoline)), unsafe.Pointer(&t)) +} +func pthread_kill_trampoline() + +// Tell the linker that the libc_* functions are to be found +// in a system library, with the libc_ prefix missing. + +//go:cgo_import_dynamic libc_pthread_attr_init pthread_attr_init "libpthread.so" +//go:cgo_import_dynamic libc_pthread_attr_destroy pthread_attr_destroy "libpthread.so" +//go:cgo_import_dynamic libc_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so" +//go:cgo_import_dynamic libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "libpthread.so" +//go:cgo_import_dynamic libc_pthread_create pthread_create "libpthread.so" +//go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "libpthread.so" +//go:cgo_import_dynamic libc_pthread_self pthread_self "libpthread.so" +//go:cgo_import_dynamic libc_pthread_kill pthread_kill "libpthread.so" + +//go:cgo_import_dynamic _ _ "libpthread.so" +//go:cgo_import_dynamic _ _ "libc.so" diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 37d70ab9aa..455234d7cd 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// System calls and other sys.stuff for AMD64, OpenBSD -// /usr/src/sys/kern/syscalls.master for syscall numbers. +// System calls and other sys.stuff for AMD64, OpenBSD. +// System calls are implemented in libc/libpthread, this file +// contains trampolines that convert from Go to C calling convention. +// Some direct system call implementations currently remain. // #include "go_asm.h" @@ -12,49 +14,159 @@ #define CLOCK_MONOTONIC $3 -// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void)); -TEXT runtime·tfork(SB),NOSPLIT,$32 +TEXT runtime·settls(SB),NOSPLIT,$0 + // Nothing to do, pthread already set thread-local storage up. + RET - // Copy mp, gp and fn off parent stack for use by child. - MOVQ mm+16(FP), R8 - MOVQ gg+24(FP), R9 - MOVQ fn+32(FP), R12 +// mstart_stub is the first function executed on a new thread started by pthread_create. +// It just does some low-level setup and then calls mstart. +// Note: called with the C calling convention. +TEXT runtime·mstart_stub(SB),NOSPLIT,$0 + // DI points to the m. + // We are already on m's g0 stack. - MOVQ param+0(FP), DI - MOVQ psize+8(FP), SI - MOVL $8, AX // sys___tfork - SYSCALL + // Save callee-save registers. + SUBQ $48, SP + MOVQ BX, 0(SP) + MOVQ BP, 8(SP) + MOVQ R12, 16(SP) + MOVQ R13, 24(SP) + MOVQ R14, 32(SP) + MOVQ R15, 40(SP) - // Return if tfork syscall failed. - JCC 4(PC) - NEGQ AX - MOVL AX, ret+40(FP) + // Load g and save to TLS entry. + // See cmd/link/internal/ld/sym.go:computeTLSOffset. + MOVQ m_g0(DI), DX // g + MOVQ DX, -8(FS) + + // Someday the convention will be D is always cleared. + CLD + + CALL runtime·mstart(SB) + + // Restore callee-save registers. + MOVQ 0(SP), BX + MOVQ 8(SP), BP + MOVQ 16(SP), R12 + MOVQ 24(SP), R13 + MOVQ 32(SP), R14 + MOVQ 40(SP), R15 + + // Go is all done with this OS thread. + // Tell pthread everything is ok (we never join with this thread, so + // the value here doesn't really matter). + XORL AX, AX + + ADDQ $48, SP RET - // In parent, return. - CMPL AX, $0 - JEQ 3(PC) - MOVL AX, ret+40(FP) +TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 + MOVQ fn+0(FP), AX + MOVL sig+8(FP), DI + MOVQ info+16(FP), SI + MOVQ ctx+24(FP), DX + PUSHQ BP + MOVQ SP, BP + ANDQ $~15, SP // alignment for x86_64 ABI + CALL AX + MOVQ BP, SP + POPQ BP RET - // Set FS to point at m->tls. - LEAQ m_tls(R8), DI - CALL runtime·settls(SB) +TEXT runtime·sigtramp(SB),NOSPLIT,$72 + // Save callee-saved C registers, since the caller may be a C signal handler. + MOVQ BX, bx-8(SP) + MOVQ BP, bp-16(SP) // save in case GOEXPERIMENT=noframepointer is set + MOVQ R12, r12-24(SP) + MOVQ R13, r13-32(SP) + MOVQ R14, r14-40(SP) + MOVQ R15, r15-48(SP) + // We don't save mxcsr or the x87 control word because sigtrampgo doesn't + // modify them. - // In child, set up new stack. - get_tls(CX) - MOVQ R8, g_m(R9) - MOVQ R9, g(CX) - CALL runtime·stackcheck(SB) + MOVQ DX, ctx-56(SP) + MOVQ SI, info-64(SP) + MOVQ DI, signum-72(SP) + CALL runtime·sigtrampgo(SB) - // Call fn - CALL R12 + MOVQ r15-48(SP), R15 + MOVQ r14-40(SP), R14 + MOVQ r13-32(SP), R13 + MOVQ r12-24(SP), R12 + MOVQ bp-16(SP), BP + MOVQ bx-8(SP), BX + RET - // It shouldn't return. If it does, exit - MOVQ $0, DI // arg 1 - notdead - MOVL $302, AX // sys___threxit - SYSCALL - JMP -3(PC) // keep exiting +// +// These trampolines help convert from Go calling convention to C calling convention. +// They should be called with asmcgocall. +// A pointer to the arguments is passed in DI. +// A single int32 result is returned in AX. +// (For more results, make an args/results structure.) +TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 0(DI), DI // arg 1 - attr + CALL libc_pthread_attr_init(SB) + POPQ BP + RET + +TEXT runtime·pthread_attr_destroy_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 0(DI), DI // arg 1 - attr + CALL libc_pthread_attr_destroy(SB) + POPQ BP + RET + +TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 - stacksize + MOVQ 0(DI), DI // arg 1 - attr + CALL libc_pthread_attr_getstacksize(SB) + POPQ BP + RET + +TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 - detachstate + MOVQ 0(DI), DI // arg 1 - attr + CALL libc_pthread_attr_setdetachstate(SB) + POPQ BP + RET + +TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $16, SP + MOVQ 0(DI), SI // arg 2 - attr + MOVQ 8(DI), DX // arg 3 - start + MOVQ 16(DI), CX // arg 4 - arg + MOVQ SP, DI // arg 1 - &thread (discarded) + CALL libc_pthread_create(SB) + MOVQ BP, SP + POPQ BP + RET + +TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ DI, BX // BX is caller-save + CALL libc_pthread_self(SB) + MOVQ AX, 0(BX) // return value + POPQ BP + RET + +TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 - sig + MOVQ 0(DI), DI // arg 1 - thread + CALL libc_pthread_kill(SB) + POPQ BP + RET TEXT runtime·osyield(SB),NOSPLIT,$0 MOVL $298, AX // sys_sched_yield @@ -251,43 +363,6 @@ TEXT runtime·obsdsigprocmask(SB),NOSPLIT,$0 MOVL AX, ret+8(FP) RET -TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 - MOVQ fn+0(FP), AX - MOVL sig+8(FP), DI - MOVQ info+16(FP), SI - MOVQ ctx+24(FP), DX - PUSHQ BP - MOVQ SP, BP - ANDQ $~15, SP // alignment for x86_64 ABI - CALL AX - MOVQ BP, SP - POPQ BP - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$72 - // Save callee-saved C registers, since the caller may be a C signal handler. - MOVQ BX, bx-8(SP) - MOVQ BP, bp-16(SP) // save in case GOEXPERIMENT=noframepointer is set - MOVQ R12, r12-24(SP) - MOVQ R13, r13-32(SP) - MOVQ R14, r14-40(SP) - MOVQ R15, r15-48(SP) - // We don't save mxcsr or the x87 control word because sigtrampgo doesn't - // modify them. - - MOVQ DX, ctx-56(SP) - MOVQ SI, info-64(SP) - MOVQ DI, signum-72(SP) - CALL runtime·sigtrampgo(SB) - - MOVQ r15-48(SP), R15 - MOVQ r14-40(SP), R14 - MOVQ r13-32(SP), R13 - MOVQ r12-24(SP), R12 - MOVQ bp-16(SP), BP - MOVQ bx-8(SP), BX - RET - TEXT runtime·mmap(SB),NOSPLIT,$0 MOVQ addr+0(FP), DI // arg 1 - addr MOVQ n+8(FP), SI // arg 2 - len @@ -340,16 +415,6 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$-8 MOVL $0xf1, 0xf1 // crash RET -// set tls base to DI -TEXT runtime·settls(SB),NOSPLIT,$0 - // adjust for ELF: wants to use -8(FS) for g - ADDQ $8, DI - MOVQ $329, AX // sys___settcb - SYSCALL - JCC 2(PC) - MOVL $0xf1, 0xf1 // crash - RET - TEXT runtime·sysctl(SB),NOSPLIT,$0 MOVQ mib+0(FP), DI // arg 1 - name MOVL miblen+8(FP), SI // arg 2 - namelen -- cgit v1.3-5-g9baa From 928bda4f4a88efe2e53f3607e8d2ad0796b449c0 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sat, 16 Jan 2021 04:38:50 +1100 Subject: runtime: convert openbsd/amd64 locking to libc Switch openbsd/amd64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I5e92bd70ce557b78ff385577088a9775cc468ea9 Reviewed-on: https://go-review.googlesource.com/c/go/+/270378 Trust: Joel Sing Run-TryBot: Joel Sing TryBot-Result: Go Bot Reviewed-by: Cherry Zhang --- src/runtime/os_openbsd.go | 8 -------- src/runtime/os_openbsd_syscall1.go | 15 ++++++++++++++ src/runtime/sys_openbsd1.go | 34 ++++++++++++++++++++++++++++++++ src/runtime/sys_openbsd_amd64.s | 40 +++++++++++++++++++++----------------- 4 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 src/runtime/os_openbsd_syscall1.go create mode 100644 src/runtime/sys_openbsd1.go (limited to 'src/runtime') diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index 61be627c27..56b686a2fa 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -46,14 +46,6 @@ func raiseproc(sig uint32) func getthrid() int32 func thrkill(tid int32, sig int) -//go:noescape -func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 - -//go:noescape -func thrwakeup(ident uintptr, n int32) int32 - -func osyield() - func kqueue() int32 //go:noescape diff --git a/src/runtime/os_openbsd_syscall1.go b/src/runtime/os_openbsd_syscall1.go new file mode 100644 index 0000000000..08928cfef4 --- /dev/null +++ b/src/runtime/os_openbsd_syscall1.go @@ -0,0 +1,15 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,!amd64 + +package runtime + +//go:noescape +func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 + +//go:noescape +func thrwakeup(ident uintptr, n int32) int32 + +func osyield() diff --git a/src/runtime/sys_openbsd1.go b/src/runtime/sys_openbsd1.go new file mode 100644 index 0000000000..a201a16c53 --- /dev/null +++ b/src/runtime/sys_openbsd1.go @@ -0,0 +1,34 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package runtime + +import "unsafe" + +//go:nosplit +//go:cgo_unsafe_args +func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort *uint32) int32 { + return libcCall(unsafe.Pointer(funcPC(thrsleep_trampoline)), unsafe.Pointer(&ident)) +} +func thrsleep_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func thrwakeup(ident uintptr, n int32) int32 { + return libcCall(unsafe.Pointer(funcPC(thrwakeup_trampoline)), unsafe.Pointer(&ident)) +} +func thrwakeup_trampoline() + +func osyield() { + libcCall(unsafe.Pointer(funcPC(sched_yield_trampoline)), unsafe.Pointer(nil)) +} +func sched_yield_trampoline() + +//go:cgo_import_dynamic libc_thrsleep __thrsleep "libc.so" +//go:cgo_import_dynamic libc_thrwakeup __thrwakeup "libc.so" +//go:cgo_import_dynamic libc_sched_yield sched_yield "libc.so" + +//go:cgo_import_dynamic _ _ "libc.so" diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 455234d7cd..ac0ae27e45 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -168,28 +168,32 @@ TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·osyield(SB),NOSPLIT,$0 - MOVL $298, AX // sys_sched_yield - SYSCALL +TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 - clock_id + MOVQ 16(DI), DX // arg 3 - abstime + MOVQ 24(DI), CX // arg 3 - lock + MOVQ 32(DI), R8 // arg 4 - abort + MOVQ 0(DI), DI // arg 1 - id + CALL libc_thrsleep(SB) + POPQ BP RET -TEXT runtime·thrsleep(SB),NOSPLIT,$0 - MOVQ ident+0(FP), DI // arg 1 - ident - MOVL clock_id+8(FP), SI // arg 2 - clock_id - MOVQ tsp+16(FP), DX // arg 3 - tp - MOVQ lock+24(FP), R10 // arg 4 - lock - MOVQ abort+32(FP), R8 // arg 5 - abort - MOVL $94, AX // sys___thrsleep - SYSCALL - MOVL AX, ret+40(FP) +TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 - count + MOVQ 0(DI), DI // arg 1 - id + CALL libc_thrwakeup(SB) + POPQ BP RET -TEXT runtime·thrwakeup(SB),NOSPLIT,$0 - MOVQ ident+0(FP), DI // arg 1 - ident - MOVL n+8(FP), SI // arg 2 - n - MOVL $301, AX // sys___thrwakeup - SYSCALL - MOVL AX, ret+16(FP) +TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + CALL libc_sched_yield(SB) + POPQ BP RET // Exit the entire program (like C exit) -- cgit v1.3-5-g9baa From d2d155d1ae8c704a37f42fd3ebb1f3846f78e4d4 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 19 Jan 2021 21:30:36 -0800 Subject: runtime: don't adjust timer pp field in timerWaiting status Before this CL, the following sequence was possible: * GC scavenger starts and sets up scavenge.timer * GC calls readyForScavenger, but sysmon is sleeping * program calls runtime.GOMAXPROCS to shrink number of processors * procresize destroys a P, the one that scavenge.timer is on * (*pp).destroy calls moveTimers, which gets to the scavenger timer * scavenger timer is timerWaiting, and moveTimers clears t.pp * sysmon wakes up and calls wakeScavenger * wakeScavengers calls stopTimer on scavenger.timer, still timerWaiting * stopTimer calls deltimer which loads t.pp, which is still nil * stopTimer tries to increment deletedTimers on nil t.pp, and crashes The point of vulnerability is the time that t.pp is set to nil by moveTimers and the time that t.pp is set to non-nil by moveTimers, which is a few instructions at most. So it's not likely and in particular is quite unlikely on x86. But with a more relaxed memory model the area of vulnerability can be somewhat larger. This appears to tbe the cause of two builder failures in a few months on linux-mips. This CL fixes the problem by making moveTimers change the status from timerWaiting to timerMoving while t.pp is clear. That will cause deltimer to wait until the status is back to timerWaiting, at which point t.pp has been set again. Fixes #43712 Change-Id: I66838319ecfbf15be66c1fac88d9bd40e2295852 Reviewed-on: https://go-review.googlesource.com/c/go/+/284775 Trust: Ian Lance Taylor Reviewed-by: Michael Knyszek Reviewed-by: Michael Pratt --- src/runtime/time.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/time.go b/src/runtime/time.go index d338705b7c..8ab2a03430 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -609,8 +609,14 @@ func moveTimers(pp *p, timers []*timer) { for { switch s := atomic.Load(&t.status); s { case timerWaiting: + if !atomic.Cas(&t.status, s, timerMoving) { + continue + } t.pp = 0 doaddtimer(pp, t) + if !atomic.Cas(&t.status, timerMoving, timerWaiting) { + badTimer() + } break loop case timerModifiedEarlier, timerModifiedLater: if !atomic.Cas(&t.status, s, timerMoving) { -- cgit v1.3-5-g9baa From 3d40895e36e5f16654fa6b75f7fdf59edb18d2e0 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 25 Aug 2020 01:29:02 +1000 Subject: runtime: switch openbsd/arm64 to pthreads This switches openbsd/arm64 to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: I7cf60fa954f92628e05f15d2732833a2fbdccdb9 Reviewed-on: https://go-review.googlesource.com/c/go/+/250182 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- src/runtime/defs_openbsd_arm64.go | 9 ++ src/runtime/os_openbsd_libc.go | 2 +- src/runtime/os_openbsd_syscall.go | 1 + src/runtime/proc.go | 2 +- src/runtime/sys_libc.go | 2 +- src/runtime/sys_openbsd.go | 2 +- src/runtime/sys_openbsd_arm64.s | 281 ++++++++++++++++++++++++-------------- src/runtime/tls_arm64.s | 4 + 8 files changed, 195 insertions(+), 108 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/defs_openbsd_arm64.go b/src/runtime/defs_openbsd_arm64.go index 628f4bc5a5..63ea8dfecc 100644 --- a/src/runtime/defs_openbsd_arm64.go +++ b/src/runtime/defs_openbsd_arm64.go @@ -31,6 +31,8 @@ const ( _SA_RESTART = 0x2 _SA_ONSTACK = 0x1 + _PTHREAD_CREATE_DETACHED = 0x1 + _SIGHUP = 0x1 _SIGINT = 0x2 _SIGQUIT = 0x3 @@ -157,3 +159,10 @@ type keventt struct { data int64 udata *byte } + +type pthread uintptr +type pthreadattr uintptr +type pthreadcond uintptr +type pthreadcondattr uintptr +type pthreadmutex uintptr +type pthreadmutexattr uintptr diff --git a/src/runtime/os_openbsd_libc.go b/src/runtime/os_openbsd_libc.go index 60735644f0..2edb0358b0 100644 --- a/src/runtime/os_openbsd_libc.go +++ b/src/runtime/os_openbsd_libc.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/os_openbsd_syscall.go b/src/runtime/os_openbsd_syscall.go index e91a97ca8e..16ff2b8e25 100644 --- a/src/runtime/os_openbsd_syscall.go +++ b/src/runtime/os_openbsd_syscall.go @@ -3,6 +3,7 @@ // license that can be found in the LICENSE file. // +build openbsd,!amd64 +// +build openbsd,!arm64 package runtime diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 26cf7c7335..30033712aa 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1224,7 +1224,7 @@ func mStackIsSystemAllocated() bool { return true case "openbsd": switch GOARCH { - case "amd64": + case "amd64", "arm64": return true } } diff --git a/src/runtime/sys_libc.go b/src/runtime/sys_libc.go index c97a97d77b..996c032105 100644 --- a/src/runtime/sys_libc.go +++ b/src/runtime/sys_libc.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin openbsd,amd64 +// +build darwin openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/sys_openbsd.go b/src/runtime/sys_openbsd.go index 4dfab7d7b0..56de00aad5 100644 --- a/src/runtime/sys_openbsd.go +++ b/src/runtime/sys_openbsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s index 621b1b1a42..90646bbe85 100644 --- a/src/runtime/sys_openbsd_arm64.s +++ b/src/runtime/sys_openbsd_arm64.s @@ -3,7 +3,9 @@ // license that can be found in the LICENSE file. // // System calls and other sys.stuff for arm64, OpenBSD -// /usr/src/sys/kern/syscalls.master for syscall numbers. +// System calls are implemented in libc/libpthread, this file +// contains trampolines that convert from Go to C calling convention. +// Some direct system call implementations currently remain. // #include "go_asm.h" @@ -24,6 +26,180 @@ NOOP; \ NOOP +// mstart_stub is the first function executed on a new thread started by pthread_create. +// It just does some low-level setup and then calls mstart. +// Note: called with the C calling convention. +TEXT runtime·mstart_stub(SB),NOSPLIT,$160 + // R0 points to the m. + // We are already on m's g0 stack. + + // Save callee-save registers. + MOVD R19, 8(RSP) + MOVD R20, 16(RSP) + MOVD R21, 24(RSP) + MOVD R22, 32(RSP) + MOVD R23, 40(RSP) + MOVD R24, 48(RSP) + MOVD R25, 56(RSP) + MOVD R26, 64(RSP) + MOVD R27, 72(RSP) + MOVD g, 80(RSP) + MOVD R29, 88(RSP) + FMOVD F8, 96(RSP) + FMOVD F9, 104(RSP) + FMOVD F10, 112(RSP) + FMOVD F11, 120(RSP) + FMOVD F12, 128(RSP) + FMOVD F13, 136(RSP) + FMOVD F14, 144(RSP) + FMOVD F15, 152(RSP) + + MOVD m_g0(R0), g + BL runtime·save_g(SB) + + BL runtime·mstart(SB) + + // Restore callee-save registers. + MOVD 8(RSP), R19 + MOVD 16(RSP), R20 + MOVD 24(RSP), R21 + MOVD 32(RSP), R22 + MOVD 40(RSP), R23 + MOVD 48(RSP), R24 + MOVD 56(RSP), R25 + MOVD 64(RSP), R26 + MOVD 72(RSP), R27 + MOVD 80(RSP), g + MOVD 88(RSP), R29 + FMOVD 96(RSP), F8 + FMOVD 104(RSP), F9 + FMOVD 112(RSP), F10 + FMOVD 120(RSP), F11 + FMOVD 128(RSP), F12 + FMOVD 136(RSP), F13 + FMOVD 144(RSP), F14 + FMOVD 152(RSP), F15 + + // Go is all done with this OS thread. + // Tell pthread everything is ok (we never join with this thread, so + // the value here doesn't really matter). + MOVD $0, R0 + + RET + +TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 + MOVW sig+8(FP), R0 + MOVD info+16(FP), R1 + MOVD ctx+24(FP), R2 + MOVD fn+0(FP), R11 + BL (R11) // Alignment for ELF ABI? + RET + +TEXT runtime·sigtramp(SB),NOSPLIT,$192 + // Save callee-save registers in the case of signal forwarding. + // Please refer to https://golang.org/issue/31827 . + MOVD R19, 8*4(RSP) + MOVD R20, 8*5(RSP) + MOVD R21, 8*6(RSP) + MOVD R22, 8*7(RSP) + MOVD R23, 8*8(RSP) + MOVD R24, 8*9(RSP) + MOVD R25, 8*10(RSP) + MOVD R26, 8*11(RSP) + MOVD R27, 8*12(RSP) + MOVD g, 8*13(RSP) + MOVD R29, 8*14(RSP) + FMOVD F8, 8*15(RSP) + FMOVD F9, 8*16(RSP) + FMOVD F10, 8*17(RSP) + FMOVD F11, 8*18(RSP) + FMOVD F12, 8*19(RSP) + FMOVD F13, 8*20(RSP) + FMOVD F14, 8*21(RSP) + FMOVD F15, 8*22(RSP) + + // If called from an external code context, g will not be set. + // Save R0, since runtime·load_g will clobber it. + MOVW R0, 8(RSP) // signum + BL runtime·load_g(SB) + + MOVD R1, 16(RSP) + MOVD R2, 24(RSP) + BL runtime·sigtrampgo(SB) + + // Restore callee-save registers. + MOVD 8*4(RSP), R19 + MOVD 8*5(RSP), R20 + MOVD 8*6(RSP), R21 + MOVD 8*7(RSP), R22 + MOVD 8*8(RSP), R23 + MOVD 8*9(RSP), R24 + MOVD 8*10(RSP), R25 + MOVD 8*11(RSP), R26 + MOVD 8*12(RSP), R27 + MOVD 8*13(RSP), g + MOVD 8*14(RSP), R29 + FMOVD 8*15(RSP), F8 + FMOVD 8*16(RSP), F9 + FMOVD 8*17(RSP), F10 + FMOVD 8*18(RSP), F11 + FMOVD 8*19(RSP), F12 + FMOVD 8*20(RSP), F13 + FMOVD 8*21(RSP), F14 + FMOVD 8*22(RSP), F15 + + RET + +// +// These trampolines help convert from Go calling convention to C calling convention. +// They should be called with asmcgocall. +// A pointer to the arguments is passed in R0. +// A single int32 result is returned in R0. +// (For more results, make an args/results structure.) +TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 + MOVD 0(R0), R0 // arg 1 - attr + CALL libc_pthread_attr_init(SB) + RET + +TEXT runtime·pthread_attr_destroy_trampoline(SB),NOSPLIT,$0 + MOVD 0(R0), R0 // arg 1 - attr + CALL libc_pthread_attr_destroy(SB) + RET + +TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - size + MOVD 0(R0), R0 // arg 1 - attr + CALL libc_pthread_attr_getstacksize(SB) + RET + +TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - state + MOVD 0(R0), R0 // arg 1 - attr + CALL libc_pthread_attr_setdetachstate(SB) + RET + +TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 + MOVD 0(R0), R1 // arg 2 - attr + MOVD 8(R0), R2 // arg 3 - start + MOVD 16(R0), R3 // arg 4 - arg + SUB $16, RSP + MOVD RSP, R0 // arg 1 - &threadid (discard) + CALL libc_pthread_create(SB) + ADD $16, RSP + RET + +TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + CALL libc_pthread_self(SB) + MOVD R0, 0(R19) // return value + RET + +TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - sig + MOVD 0(R0), R0 // arg 1 - thread + CALL libc_pthread_kill(SB) + RET + // Exit the entire program (like C exit) TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0 MOVW code+0(FP), R0 // arg 1 - status @@ -248,109 +424,6 @@ TEXT runtime·obsdsigprocmask(SB),NOSPLIT,$0 MOVW R0, ret+8(FP) RET -TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 - MOVW sig+8(FP), R0 - MOVD info+16(FP), R1 - MOVD ctx+24(FP), R2 - MOVD fn+0(FP), R11 - BL (R11) // Alignment for ELF ABI? - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$192 - // Save callee-save registers in the case of signal forwarding. - // Please refer to https://golang.org/issue/31827 . - MOVD R19, 8*4(RSP) - MOVD R20, 8*5(RSP) - MOVD R21, 8*6(RSP) - MOVD R22, 8*7(RSP) - MOVD R23, 8*8(RSP) - MOVD R24, 8*9(RSP) - MOVD R25, 8*10(RSP) - MOVD R26, 8*11(RSP) - MOVD R27, 8*12(RSP) - MOVD g, 8*13(RSP) - MOVD R29, 8*14(RSP) - FMOVD F8, 8*15(RSP) - FMOVD F9, 8*16(RSP) - FMOVD F10, 8*17(RSP) - FMOVD F11, 8*18(RSP) - FMOVD F12, 8*19(RSP) - FMOVD F13, 8*20(RSP) - FMOVD F14, 8*21(RSP) - FMOVD F15, 8*22(RSP) - - // If called from an external code context, g will not be set. - // Save R0, since runtime·load_g will clobber it. - MOVW R0, 8(RSP) // signum - MOVB runtime·iscgo(SB), R0 - CMP $0, R0 - BEQ 2(PC) - BL runtime·load_g(SB) - - MOVD R1, 16(RSP) - MOVD R2, 24(RSP) - BL runtime·sigtrampgo(SB) - - // Restore callee-save registers. - MOVD 8*4(RSP), R19 - MOVD 8*5(RSP), R20 - MOVD 8*6(RSP), R21 - MOVD 8*7(RSP), R22 - MOVD 8*8(RSP), R23 - MOVD 8*9(RSP), R24 - MOVD 8*10(RSP), R25 - MOVD 8*11(RSP), R26 - MOVD 8*12(RSP), R27 - MOVD 8*13(RSP), g - MOVD 8*14(RSP), R29 - FMOVD 8*15(RSP), F8 - FMOVD 8*16(RSP), F9 - FMOVD 8*17(RSP), F10 - FMOVD 8*18(RSP), F11 - FMOVD 8*19(RSP), F12 - FMOVD 8*20(RSP), F13 - FMOVD 8*21(RSP), F14 - FMOVD 8*22(RSP), F15 - - RET - -// int32 tfork(void *param, uintptr psize, M *mp, G *gp, void (*fn)(void)); -TEXT runtime·tfork(SB),NOSPLIT,$0 - - // Copy mp, gp and fn off parent stack for use by child. - MOVD mm+16(FP), R4 - MOVD gg+24(FP), R5 - MOVD fn+32(FP), R6 - - MOVD param+0(FP), R0 // arg 1 - param - MOVD psize+8(FP), R1 // arg 2 - psize - MOVD $8, R8 // sys___tfork - INVOKE_SYSCALL - - // Return if syscall failed. - BCC 4(PC) - NEG R0, R0 - MOVW R0, ret+40(FP) - RET - - // In parent, return. - CMP $0, R0 - BEQ 3(PC) - MOVW R0, ret+40(FP) - RET - - // Initialise m, g. - MOVD R5, g - MOVD R4, g_m(g) - - // Call fn. - BL (R6) - - // fn should never return. - MOVD $2, R8 // crash if reached - MOVD R8, (R8) - RET - TEXT runtime·sigaltstack(SB),NOSPLIT,$0 MOVD new+0(FP), R0 // arg 1 - new sigaltstack MOVD old+8(FP), R1 // arg 2 - old sigaltstack diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s index 3f02974d5b..085012f791 100644 --- a/src/runtime/tls_arm64.s +++ b/src/runtime/tls_arm64.s @@ -10,8 +10,10 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 #ifndef TLS_darwin +#ifndef GOOS_openbsd MOVB runtime·iscgo(SB), R0 CBZ R0, nocgo +#endif #endif MRS_TPIDR_R0 @@ -27,8 +29,10 @@ nocgo: TEXT runtime·save_g(SB),NOSPLIT,$0 #ifndef TLS_darwin +#ifndef GOOS_openbsd MOVB runtime·iscgo(SB), R0 CBZ R0, nocgo +#endif #endif MRS_TPIDR_R0 -- cgit v1.3-5-g9baa From ec4051763d439e7108bc673dd0b1bf1cbbc5dfc5 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Fri, 22 Jan 2021 15:00:35 +0000 Subject: runtime: fix typo in mgcscavenge.go recieved -> received Change-Id: I84336170e179832604e1311ea9263af36f9ce15a GitHub-Last-Rev: a6068c1d2b5a7711b93899f798dbc84f1ea339e4 GitHub-Pull-Request: golang/go#43845 Reviewed-on: https://go-review.googlesource.com/c/go/+/285675 Reviewed-by: Keith Randall Trust: Alberto Donizetti --- src/runtime/mgcscavenge.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go index 38f09309dc..a7c5bc49b8 100644 --- a/src/runtime/mgcscavenge.go +++ b/src/runtime/mgcscavenge.go @@ -562,7 +562,7 @@ func (p *pageAlloc) scavengeUnreserve(r addrRange, gen uint32) { func (p *pageAlloc) scavengeOne(work addrRange, max uintptr, mayUnlock bool) (uintptr, addrRange) { assertLockHeld(p.mheapLock) - // Defensively check if we've recieved an empty address range. + // Defensively check if we've received an empty address range. // If so, just return. if work.size() == 0 { // Nothing to do. -- cgit v1.3-5-g9baa From b268b607743ebf570396750208e0032870653edd Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Fri, 22 Jan 2021 19:32:43 +1100 Subject: runtime: remove pthread_kill/pthread_self for openbsd We're now using getthrid() and thrkill() instead. Updates #36435 Change-Id: I1c6bcfb9b46d149e0a2a10e936a244576489a88e Reviewed-on: https://go-review.googlesource.com/c/go/+/285692 Trust: Joel Sing Run-TryBot: Joel Sing Reviewed-by: Cherry Zhang --- src/runtime/sys_openbsd.go | 18 ------------------ src/runtime/sys_openbsd_amd64.s | 18 ------------------ src/runtime/sys_openbsd_arm64.s | 12 ------------ 3 files changed, 48 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/sys_openbsd.go b/src/runtime/sys_openbsd.go index 56de00aad5..2d41ed0d46 100644 --- a/src/runtime/sys_openbsd.go +++ b/src/runtime/sys_openbsd.go @@ -46,21 +46,6 @@ func pthread_create(attr *pthreadattr, start uintptr, arg unsafe.Pointer) int32 } func pthread_create_trampoline() -//go:nosplit -//go:cgo_unsafe_args -func pthread_self() (t pthread) { - libcCall(unsafe.Pointer(funcPC(pthread_self_trampoline)), unsafe.Pointer(&t)) - return -} -func pthread_self_trampoline() - -//go:nosplit -//go:cgo_unsafe_args -func pthread_kill(t pthread, sig uint32) { - libcCall(unsafe.Pointer(funcPC(pthread_kill_trampoline)), unsafe.Pointer(&t)) -} -func pthread_kill_trampoline() - // Tell the linker that the libc_* functions are to be found // in a system library, with the libc_ prefix missing. @@ -70,8 +55,5 @@ func pthread_kill_trampoline() //go:cgo_import_dynamic libc_pthread_attr_setdetachstate pthread_attr_setdetachstate "libpthread.so" //go:cgo_import_dynamic libc_pthread_create pthread_create "libpthread.so" //go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "libpthread.so" -//go:cgo_import_dynamic libc_pthread_self pthread_self "libpthread.so" -//go:cgo_import_dynamic libc_pthread_kill pthread_kill "libpthread.so" //go:cgo_import_dynamic _ _ "libpthread.so" -//go:cgo_import_dynamic _ _ "libc.so" diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index ac0ae27e45..1086557aab 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -150,24 +150,6 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 - PUSHQ BP - MOVQ SP, BP - MOVQ DI, BX // BX is caller-save - CALL libc_pthread_self(SB) - MOVQ AX, 0(BX) // return value - POPQ BP - RET - -TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 - PUSHQ BP - MOVQ SP, BP - MOVQ 8(DI), SI // arg 2 - sig - MOVQ 0(DI), DI // arg 1 - thread - CALL libc_pthread_kill(SB) - POPQ BP - RET - TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s index 90646bbe85..2ec9d038ba 100644 --- a/src/runtime/sys_openbsd_arm64.s +++ b/src/runtime/sys_openbsd_arm64.s @@ -188,18 +188,6 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 ADD $16, RSP RET -TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 - MOVD R0, R19 // pointer to args - CALL libc_pthread_self(SB) - MOVD R0, 0(R19) // return value - RET - -TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 - MOVW 8(R0), R1 // arg 2 - sig - MOVD 0(R0), R0 // arg 1 - thread - CALL libc_pthread_kill(SB) - RET - // Exit the entire program (like C exit) TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0 MOVW code+0(FP), R0 // arg 1 - status -- cgit v1.3-5-g9baa From dab3e5affefb7e0b157ad27fe4797c4c6f3c4ea6 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sun, 15 Nov 2020 23:28:57 +1100 Subject: runtime: switch runtime to libc for openbsd/amd64 Use libc rather than performing direct system calls for the runtime on openbsd/amd64. Updates #36435 Change-Id: Ib708009c3743f56a3fd6cb3bc731451e4a398849 Reviewed-on: https://go-review.googlesource.com/c/go/+/270379 Trust: Joel Sing Reviewed-by: Cherry Zhang --- src/runtime/defs_openbsd.go | 5 + src/runtime/defs_openbsd_amd64.go | 5 + src/runtime/mmap.go | 11 +- src/runtime/os_openbsd.go | 43 --- src/runtime/os_openbsd_syscall2.go | 95 +++++++ src/runtime/proc.go | 2 + src/runtime/signal_openbsd.go | 2 +- src/runtime/stubs2.go | 7 +- src/runtime/stubs3.go | 7 +- src/runtime/sys_openbsd2.go | 250 +++++++++++++++++ src/runtime/sys_openbsd_amd64.s | 552 ++++++++++++++++++------------------- src/runtime/timestub2.go | 5 +- 12 files changed, 641 insertions(+), 343 deletions(-) create mode 100644 src/runtime/os_openbsd_syscall2.go create mode 100644 src/runtime/sys_openbsd2.go (limited to 'src/runtime') diff --git a/src/runtime/defs_openbsd.go b/src/runtime/defs_openbsd.go index 57717abf7e..ff7e21c71e 100644 --- a/src/runtime/defs_openbsd.go +++ b/src/runtime/defs_openbsd.go @@ -56,6 +56,11 @@ const ( PTHREAD_CREATE_DETACHED = C.PTHREAD_CREATE_DETACHED + F_SETFD = C.F_SETFD + F_GETFL = C.F_GETFL + F_SETFL = C.F_SETFL + FD_CLOEXEC = C.FD_CLOEXEC + SIGHUP = C.SIGHUP SIGINT = C.SIGINT SIGQUIT = C.SIGQUIT diff --git a/src/runtime/defs_openbsd_amd64.go b/src/runtime/defs_openbsd_amd64.go index 01ca934cea..46f1245201 100644 --- a/src/runtime/defs_openbsd_amd64.go +++ b/src/runtime/defs_openbsd_amd64.go @@ -32,6 +32,11 @@ const ( _PTHREAD_CREATE_DETACHED = 0x1 + _F_SETFD = 0x2 + _F_GETFL = 0x3 + _F_SETFL = 0x4 + _FD_CLOEXEC = 0x1 + _SIGHUP = 0x1 _SIGINT = 0x2 _SIGQUIT = 0x3 diff --git a/src/runtime/mmap.go b/src/runtime/mmap.go index 9fe31cb416..1b1848b79e 100644 --- a/src/runtime/mmap.go +++ b/src/runtime/mmap.go @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !aix +// +build !darwin +// +build !js +// +build !linux !amd64 +// +build !linux !arm64 +// +build !openbsd // +build !plan9 // +build !solaris // +build !windows -// +build !linux !amd64 -// +build !linux !arm64 -// +build !js -// +build !darwin -// +build !aix package runtime diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index 56b686a2fa..6259b96c22 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -13,49 +13,6 @@ type mOS struct { waitsemacount uint32 } -//go:noescape -func setitimer(mode int32, new, old *itimerval) - -//go:noescape -func sigaction(sig uint32, new, old *sigactiont) - -//go:noescape -func sigaltstack(new, old *stackt) - -//go:noescape -func obsdsigprocmask(how int32, new sigset) sigset - -//go:nosplit -//go:nowritebarrierrec -func sigprocmask(how int32, new, old *sigset) { - n := sigset(0) - if new != nil { - n = *new - } - r := obsdsigprocmask(how, n) - if old != nil { - *old = r - } -} - -//go:noescape -func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 - -func raiseproc(sig uint32) - -func getthrid() int32 -func thrkill(tid int32, sig int) - -func kqueue() int32 - -//go:noescape -func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32 - -func pipe() (r, w int32, errno int32) -func pipe2(flags int32) (r, w int32, errno int32) -func closeonexec(fd int32) -func setNonblock(fd int32) - const ( _ESRCH = 3 _EWOULDBLOCK = _EAGAIN diff --git a/src/runtime/os_openbsd_syscall2.go b/src/runtime/os_openbsd_syscall2.go new file mode 100644 index 0000000000..74eb271c2c --- /dev/null +++ b/src/runtime/os_openbsd_syscall2.go @@ -0,0 +1,95 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,!amd64 + +package runtime + +import ( + "unsafe" +) + +//go:noescape +func sigaction(sig uint32, new, old *sigactiont) + +func kqueue() int32 + +//go:noescape +func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32 + +func raiseproc(sig uint32) + +func getthrid() int32 +func thrkill(tid int32, sig int) + +// read calls the read system call. +// It returns a non-negative number of bytes written or a negative errno value. +func read(fd int32, p unsafe.Pointer, n int32) int32 + +func closefd(fd int32) int32 + +func exit(code int32) +func usleep(usec uint32) + +// write calls the write system call. +// It returns a non-negative number of bytes written or a negative errno value. +//go:noescape +func write1(fd uintptr, p unsafe.Pointer, n int32) int32 + +//go:noescape +func open(name *byte, mode, perm int32) int32 + +// return value is only set on linux to be used in osinit() +func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32 + +// exitThread terminates the current thread, writing *wait = 0 when +// the stack is safe to reclaim. +// +//go:noescape +func exitThread(wait *uint32) + +//go:noescape +func obsdsigprocmask(how int32, new sigset) sigset + +//go:nosplit +//go:nowritebarrierrec +func sigprocmask(how int32, new, old *sigset) { + n := sigset(0) + if new != nil { + n = *new + } + r := obsdsigprocmask(how, n) + if old != nil { + *old = r + } +} + +func pipe() (r, w int32, errno int32) +func pipe2(flags int32) (r, w int32, errno int32) + +//go:noescape +func setitimer(mode int32, new, old *itimerval) + +//go:noescape +func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 + +// mmap calls the mmap system call. It is implemented in assembly. +// We only pass the lower 32 bits of file offset to the +// assembly routine; the higher bits (if required), should be provided +// by the assembly routine as 0. +// The err result is an OS error code such as ENOMEM. +func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int) + +// munmap calls the munmap system call. It is implemented in assembly. +func munmap(addr unsafe.Pointer, n uintptr) + +func nanotime1() int64 + +//go:noescape +func sigaltstack(new, old *stackt) + +func closeonexec(fd int32) +func setNonblock(fd int32) + +func walltime1() (sec int64, nsec int32) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 30033712aa..aa44c625c5 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1212,6 +1212,8 @@ func usesLibcall() bool { switch GOOS { case "aix", "darwin", "illumos", "ios", "solaris", "windows": return true + case "openbsd": + return GOARCH == "amd64" } return false } diff --git a/src/runtime/signal_openbsd.go b/src/runtime/signal_openbsd.go index 99c601ce58..d2c5c5e39a 100644 --- a/src/runtime/signal_openbsd.go +++ b/src/runtime/signal_openbsd.go @@ -37,5 +37,5 @@ var sigtable = [...]sigTabT{ /* 29 */ {_SigNotify, "SIGINFO: status request from keyboard"}, /* 30 */ {_SigNotify, "SIGUSR1: user-defined signal 1"}, /* 31 */ {_SigNotify, "SIGUSR2: user-defined signal 2"}, - /* 32 */ {_SigNotify, "SIGTHR: reserved"}, + /* 32 */ {0, "SIGTHR: reserved"}, // thread AST - cannot be registered. } diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go index 4a1a5cc3d9..85088b3ab9 100644 --- a/src/runtime/stubs2.go +++ b/src/runtime/stubs2.go @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !aix +// +build !darwin +// +build !js +// +build !openbsd // +build !plan9 // +build !solaris // +build !windows -// +build !js -// +build !darwin -// +build !aix package runtime diff --git a/src/runtime/stubs3.go b/src/runtime/stubs3.go index 95eecc7eca..1885d32051 100644 --- a/src/runtime/stubs3.go +++ b/src/runtime/stubs3.go @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !aix +// +build !darwin +// +build !freebsd +// +build !openbsd // +build !plan9 // +build !solaris -// +build !freebsd -// +build !darwin -// +build !aix package runtime diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go new file mode 100644 index 0000000000..73592df226 --- /dev/null +++ b/src/runtime/sys_openbsd2.go @@ -0,0 +1,250 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package runtime + +import "unsafe" + +// This is exported via linkname to assembly in runtime/cgo. +//go:linkname exit +//go:nosplit +//go:cgo_unsafe_args +func exit(code int32) { + libcCall(unsafe.Pointer(funcPC(exit_trampoline)), unsafe.Pointer(&code)) +} +func exit_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func getthrid() (tid int32) { + libcCall(unsafe.Pointer(funcPC(getthrid_trampoline)), unsafe.Pointer(&tid)) + return +} +func getthrid_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func raiseproc(sig uint32) { + libcCall(unsafe.Pointer(funcPC(raiseproc_trampoline)), unsafe.Pointer(&sig)) +} +func raiseproc_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func thrkill(tid int32, sig int) { + libcCall(unsafe.Pointer(funcPC(thrkill_trampoline)), unsafe.Pointer(&tid)) +} +func thrkill_trampoline() + +// mmap is used to do low-level memory allocation via mmap. Don't allow stack +// splits, since this function (used by sysAlloc) is called in a lot of low-level +// parts of the runtime and callers often assume it won't acquire any locks. +// go:nosplit +func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (unsafe.Pointer, int) { + args := struct { + addr unsafe.Pointer + n uintptr + prot, flags, fd int32 + off uint32 + ret1 unsafe.Pointer + ret2 int + }{addr, n, prot, flags, fd, off, nil, 0} + libcCall(unsafe.Pointer(funcPC(mmap_trampoline)), unsafe.Pointer(&args)) + return args.ret1, args.ret2 +} +func mmap_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func munmap(addr unsafe.Pointer, n uintptr) { + libcCall(unsafe.Pointer(funcPC(munmap_trampoline)), unsafe.Pointer(&addr)) +} +func munmap_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func madvise(addr unsafe.Pointer, n uintptr, flags int32) { + libcCall(unsafe.Pointer(funcPC(madvise_trampoline)), unsafe.Pointer(&addr)) +} +func madvise_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func open(name *byte, mode, perm int32) (ret int32) { + return libcCall(unsafe.Pointer(funcPC(open_trampoline)), unsafe.Pointer(&name)) +} +func open_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func closefd(fd int32) int32 { + return libcCall(unsafe.Pointer(funcPC(close_trampoline)), unsafe.Pointer(&fd)) +} +func close_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func read(fd int32, p unsafe.Pointer, n int32) int32 { + return libcCall(unsafe.Pointer(funcPC(read_trampoline)), unsafe.Pointer(&fd)) +} +func read_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func write1(fd uintptr, p unsafe.Pointer, n int32) int32 { + return libcCall(unsafe.Pointer(funcPC(write_trampoline)), unsafe.Pointer(&fd)) +} +func write_trampoline() + +func pipe() (r, w int32, errno int32) { + return pipe2(0) +} + +func pipe2(flags int32) (r, w int32, errno int32) { + var p [2]int32 + args := struct { + p unsafe.Pointer + flags int32 + }{noescape(unsafe.Pointer(&p)), flags} + errno = libcCall(unsafe.Pointer(funcPC(pipe2_trampoline)), unsafe.Pointer(&args)) + return p[0], p[1], errno +} +func pipe2_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func setitimer(mode int32, new, old *itimerval) { + libcCall(unsafe.Pointer(funcPC(setitimer_trampoline)), unsafe.Pointer(&mode)) +} +func setitimer_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func usleep(usec uint32) { + libcCall(unsafe.Pointer(funcPC(usleep_trampoline)), unsafe.Pointer(&usec)) +} +func usleep_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 { + return libcCall(unsafe.Pointer(funcPC(sysctl_trampoline)), unsafe.Pointer(&mib)) +} +func sysctl_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func fcntl(fd, cmd, arg int32) int32 { + return libcCall(unsafe.Pointer(funcPC(fcntl_trampoline)), unsafe.Pointer(&fd)) +} +func fcntl_trampoline() + +//go:nosplit +func nanotime1() int64 { + var ts timespec + args := struct { + clock_id int32 + tp unsafe.Pointer + }{_CLOCK_MONOTONIC, unsafe.Pointer(&ts)} + libcCall(unsafe.Pointer(funcPC(clock_gettime_trampoline)), unsafe.Pointer(&args)) + return ts.tv_sec*1e9 + int64(ts.tv_nsec) +} +func clock_gettime_trampoline() + +//go:nosplit +func walltime1() (int64, int32) { + var ts timespec + args := struct { + clock_id int32 + tp unsafe.Pointer + }{_CLOCK_REALTIME, unsafe.Pointer(&ts)} + libcCall(unsafe.Pointer(funcPC(clock_gettime_trampoline)), unsafe.Pointer(&args)) + return ts.tv_sec, int32(ts.tv_nsec) +} + +//go:nosplit +//go:cgo_unsafe_args +func kqueue() int32 { + return libcCall(unsafe.Pointer(funcPC(kqueue_trampoline)), nil) +} +func kqueue_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32 { + return libcCall(unsafe.Pointer(funcPC(kevent_trampoline)), unsafe.Pointer(&kq)) +} +func kevent_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func sigaction(sig uint32, new *sigactiont, old *sigactiont) { + libcCall(unsafe.Pointer(funcPC(sigaction_trampoline)), unsafe.Pointer(&sig)) +} +func sigaction_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func sigprocmask(how uint32, new *sigset, old *sigset) { + libcCall(unsafe.Pointer(funcPC(sigprocmask_trampoline)), unsafe.Pointer(&how)) +} +func sigprocmask_trampoline() + +//go:nosplit +//go:cgo_unsafe_args +func sigaltstack(new *stackt, old *stackt) { + libcCall(unsafe.Pointer(funcPC(sigaltstack_trampoline)), unsafe.Pointer(&new)) +} +func sigaltstack_trampoline() + +// Not used on OpenBSD, but must be defined. +func exitThread(wait *uint32) { +} + +//go:nosplit +func closeonexec(fd int32) { + fcntl(fd, _F_SETFD, _FD_CLOEXEC) +} + +//go:nosplit +func setNonblock(fd int32) { + flags := fcntl(fd, _F_GETFL, 0) + fcntl(fd, _F_SETFL, flags|_O_NONBLOCK) +} + +// Tell the linker that the libc_* functions are to be found +// in a system library, with the libc_ prefix missing. + +//go:cgo_import_dynamic libc_errno __errno "libc.so" +//go:cgo_import_dynamic libc_exit exit "libc.so" +//go:cgo_import_dynamic libc_getthrid getthrid "libc.so" +//go:cgo_import_dynamic libc_sched_yield sched_yield "libc.so" +//go:cgo_import_dynamic libc_thrkill thrkill "libc.so" + +//go:cgo_import_dynamic libc_mmap mmap "libc.so" +//go:cgo_import_dynamic libc_munmap munmap "libc.so" +//go:cgo_import_dynamic libc_madvise madvise "libc.so" + +//go:cgo_import_dynamic libc_open open "libc.so" +//go:cgo_import_dynamic libc_close close "libc.so" +//go:cgo_import_dynamic libc_read read "libc.so" +//go:cgo_import_dynamic libc_write write "libc.so" +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so" +//go:cgo_import_dynamic libc_setitimer setitimer "libc.so" +//go:cgo_import_dynamic libc_usleep usleep "libc.so" +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" +//go:cgo_import_dynamic libc_getpid getpid "libc.so" +//go:cgo_import_dynamic libc_kill kill "libc.so" +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + +//go:cgo_import_dynamic libc_sigaction sigaction "libc.so" +//go:cgo_import_dynamic libc_sigaltstack sigaltstack "libc.so" + +//go:cgo_import_dynamic _ _ "libc.so" diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 1086557aab..4680a7f7aa 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -150,13 +150,23 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 POPQ BP RET +TEXT runtime·thrkill_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 - signal + MOVQ $0, DX // arg 3 - tcb + MOVL 0(DI), DI // arg 1 - tid + CALL libc_thrkill(SB) + POPQ BP + RET + TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 8(DI), SI // arg 2 - clock_id MOVQ 16(DI), DX // arg 3 - abstime - MOVQ 24(DI), CX // arg 3 - lock - MOVQ 32(DI), R8 // arg 4 - abort + MOVQ 24(DI), CX // arg 4 - lock + MOVQ 32(DI), R8 // arg 5 - abort MOVQ 0(DI), DI // arg 1 - id CALL libc_thrsleep(SB) POPQ BP @@ -171,6 +181,35 @@ TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$0 POPQ BP RET +TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 0(DI), DI // arg 1 exit status + CALL libc_exit(SB) + MOVL $0xf1, 0xf1 // crash + POPQ BP + RET + +TEXT runtime·getthrid_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ DI, BX // BX is caller-save + CALL libc_getthrid(SB) + MOVL AX, 0(BX) // return value + POPQ BP + RET + +TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 0(DI), BX // signal + CALL libc_getpid(SB) + MOVL AX, DI // arg 1 pid + MOVL BX, SI // arg 2 signal + CALL libc_kill(SB) + POPQ BP + RET + TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP @@ -178,290 +217,231 @@ TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0 POPQ BP RET -// Exit the entire program (like C exit) -TEXT runtime·exit(SB),NOSPLIT,$-8 - MOVL code+0(FP), DI // arg 1 - exit status - MOVL $1, AX // sys_exit - SYSCALL - MOVL $0xf1, 0xf1 // crash - RET - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$0-8 - MOVQ wait+0(FP), DI // arg 1 - notdead - MOVL $302, AX // sys___threxit - SYSCALL - MOVL $0xf1, 0xf1 // crash - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$-8 - MOVQ name+0(FP), DI // arg 1 pathname - MOVL mode+8(FP), SI // arg 2 flags - MOVL perm+12(FP), DX // arg 3 mode - MOVL $5, AX - SYSCALL - JCC 2(PC) - MOVL $-1, AX - MOVL AX, ret+16(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$-8 - MOVL fd+0(FP), DI // arg 1 fd - MOVL $6, AX - SYSCALL - JCC 2(PC) - MOVL $-1, AX - MOVL AX, ret+8(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$-8 - MOVL fd+0(FP), DI // arg 1 fd - MOVQ p+8(FP), SI // arg 2 buf - MOVL n+16(FP), DX // arg 3 count - MOVL $3, AX - SYSCALL - JCC 2(PC) - NEGQ AX // caller expects negative errno - MOVL AX, ret+24(FP) - RET - -// func pipe() (r, w int32, errno int32) -TEXT runtime·pipe(SB),NOSPLIT,$0-12 - LEAQ r+0(FP), DI - MOVL $263, AX - SYSCALL - MOVL AX, errno+8(FP) - RET - -// func pipe2(flags int32) (r, w int32, errno int32) -TEXT runtime·pipe2(SB),NOSPLIT,$0-20 - LEAQ r+8(FP), DI - MOVL flags+0(FP), SI - MOVL $101, AX - SYSCALL - MOVL AX, errno+16(FP) - RET - -TEXT runtime·write1(SB),NOSPLIT,$-8 - MOVQ fd+0(FP), DI // arg 1 - fd - MOVQ p+8(FP), SI // arg 2 - buf - MOVL n+16(FP), DX // arg 3 - nbyte - MOVL $4, AX // sys_write - SYSCALL - JCC 2(PC) - NEGQ AX // caller expects negative errno - MOVL AX, ret+24(FP) - RET - -TEXT runtime·usleep(SB),NOSPLIT,$16 - MOVL $0, DX - MOVL usec+0(FP), AX - MOVL $1000000, CX - DIVL CX - MOVQ AX, 0(SP) // tv_sec - MOVL $1000, AX - MULL DX - MOVQ AX, 8(SP) // tv_nsec - - MOVQ SP, DI // arg 1 - rqtp - MOVQ $0, SI // arg 2 - rmtp - MOVL $91, AX // sys_nanosleep - SYSCALL - RET - -TEXT runtime·getthrid(SB),NOSPLIT,$0-4 - MOVL $299, AX // sys_getthrid - SYSCALL - MOVL AX, ret+0(FP) - RET - -TEXT runtime·thrkill(SB),NOSPLIT,$0-16 - MOVL tid+0(FP), DI // arg 1 - tid - MOVQ sig+8(FP), SI // arg 2 - signum - MOVQ $0, DX // arg 3 - tcb - MOVL $119, AX // sys_thrkill - SYSCALL - RET - -TEXT runtime·raiseproc(SB),NOSPLIT,$16 - MOVL $20, AX // sys_getpid - SYSCALL - MOVQ AX, DI // arg 1 - pid - MOVL sig+0(FP), SI // arg 2 - signum - MOVL $122, AX // sys_kill - SYSCALL - RET - -TEXT runtime·setitimer(SB),NOSPLIT,$-8 - MOVL mode+0(FP), DI // arg 1 - which - MOVQ new+8(FP), SI // arg 2 - itv - MOVQ old+16(FP), DX // arg 3 - oitv - MOVL $69, AX // sys_setitimer - SYSCALL - RET - -// func walltime1() (sec int64, nsec int32) -TEXT runtime·walltime1(SB), NOSPLIT, $32 - MOVQ $0, DI // arg 1 - clock_id - LEAQ 8(SP), SI // arg 2 - tp - MOVL $87, AX // sys_clock_gettime - SYSCALL - MOVQ 8(SP), AX // sec - MOVQ 16(SP), DX // nsec - - // sec is in AX, nsec in DX - MOVQ AX, sec+0(FP) - MOVL DX, nsec+8(FP) - RET - -TEXT runtime·nanotime1(SB),NOSPLIT,$24 - MOVQ CLOCK_MONOTONIC, DI // arg 1 - clock_id - LEAQ 8(SP), SI // arg 2 - tp - MOVL $87, AX // sys_clock_gettime - SYSCALL - MOVQ 8(SP), AX // sec - MOVQ 16(SP), DX // nsec - - // sec is in AX, nsec in DX - // return nsec in AX - IMULQ $1000000000, AX - ADDQ DX, AX - MOVQ AX, ret+0(FP) - RET - -TEXT runtime·sigaction(SB),NOSPLIT,$-8 - MOVL sig+0(FP), DI // arg 1 - signum - MOVQ new+8(FP), SI // arg 2 - nsa - MOVQ old+16(FP), DX // arg 3 - osa - MOVL $46, AX - SYSCALL - JCC 2(PC) - MOVL $0xf1, 0xf1 // crash - RET - -TEXT runtime·obsdsigprocmask(SB),NOSPLIT,$0 - MOVL how+0(FP), DI // arg 1 - how - MOVL new+4(FP), SI // arg 2 - set - MOVL $48, AX // sys_sigprocmask - SYSCALL - JCC 2(PC) - MOVL $0xf1, 0xf1 // crash - MOVL AX, ret+8(FP) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$0 - MOVQ addr+0(FP), DI // arg 1 - addr - MOVQ n+8(FP), SI // arg 2 - len - MOVL prot+16(FP), DX // arg 3 - prot - MOVL flags+20(FP), R10 // arg 4 - flags - MOVL fd+24(FP), R8 // arg 5 - fd - MOVL off+28(FP), R9 - SUBQ $16, SP - MOVQ R9, 8(SP) // arg 7 - offset (passed on stack) - MOVQ $0, R9 // arg 6 - pad - MOVL $197, AX - SYSCALL - JCC ok - ADDQ $16, SP - MOVQ $0, p+32(FP) - MOVQ AX, err+40(FP) +TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 + PUSHQ BP // make a frame; keep stack aligned + MOVQ SP, BP + MOVQ DI, BX + MOVQ 0(BX), DI // arg 1 addr + MOVQ 8(BX), SI // arg 2 len + MOVL 16(BX), DX // arg 3 prot + MOVL 20(BX), CX // arg 4 flags + MOVL 24(BX), R8 // arg 5 fid + MOVL 28(BX), R9 // arg 6 offset + CALL libc_mmap(SB) + XORL DX, DX + CMPQ AX, $-1 + JNE ok + CALL libc_errno(SB) + MOVLQSX (AX), DX // errno + XORQ AX, AX +ok: + MOVQ AX, 32(BX) + MOVQ DX, 40(BX) + POPQ BP RET + +TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 len + MOVQ 0(DI), DI // arg 1 addr + CALL libc_munmap(SB) + TESTQ AX, AX + JEQ 2(PC) + MOVL $0xf1, 0xf1 // crash + POPQ BP + RET + +TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 len + MOVL 16(DI), DX // arg 3 advice + MOVQ 0(DI), DI // arg 1 addr + CALL libc_madvise(SB) + // ignore failure - maybe pages are locked + POPQ BP + RET + +TEXT runtime·open_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 - flags + MOVL 12(DI), DX // arg 3 - mode + MOVQ 0(DI), DI // arg 1 - path + XORL AX, AX // vararg: say "no float args" + CALL libc_open(SB) + POPQ BP + RET + +TEXT runtime·close_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 0(DI), DI // arg 1 - fd + CALL libc_close(SB) + POPQ BP + RET + +TEXT runtime·read_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 - buf + MOVL 16(DI), DX // arg 3 - count + MOVL 0(DI), DI // arg 1 - fd + CALL libc_read(SB) + TESTL AX, AX + JGE noerr + CALL libc_errno(SB) + MOVL (AX), AX // errno + NEGL AX // caller expects negative errno value +noerr: + POPQ BP + RET + +TEXT runtime·write_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 buf + MOVL 16(DI), DX // arg 3 count + MOVL 0(DI), DI // arg 1 fd + CALL libc_write(SB) + TESTL AX, AX + JGE noerr + CALL libc_errno(SB) + MOVL (AX), AX // errno + NEGL AX // caller expects negative errno value +noerr: + POPQ BP + RET + +TEXT runtime·pipe2_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 flags + MOVQ 0(DI), DI // arg 1 filedes + CALL libc_pipe2(SB) + TESTL AX, AX + JEQ 3(PC) + CALL libc_errno(SB) + MOVL (AX), AX // errno + NEGL AX // caller expects negative errno value + POPQ BP + RET + +TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 new + MOVQ 16(DI), DX // arg 3 old + MOVL 0(DI), DI // arg 1 which + CALL libc_setitimer(SB) + POPQ BP + RET + +TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 0(DI), DI // arg 1 usec + CALL libc_usleep(SB) + POPQ BP + RET + +TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 8(DI), SI // arg 2 miblen + MOVQ 16(DI), DX // arg 3 out + MOVQ 24(DI), CX // arg 4 size + MOVQ 32(DI), R8 // arg 5 dst + MOVQ 40(DI), R9 // arg 6 ndst + MOVQ 0(DI), DI // arg 1 mib + CALL libc_sysctl(SB) + POPQ BP + RET + +TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + CALL libc_kqueue(SB) + POPQ BP + RET + +TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 keventt + MOVL 16(DI), DX // arg 3 nch + MOVQ 24(DI), CX // arg 4 ev + MOVL 32(DI), R8 // arg 5 nev + MOVQ 40(DI), R9 // arg 6 ts + MOVL 0(DI), DI // arg 1 kq + CALL libc_kevent(SB) + CMPL AX, $-1 + JNE ok + CALL libc_errno(SB) + MOVL (AX), AX // errno + NEGL AX // caller expects negative errno value ok: - ADDQ $16, SP - MOVQ AX, p+32(FP) - MOVQ $0, err+40(FP) - RET - -TEXT runtime·munmap(SB),NOSPLIT,$0 - MOVQ addr+0(FP), DI // arg 1 - addr - MOVQ n+8(FP), SI // arg 2 - len - MOVL $73, AX // sys_munmap - SYSCALL - JCC 2(PC) - MOVL $0xf1, 0xf1 // crash - RET - -TEXT runtime·madvise(SB),NOSPLIT,$0 - MOVQ addr+0(FP), DI // arg 1 - addr - MOVQ n+8(FP), SI // arg 2 - len - MOVL flags+16(FP), DX // arg 3 - behav - MOVQ $75, AX // sys_madvise - SYSCALL - JCC 2(PC) - MOVL $-1, AX - MOVL AX, ret+24(FP) - RET - -TEXT runtime·sigaltstack(SB),NOSPLIT,$-8 - MOVQ new+0(FP), DI // arg 1 - nss - MOVQ old+8(FP), SI // arg 2 - oss - MOVQ $288, AX // sys_sigaltstack - SYSCALL - JCC 2(PC) - MOVL $0xf1, 0xf1 // crash - RET - -TEXT runtime·sysctl(SB),NOSPLIT,$0 - MOVQ mib+0(FP), DI // arg 1 - name - MOVL miblen+8(FP), SI // arg 2 - namelen - MOVQ out+16(FP), DX // arg 3 - oldp - MOVQ size+24(FP), R10 // arg 4 - oldlenp - MOVQ dst+32(FP), R8 // arg 5 - newp - MOVQ ndst+40(FP), R9 // arg 6 - newlen - MOVQ $202, AX // sys___sysctl - SYSCALL - JCC 4(PC) - NEGQ AX - MOVL AX, ret+48(FP) - RET - MOVL $0, AX - MOVL AX, ret+48(FP) - RET - -// int32 runtime·kqueue(void); -TEXT runtime·kqueue(SB),NOSPLIT,$0 - MOVL $269, AX - SYSCALL - JCC 2(PC) - NEGQ AX - MOVL AX, ret+0(FP) - RET - -// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout); -TEXT runtime·kevent(SB),NOSPLIT,$0 - MOVL kq+0(FP), DI - MOVQ ch+8(FP), SI - MOVL nch+16(FP), DX - MOVQ ev+24(FP), R10 - MOVL nev+32(FP), R8 - MOVQ ts+40(FP), R9 - MOVL $72, AX - SYSCALL - JCC 2(PC) - NEGQ AX - MOVL AX, ret+48(FP) - RET - -// void runtime·closeonexec(int32 fd); -TEXT runtime·closeonexec(SB),NOSPLIT,$0 - MOVL fd+0(FP), DI // fd - MOVQ $2, SI // F_SETFD - MOVQ $1, DX // FD_CLOEXEC - MOVL $92, AX // fcntl - SYSCALL - RET - -// func runtime·setNonblock(int32 fd) -TEXT runtime·setNonblock(SB),NOSPLIT,$0-4 - MOVL fd+0(FP), DI // fd - MOVQ $3, SI // F_GETFL - MOVQ $0, DX - MOVL $92, AX // fcntl - SYSCALL - MOVL fd+0(FP), DI // fd - MOVQ $4, SI // F_SETFL - MOVQ $4, DX // O_NONBLOCK - ORL AX, DX - MOVL $92, AX // fcntl - SYSCALL + POPQ BP + RET + +TEXT runtime·clock_gettime_trampoline(SB),NOSPLIT,$0 + PUSHQ BP // make a frame; keep stack aligned + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 tp + MOVL 0(DI), DI // arg 1 clock_id + CALL libc_clock_gettime(SB) + TESTL AX, AX + JEQ 2(PC) + MOVL $0xf1, 0xf1 // crash + POPQ BP + RET + +TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVL 4(DI), SI // arg 2 cmd + MOVL 8(DI), DX // arg 3 arg + MOVL 0(DI), DI // arg 1 fd + XORL AX, AX // vararg: say "no float args" + CALL libc_fcntl(SB) + POPQ BP + RET + +TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 new + MOVQ 16(DI), DX // arg 3 old + MOVL 0(DI), DI // arg 1 sig + CALL libc_sigaction(SB) + TESTL AX, AX + JEQ 2(PC) + MOVL $0xf1, 0xf1 // crash + POPQ BP + RET + +TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 new + MOVQ 16(DI), DX // arg 3 old + MOVL 0(DI), DI // arg 1 how + CALL libc_pthread_sigmask(SB) + TESTL AX, AX + JEQ 2(PC) + MOVL $0xf1, 0xf1 // crash + POPQ BP + RET + +TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + MOVQ 8(DI), SI // arg 2 old + MOVQ 0(DI), DI // arg 1 new + CALL libc_sigaltstack(SB) + TESTQ AX, AX + JEQ 2(PC) + MOVL $0xf1, 0xf1 // crash + POPQ BP RET diff --git a/src/runtime/timestub2.go b/src/runtime/timestub2.go index 6d73aabc35..68777ee4a9 100644 --- a/src/runtime/timestub2.go +++ b/src/runtime/timestub2.go @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build !aix // +build !darwin -// +build !windows // +build !freebsd -// +build !aix +// +build !openbsd // +build !solaris +// +build !windows package runtime -- cgit v1.3-5-g9baa From 3a778ff50f7091b8a64875c8ed95bfaacf3d334c Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 22 Jan 2021 09:47:59 -0500 Subject: runtime: check for g0 stack last in signal handler In the signal handler, we adjust gsingal's stack to the stack where the signal is delivered. TSAN may deliver signals to the g0 stack, so we have a special case for the g0 stack. However, we don't have very good accuracy in determining the g0 stack's bounds, as it is system allocated and we don't know where it is exactly. If g0.stack.lo is too low, the condition may be triggered incorrectly, where we thought the signal is delivered to the g0 stack but it is actually not. In this case, as the stack bounds is actually wrong, when the stack grows, it may go below the (inaccurate) lower bound, causing "morestack on gsignal" crash. Check for g0 stack last to avoid this situation. There could still be false positives, but for those cases we'll crash either way. (If we could in some way determine the g0 stack bounds accurately, this would not matter (but probably doesn't hurt).) Fixes #43853. Change-Id: I759717c5aa2b0deb83ffb23e57b7625a6b249ee8 Reviewed-on: https://go-review.googlesource.com/c/go/+/285772 Trust: Cherry Zhang Reviewed-by: Michael Pratt --- src/runtime/proc.go | 5 +++++ src/runtime/signal_unix.go | 30 +++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index aa44c625c5..d51dcb0d22 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1251,6 +1251,11 @@ func mstart() { // Initialize stack bounds from system stack. // Cgo may have left stack size in stack.hi. // minit may update the stack bounds. + // + // Note: these bounds may not be very accurate. + // We set hi to &size, but there are things above + // it. The 1024 is supposed to compensate this, + // but is somewhat arbitrary. size := _g_.stack.hi if size == 0 { size = 8192 * sys.StackGuardMultiplier diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index 382ba37a87..3f70707ab4 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -475,6 +475,14 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool { return false } + var st stackt + sigaltstack(nil, &st) + stsp := uintptr(unsafe.Pointer(st.ss_sp)) + if st.ss_flags&_SS_DISABLE == 0 && sp >= stsp && sp < stsp+st.ss_size { + setGsignalStack(&st, gsigStack) + return true + } + if sp >= mp.g0.stack.lo && sp < mp.g0.stack.hi { // The signal was delivered on the g0 stack. // This can happen when linked with C code @@ -483,29 +491,25 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool { // the signal handler directly when C code, // including C code called via cgo, calls a // TSAN-intercepted function such as malloc. + // + // We check this condition last as g0.stack.lo + // may be not very accurate (see mstart). st := stackt{ss_size: mp.g0.stack.hi - mp.g0.stack.lo} setSignalstackSP(&st, mp.g0.stack.lo) setGsignalStack(&st, gsigStack) return true } - var st stackt - sigaltstack(nil, &st) + // sp is not within gsignal stack, g0 stack, or sigaltstack. Bad. + setg(nil) + needm() if st.ss_flags&_SS_DISABLE != 0 { - setg(nil) - needm() noSignalStack(sig) - dropm() - } - stsp := uintptr(unsafe.Pointer(st.ss_sp)) - if sp < stsp || sp >= stsp+st.ss_size { - setg(nil) - needm() + } else { sigNotOnStack(sig) - dropm() } - setGsignalStack(&st, gsigStack) - return true + dropm() + return false } // crashing is the number of m's we have waited for when implementing -- cgit v1.3-5-g9baa From eb21b31e487344fb0045b3ef7b14df9521b94952 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 22 Jan 2021 16:35:21 -0500 Subject: runtime: define dummy msanmove In msan mode we instrument code with msan* functions, including msanmove. In some configurations the code is instrumented by the compiler but msan is not actually linked in, so we need dummy definitions for those functions so the program links. msanmove is newly added in CL 270859 but a dummy definition in msan0.go was not added, causing link failures. Add it. Change-Id: I91f8e749919f57f1182e90b43412b0282cf4767c Reviewed-on: https://go-review.googlesource.com/c/go/+/285955 Trust: Cherry Zhang Reviewed-by: Ian Lance Taylor --- src/runtime/msan0.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/msan0.go b/src/runtime/msan0.go index 117c5e5789..374d13f30b 100644 --- a/src/runtime/msan0.go +++ b/src/runtime/msan0.go @@ -16,7 +16,8 @@ const msanenabled = false // Because msanenabled is false, none of these functions should be called. -func msanread(addr unsafe.Pointer, sz uintptr) { throw("msan") } -func msanwrite(addr unsafe.Pointer, sz uintptr) { throw("msan") } -func msanmalloc(addr unsafe.Pointer, sz uintptr) { throw("msan") } -func msanfree(addr unsafe.Pointer, sz uintptr) { throw("msan") } +func msanread(addr unsafe.Pointer, sz uintptr) { throw("msan") } +func msanwrite(addr unsafe.Pointer, sz uintptr) { throw("msan") } +func msanmalloc(addr unsafe.Pointer, sz uintptr) { throw("msan") } +func msanfree(addr unsafe.Pointer, sz uintptr) { throw("msan") } +func msanmove(dst, src unsafe.Pointer, sz uintptr) { throw("msan") } -- cgit v1.3-5-g9baa From 66ee8b158f0a9e9fdc6cc2118926cb4bea497128 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sat, 23 Jan 2021 06:18:30 +1100 Subject: runtime: restore cgo_import_dynamic for libc.so on openbsd This was removed in change 285692, however we need to explicitly pull libc.so in when libpthread.so is being used. The current code works on openbsd/amd64 since we pull libc.so in via runtime/sys_openbsd2.go, however openbsd/arm64 does not do this currently. Change-Id: Ibe93d936a22e69e2fe12620f6d27ccca7a91dba5 Reviewed-on: https://go-review.googlesource.com/c/go/+/285912 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- src/runtime/sys_openbsd.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/runtime') diff --git a/src/runtime/sys_openbsd.go b/src/runtime/sys_openbsd.go index 2d41ed0d46..fcddf4d6a5 100644 --- a/src/runtime/sys_openbsd.go +++ b/src/runtime/sys_openbsd.go @@ -57,3 +57,4 @@ func pthread_create_trampoline() //go:cgo_import_dynamic libc_pthread_sigmask pthread_sigmask "libpthread.so" //go:cgo_import_dynamic _ _ "libpthread.so" +//go:cgo_import_dynamic _ _ "libc.so" -- cgit v1.3-5-g9baa From 8634a234df2a9e93ed1de58bf59d2eb843d8f464 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 16 Nov 2020 04:47:56 +1100 Subject: runtime,syscall: convert syscall on openbsd/amd64 to libc Convert the syscall package on openbsd/amd64 to use libc rather than performing direct system calls. Updates #36435 Change-Id: Ieb5926a91ed34f7c722e3667004ec484c86804ef Reviewed-on: https://go-review.googlesource.com/c/go/+/270380 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- src/runtime/sys_openbsd3.go | 113 ++++ src/runtime/sys_openbsd_amd64.s | 333 ++++++++++++ src/syscall/asm9_unix1_amd64.s | 4 +- src/syscall/asm_openbsd_amd64.s | 32 ++ src/syscall/asm_unix_amd64.s | 2 +- src/syscall/exec_bsd.go | 2 +- src/syscall/exec_darwin.go | 259 --------- src/syscall/exec_libc2.go | 261 +++++++++ src/syscall/exec_unix.go | 4 + src/syscall/mkall.sh | 9 +- src/syscall/mkasm.go | 64 +++ src/syscall/mkasm_darwin.go | 57 -- src/syscall/mkasm_openbsd.go | 58 ++ src/syscall/mksyscall.pl | 30 +- src/syscall/syscall_openbsd.go | 5 - src/syscall/syscall_openbsd1.go | 13 + src/syscall/syscall_openbsd_libc.go | 93 ++++ src/syscall/zsyscall_darwin_amd64.s | 2 +- src/syscall/zsyscall_darwin_arm64.s | 2 +- src/syscall/zsyscall_openbsd_amd64.go | 967 +++++++++++++++++++++++++++++----- src/syscall/zsyscall_openbsd_amd64.s | 233 ++++++++ 21 files changed, 2066 insertions(+), 477 deletions(-) create mode 100644 src/runtime/sys_openbsd3.go create mode 100644 src/syscall/asm_openbsd_amd64.s delete mode 100644 src/syscall/exec_darwin.go create mode 100644 src/syscall/exec_libc2.go create mode 100644 src/syscall/mkasm.go delete mode 100644 src/syscall/mkasm_darwin.go create mode 100644 src/syscall/mkasm_openbsd.go create mode 100644 src/syscall/syscall_openbsd1.go create mode 100644 src/syscall/syscall_openbsd_libc.go create mode 100644 src/syscall/zsyscall_openbsd_amd64.s (limited to 'src/runtime') diff --git a/src/runtime/sys_openbsd3.go b/src/runtime/sys_openbsd3.go new file mode 100644 index 0000000000..a8f9b0ee14 --- /dev/null +++ b/src/runtime/sys_openbsd3.go @@ -0,0 +1,113 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package runtime + +import "unsafe" + +// The X versions of syscall expect the libc call to return a 64-bit result. +// Otherwise (the non-X version) expects a 32-bit result. +// This distinction is required because an error is indicated by returning -1, +// and we need to know whether to check 32 or 64 bits of the result. +// (Some libc functions that return 32 bits put junk in the upper 32 bits of AX.) + +//go:linkname syscall_syscall syscall.syscall +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscall)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscall() + +//go:linkname syscall_syscallX syscall.syscallX +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscallX(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscallX)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscallX() + +//go:linkname syscall_syscall6 syscall.syscall6 +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscall6)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscall6() + +//go:linkname syscall_syscall6X syscall.syscall6X +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscall6X)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscall6X() + +//go:linkname syscall_syscall10 syscall.syscall10 +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscall10)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscall10() + +//go:linkname syscall_syscall10X syscall.syscall10X +//go:nosplit +//go:cgo_unsafe_args +func syscall_syscall10X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2, err uintptr) { + entersyscall() + libcCall(unsafe.Pointer(funcPC(syscall10X)), unsafe.Pointer(&fn)) + exitsyscall() + return +} +func syscall10X() + +//go:linkname syscall_rawSyscall syscall.rawSyscall +//go:nosplit +//go:cgo_unsafe_args +func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) { + libcCall(unsafe.Pointer(funcPC(syscall)), unsafe.Pointer(&fn)) + return +} + +//go:linkname syscall_rawSyscall6 syscall.rawSyscall6 +//go:nosplit +//go:cgo_unsafe_args +func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { + libcCall(unsafe.Pointer(funcPC(syscall6)), unsafe.Pointer(&fn)) + return +} + +//go:linkname syscall_rawSyscall6X syscall.rawSyscall6X +//go:nosplit +//go:cgo_unsafe_args +func syscall_rawSyscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) { + libcCall(unsafe.Pointer(funcPC(syscall6X)), unsafe.Pointer(&fn)) + return +} + +//go:linkname syscall_rawSyscall10X syscall.rawSyscall10X +//go:nosplit +//go:cgo_unsafe_args +func syscall_rawSyscall10X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2, err uintptr) { + libcCall(unsafe.Pointer(funcPC(syscall10X)), unsafe.Pointer(&fn)) + return +} diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 4680a7f7aa..534645eec4 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -445,3 +445,336 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 MOVL $0xf1, 0xf1 // crash POPQ BP RET + +// syscall calls a function in libc on behalf of the syscall package. +// syscall takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall expects a 32-bit result and tests for 32-bit -1 +// to decide there was an error. +TEXT runtime·syscall(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $16, SP + MOVQ (0*8)(DI), CX // fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL CX + + MOVQ (SP), DI + MOVQ AX, (4*8)(DI) // r1 + MOVQ DX, (5*8)(DI) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMPL AX, $-1 // Note: high 32 bits are junk + JNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (6*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET + +// syscallX calls a function in libc on behalf of the syscall package. +// syscallX takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscallX must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscallX is like syscall but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscallX(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $16, SP + MOVQ (0*8)(DI), CX // fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL CX + + MOVQ (SP), DI + MOVQ AX, (4*8)(DI) // r1 + MOVQ DX, (5*8)(DI) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMPQ AX, $-1 + JNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (6*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET + +// syscall6 calls a function in libc on behalf of the syscall package. +// syscall6 takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall6 must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall6 expects a 32-bit result and tests for 32-bit -1 +// to decide there was an error. +TEXT runtime·syscall6(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $16, SP + MOVQ (0*8)(DI), R11// fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ (4*8)(DI), CX // a4 + MOVQ (5*8)(DI), R8 // a5 + MOVQ (6*8)(DI), R9 // a6 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL R11 + + MOVQ (SP), DI + MOVQ AX, (7*8)(DI) // r1 + MOVQ DX, (8*8)(DI) // r2 + + CMPL AX, $-1 + JNE ok + + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (9*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET + +// syscall6X calls a function in libc on behalf of the syscall package. +// syscall6X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall6X must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall6X is like syscall6 but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscall6X(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $16, SP + MOVQ (0*8)(DI), R11// fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ (4*8)(DI), CX // a4 + MOVQ (5*8)(DI), R8 // a5 + MOVQ (6*8)(DI), R9 // a6 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL R11 + + MOVQ (SP), DI + MOVQ AX, (7*8)(DI) // r1 + MOVQ DX, (8*8)(DI) // r2 + + CMPQ AX, $-1 + JNE ok + + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (9*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET + +// syscall10 calls a function in libc on behalf of the syscall package. +// syscall10 takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall10 must be called on the g0 stack with the +// C calling convention (use libcCall). +TEXT runtime·syscall10(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $48, SP + MOVQ (7*8)(DI), R10 // a7 + MOVQ (8*8)(DI), R11 // a8 + MOVQ (9*8)(DI), R12 // a9 + MOVQ (10*8)(DI), R13 // a10 + MOVQ R10, (1*8)(SP) // a7 + MOVQ R11, (2*8)(SP) // a8 + MOVQ R12, (3*8)(SP) // a9 + MOVQ R13, (4*8)(SP) // a10 + MOVQ (0*8)(DI), R11 // fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ (4*8)(DI), CX // a4 + MOVQ (5*8)(DI), R8 // a5 + MOVQ (6*8)(DI), R9 // a6 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL R11 + + MOVQ (SP), DI + MOVQ AX, (11*8)(DI) // r1 + MOVQ DX, (12*8)(DI) // r2 + + CMPL AX, $-1 + JNE ok + + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (13*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET + +// syscall10X calls a function in libc on behalf of the syscall package. +// syscall10X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall10X must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall10X is like syscall10 but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscall10X(SB),NOSPLIT,$0 + PUSHQ BP + MOVQ SP, BP + SUBQ $48, SP + MOVQ (7*8)(DI), R10 // a7 + MOVQ (8*8)(DI), R11 // a8 + MOVQ (9*8)(DI), R12 // a9 + MOVQ (10*8)(DI), R13 // a10 + MOVQ R10, (1*8)(SP) // a7 + MOVQ R11, (2*8)(SP) // a8 + MOVQ R12, (3*8)(SP) // a9 + MOVQ R13, (4*8)(SP) // a10 + MOVQ (0*8)(DI), R11 // fn + MOVQ (2*8)(DI), SI // a2 + MOVQ (3*8)(DI), DX // a3 + MOVQ (4*8)(DI), CX // a4 + MOVQ (5*8)(DI), R8 // a5 + MOVQ (6*8)(DI), R9 // a6 + MOVQ DI, (SP) + MOVQ (1*8)(DI), DI // a1 + XORL AX, AX // vararg: say "no float args" + + CALL R11 + + MOVQ (SP), DI + MOVQ AX, (11*8)(DI) // r1 + MOVQ DX, (12*8)(DI) // r2 + + CMPQ AX, $-1 + JNE ok + + CALL libc_errno(SB) + MOVLQSX (AX), AX + MOVQ (SP), DI + MOVQ AX, (13*8)(DI) // err + +ok: + XORL AX, AX // no error (it's ignored anyway) + MOVQ BP, SP + POPQ BP + RET diff --git a/src/syscall/asm9_unix1_amd64.s b/src/syscall/asm9_unix1_amd64.s index 29af78c801..f2ae87d623 100644 --- a/src/syscall/asm9_unix1_amd64.s +++ b/src/syscall/asm9_unix1_amd64.s @@ -1,4 +1,4 @@ -// +build netbsd openbsd +// +build netbsd // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -8,7 +8,7 @@ #include "funcdata.h" // -// Syscall9 support for AMD64, NetBSD and OpenBSD +// Syscall9 support for AMD64, NetBSD // // func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64); diff --git a/src/syscall/asm_openbsd_amd64.s b/src/syscall/asm_openbsd_amd64.s new file mode 100644 index 0000000000..8d2ffd11bb --- /dev/null +++ b/src/syscall/asm_openbsd_amd64.s @@ -0,0 +1,32 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// +// System call support for AMD64, OpenBSD +// + +// Provide these function names via assembly so they are provided as ABI0, +// rather than ABIInternal. + +// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP ·syscallInternal(SB) + +// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP ·syscall6Internal(SB) + +// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP ·rawSyscallInternal(SB) + +// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP ·rawSyscall6Internal(SB) + +// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP ·syscall9Internal(SB) diff --git a/src/syscall/asm_unix_amd64.s b/src/syscall/asm_unix_amd64.s index 9cf3fe0d35..aa03eb96a0 100644 --- a/src/syscall/asm_unix_amd64.s +++ b/src/syscall/asm_unix_amd64.s @@ -1,4 +1,4 @@ -// +build netbsd freebsd openbsd dragonfly +// +build netbsd freebsd dragonfly // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go index b297db96cc..9069ef4613 100644 --- a/src/syscall/exec_bsd.go +++ b/src/syscall/exec_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd netbsd openbsd +// +build dragonfly freebsd netbsd openbsd,!amd64 package syscall diff --git a/src/syscall/exec_darwin.go b/src/syscall/exec_darwin.go deleted file mode 100644 index f035d55553..0000000000 --- a/src/syscall/exec_darwin.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package syscall - -import ( - "unsafe" -) - -type SysProcAttr struct { - Chroot string // Chroot. - Credential *Credential // Credential. - Ptrace bool // Enable tracing. - Setsid bool // Create session. - // Setpgid sets the process group ID of the child to Pgid, - // or, if Pgid == 0, to the new child's process ID. - Setpgid bool - // Setctty sets the controlling terminal of the child to - // file descriptor Ctty. Ctty must be a descriptor number - // in the child process: an index into ProcAttr.Files. - // This is only meaningful if Setsid is true. - Setctty bool - Noctty bool // Detach fd 0 from controlling terminal - Ctty int // Controlling TTY fd - // Foreground places the child process group in the foreground. - // This implies Setpgid. The Ctty field must be set to - // the descriptor of the controlling TTY. - // Unlike Setctty, in this case Ctty must be a descriptor - // number in the parent process. - Foreground bool - Pgid int // Child's process group ID if Setpgid. -} - -// Implemented in runtime package. -func runtime_BeforeFork() -func runtime_AfterFork() -func runtime_AfterForkInChild() - -// Fork, dup fd onto 0..len(fd), and exec(argv0, argvv, envv) in child. -// If a dup or exec fails, write the errno error to pipe. -// (Pipe is close-on-exec so if exec succeeds, it will be closed.) -// In the child, this function must not acquire any locks, because -// they might have been locked at the time of the fork. This means -// no rescheduling, no malloc calls, and no new stack segments. -// For the same reason compiler does not race instrument it. -// The calls to rawSyscall are okay because they are assembly -// functions that do not grow the stack. -//go:norace -func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { - // Declare all variables at top in case any - // declarations require heap allocation (e.g., err1). - var ( - r1 uintptr - err1 Errno - nextfd int - i int - ) - - // guard against side effects of shuffling fds below. - // Make sure that nextfd is beyond any currently open files so - // that we can't run the risk of overwriting any of them. - fd := make([]int, len(attr.Files)) - nextfd = len(attr.Files) - for i, ufd := range attr.Files { - if nextfd < int(ufd) { - nextfd = int(ufd) - } - fd[i] = int(ufd) - } - nextfd++ - - // About to call fork. - // No more allocation or calls of non-assembly functions. - runtime_BeforeFork() - r1, _, err1 = rawSyscall(funcPC(libc_fork_trampoline), 0, 0, 0) - if err1 != 0 { - runtime_AfterFork() - return 0, err1 - } - - if r1 != 0 { - // parent; return PID - runtime_AfterFork() - return int(r1), 0 - } - - // Fork succeeded, now in child. - - runtime_AfterForkInChild() - - // Enable tracing if requested. - if sys.Ptrace { - if err := ptrace(PTRACE_TRACEME, 0, 0, 0); err != nil { - err1 = err.(Errno) - goto childerror - } - } - - // Session ID - if sys.Setsid { - _, _, err1 = rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) - if err1 != 0 { - goto childerror - } - } - - // Set process group - if sys.Setpgid || sys.Foreground { - // Place child in process group. - _, _, err1 = rawSyscall(funcPC(libc_setpgid_trampoline), 0, uintptr(sys.Pgid), 0) - if err1 != 0 { - goto childerror - } - } - - if sys.Foreground { - pgrp := sys.Pgid - if pgrp == 0 { - r1, _, err1 = rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) - if err1 != 0 { - goto childerror - } - - pgrp = int(r1) - } - - // Place process group in foreground. - _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSPGRP), uintptr(unsafe.Pointer(&pgrp))) - if err1 != 0 { - goto childerror - } - } - - // Chroot - if chroot != nil { - _, _, err1 = rawSyscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(chroot)), 0, 0) - if err1 != 0 { - goto childerror - } - } - - // User and groups - if cred := sys.Credential; cred != nil { - ngroups := uintptr(len(cred.Groups)) - groups := uintptr(0) - if ngroups > 0 { - groups = uintptr(unsafe.Pointer(&cred.Groups[0])) - } - if !cred.NoSetGroups { - _, _, err1 = rawSyscall(funcPC(libc_setgroups_trampoline), ngroups, groups, 0) - if err1 != 0 { - goto childerror - } - } - _, _, err1 = rawSyscall(funcPC(libc_setgid_trampoline), uintptr(cred.Gid), 0, 0) - if err1 != 0 { - goto childerror - } - _, _, err1 = rawSyscall(funcPC(libc_setuid_trampoline), uintptr(cred.Uid), 0, 0) - if err1 != 0 { - goto childerror - } - } - - // Chdir - if dir != nil { - _, _, err1 = rawSyscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(dir)), 0, 0) - if err1 != 0 { - goto childerror - } - } - - // Pass 1: look for fd[i] < i and move those up above len(fd) - // so that pass 2 won't stomp on an fd it needs later. - if pipe < nextfd { - _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(pipe), uintptr(nextfd), 0) - if err1 != 0 { - goto childerror - } - rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(nextfd), F_SETFD, FD_CLOEXEC) - pipe = nextfd - nextfd++ - } - for i = 0; i < len(fd); i++ { - if fd[i] >= 0 && fd[i] < int(i) { - if nextfd == pipe { // don't stomp on pipe - nextfd++ - } - _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(fd[i]), uintptr(nextfd), 0) - if err1 != 0 { - goto childerror - } - rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(nextfd), F_SETFD, FD_CLOEXEC) - fd[i] = nextfd - nextfd++ - } - } - - // Pass 2: dup fd[i] down onto i. - for i = 0; i < len(fd); i++ { - if fd[i] == -1 { - rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0) - continue - } - if fd[i] == int(i) { - // dup2(i, i) won't clear close-on-exec flag on Linux, - // probably not elsewhere either. - _, _, err1 = rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(fd[i]), F_SETFD, 0) - if err1 != 0 { - goto childerror - } - continue - } - // The new fd is created NOT close-on-exec, - // which is exactly what we want. - _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(fd[i]), uintptr(i), 0) - if err1 != 0 { - goto childerror - } - } - - // By convention, we don't close-on-exec the fds we are - // started with, so if len(fd) < 3, close 0, 1, 2 as needed. - // Programs that know they inherit fds >= 3 will need - // to set them close-on-exec. - for i = len(fd); i < 3; i++ { - rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0) - } - - // Detach fd 0 from tty - if sys.Noctty { - _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0) - if err1 != 0 { - goto childerror - } - } - - // Set the controlling TTY to Ctty - if sys.Setctty { - _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) - if err1 != 0 { - goto childerror - } - } - - // Time to exec. - _, _, err1 = rawSyscall(funcPC(libc_execve_trampoline), - uintptr(unsafe.Pointer(argv0)), - uintptr(unsafe.Pointer(&argv[0])), - uintptr(unsafe.Pointer(&envv[0]))) - -childerror: - // send error code on pipe - rawSyscall(funcPC(libc_write_trampoline), uintptr(pipe), uintptr(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) - for { - rawSyscall(funcPC(libc_exit_trampoline), 253, 0, 0) - } -} diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go new file mode 100644 index 0000000000..496e7cf4c3 --- /dev/null +++ b/src/syscall/exec_libc2.go @@ -0,0 +1,261 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin openbsd,amd64 + +package syscall + +import ( + "unsafe" +) + +type SysProcAttr struct { + Chroot string // Chroot. + Credential *Credential // Credential. + Ptrace bool // Enable tracing. + Setsid bool // Create session. + // Setpgid sets the process group ID of the child to Pgid, + // or, if Pgid == 0, to the new child's process ID. + Setpgid bool + // Setctty sets the controlling terminal of the child to + // file descriptor Ctty. Ctty must be a descriptor number + // in the child process: an index into ProcAttr.Files. + // This is only meaningful if Setsid is true. + Setctty bool + Noctty bool // Detach fd 0 from controlling terminal + Ctty int // Controlling TTY fd + // Foreground places the child process group in the foreground. + // This implies Setpgid. The Ctty field must be set to + // the descriptor of the controlling TTY. + // Unlike Setctty, in this case Ctty must be a descriptor + // number in the parent process. + Foreground bool + Pgid int // Child's process group ID if Setpgid. +} + +// Implemented in runtime package. +func runtime_BeforeFork() +func runtime_AfterFork() +func runtime_AfterForkInChild() + +// Fork, dup fd onto 0..len(fd), and exec(argv0, argvv, envv) in child. +// If a dup or exec fails, write the errno error to pipe. +// (Pipe is close-on-exec so if exec succeeds, it will be closed.) +// In the child, this function must not acquire any locks, because +// they might have been locked at the time of the fork. This means +// no rescheduling, no malloc calls, and no new stack segments. +// For the same reason compiler does not race instrument it. +// The calls to rawSyscall are okay because they are assembly +// functions that do not grow the stack. +//go:norace +func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err Errno) { + // Declare all variables at top in case any + // declarations require heap allocation (e.g., err1). + var ( + r1 uintptr + err1 Errno + nextfd int + i int + ) + + // guard against side effects of shuffling fds below. + // Make sure that nextfd is beyond any currently open files so + // that we can't run the risk of overwriting any of them. + fd := make([]int, len(attr.Files)) + nextfd = len(attr.Files) + for i, ufd := range attr.Files { + if nextfd < int(ufd) { + nextfd = int(ufd) + } + fd[i] = int(ufd) + } + nextfd++ + + // About to call fork. + // No more allocation or calls of non-assembly functions. + runtime_BeforeFork() + r1, _, err1 = rawSyscall(funcPC(libc_fork_trampoline), 0, 0, 0) + if err1 != 0 { + runtime_AfterFork() + return 0, err1 + } + + if r1 != 0 { + // parent; return PID + runtime_AfterFork() + return int(r1), 0 + } + + // Fork succeeded, now in child. + + runtime_AfterForkInChild() + + // Enable tracing if requested. + if sys.Ptrace { + if err := ptrace(PTRACE_TRACEME, 0, 0, 0); err != nil { + err1 = err.(Errno) + goto childerror + } + } + + // Session ID + if sys.Setsid { + _, _, err1 = rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + if err1 != 0 { + goto childerror + } + } + + // Set process group + if sys.Setpgid || sys.Foreground { + // Place child in process group. + _, _, err1 = rawSyscall(funcPC(libc_setpgid_trampoline), 0, uintptr(sys.Pgid), 0) + if err1 != 0 { + goto childerror + } + } + + if sys.Foreground { + pgrp := sys.Pgid + if pgrp == 0 { + r1, _, err1 = rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + if err1 != 0 { + goto childerror + } + + pgrp = int(r1) + } + + // Place process group in foreground. + _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSPGRP), uintptr(unsafe.Pointer(&pgrp))) + if err1 != 0 { + goto childerror + } + } + + // Chroot + if chroot != nil { + _, _, err1 = rawSyscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(chroot)), 0, 0) + if err1 != 0 { + goto childerror + } + } + + // User and groups + if cred := sys.Credential; cred != nil { + ngroups := uintptr(len(cred.Groups)) + groups := uintptr(0) + if ngroups > 0 { + groups = uintptr(unsafe.Pointer(&cred.Groups[0])) + } + if !cred.NoSetGroups { + _, _, err1 = rawSyscall(funcPC(libc_setgroups_trampoline), ngroups, groups, 0) + if err1 != 0 { + goto childerror + } + } + _, _, err1 = rawSyscall(funcPC(libc_setgid_trampoline), uintptr(cred.Gid), 0, 0) + if err1 != 0 { + goto childerror + } + _, _, err1 = rawSyscall(funcPC(libc_setuid_trampoline), uintptr(cred.Uid), 0, 0) + if err1 != 0 { + goto childerror + } + } + + // Chdir + if dir != nil { + _, _, err1 = rawSyscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(dir)), 0, 0) + if err1 != 0 { + goto childerror + } + } + + // Pass 1: look for fd[i] < i and move those up above len(fd) + // so that pass 2 won't stomp on an fd it needs later. + if pipe < nextfd { + _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(pipe), uintptr(nextfd), 0) + if err1 != 0 { + goto childerror + } + rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(nextfd), F_SETFD, FD_CLOEXEC) + pipe = nextfd + nextfd++ + } + for i = 0; i < len(fd); i++ { + if fd[i] >= 0 && fd[i] < int(i) { + if nextfd == pipe { // don't stomp on pipe + nextfd++ + } + _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(fd[i]), uintptr(nextfd), 0) + if err1 != 0 { + goto childerror + } + rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(nextfd), F_SETFD, FD_CLOEXEC) + fd[i] = nextfd + nextfd++ + } + } + + // Pass 2: dup fd[i] down onto i. + for i = 0; i < len(fd); i++ { + if fd[i] == -1 { + rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0) + continue + } + if fd[i] == int(i) { + // dup2(i, i) won't clear close-on-exec flag on Linux, + // probably not elsewhere either. + _, _, err1 = rawSyscall(funcPC(libc_fcntl_trampoline), uintptr(fd[i]), F_SETFD, 0) + if err1 != 0 { + goto childerror + } + continue + } + // The new fd is created NOT close-on-exec, + // which is exactly what we want. + _, _, err1 = rawSyscall(funcPC(libc_dup2_trampoline), uintptr(fd[i]), uintptr(i), 0) + if err1 != 0 { + goto childerror + } + } + + // By convention, we don't close-on-exec the fds we are + // started with, so if len(fd) < 3, close 0, 1, 2 as needed. + // Programs that know they inherit fds >= 3 will need + // to set them close-on-exec. + for i = len(fd); i < 3; i++ { + rawSyscall(funcPC(libc_close_trampoline), uintptr(i), 0, 0) + } + + // Detach fd 0 from tty + if sys.Noctty { + _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), 0, uintptr(TIOCNOTTY), 0) + if err1 != 0 { + goto childerror + } + } + + // Set the controlling TTY to Ctty + if sys.Setctty { + _, _, err1 = rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) + if err1 != 0 { + goto childerror + } + } + + // Time to exec. + _, _, err1 = rawSyscall(funcPC(libc_execve_trampoline), + uintptr(unsafe.Pointer(argv0)), + uintptr(unsafe.Pointer(&argv[0])), + uintptr(unsafe.Pointer(&envv[0]))) + +childerror: + // send error code on pipe + rawSyscall(funcPC(libc_write_trampoline), uintptr(pipe), uintptr(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) + for { + rawSyscall(funcPC(libc_exit_trampoline), 253, 0, 0) + } +} diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go index 725c2bc1f9..1f49c78ef9 100644 --- a/src/syscall/exec_unix.go +++ b/src/syscall/exec_unix.go @@ -272,6 +272,7 @@ func runtime_AfterExec() // avoids a build dependency for other platforms. var execveLibc func(path uintptr, argv uintptr, envp uintptr) Errno var execveDarwin func(path *byte, argv **byte, envp **byte) error +var execveOpenBSD func(path *byte, argv **byte, envp **byte) error // Exec invokes the execve(2) system call. func Exec(argv0 string, argv []string, envv []string) (err error) { @@ -299,6 +300,9 @@ func Exec(argv0 string, argv []string, envv []string) (err error) { } else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" { // Similarly on Darwin. err1 = execveDarwin(argv0p, &argvp[0], &envvp[0]) + } else if runtime.GOOS == "openbsd" && runtime.GOARCH == "amd64" { + // Similarly on OpenBSD. + err1 = execveOpenBSD(argv0p, &argvp[0], &envvp[0]) } else { _, _, err1 = RawSyscall(SYS_EXECVE, uintptr(unsafe.Pointer(argv0p)), diff --git a/src/syscall/mkall.sh b/src/syscall/mkall.sh index 8f1111dafb..3aaf8c429d 100755 --- a/src/syscall/mkall.sh +++ b/src/syscall/mkall.sh @@ -283,6 +283,7 @@ netbsd_arm64) mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_386) + GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors -m32" mksyscall="./mksyscall.pl -l32 -openbsd" mksysctl="./mksysctl_openbsd.pl" @@ -291,14 +292,17 @@ openbsd_386) mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) + GOOSARCH_in="syscall_openbsd_libc.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors -m64" - mksyscall="./mksyscall.pl -openbsd" + mksyscall="./mksyscall.pl -openbsd -libc" mksysctl="./mksysctl_openbsd.pl" zsysctl="zsysctl_openbsd.go" mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" mktypes="GOARCH=$GOARCH go tool cgo -godefs" + mkasm="go run mkasm_openbsd.go" ;; openbsd_arm) + GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors" mksyscall="./mksyscall.pl -l32 -openbsd -arm" mksysctl="./mksysctl_openbsd.pl" @@ -309,6 +313,7 @@ openbsd_arm) mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; openbsd_arm64) + GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors -m64" mksyscall="./mksyscall.pl -openbsd" mksysctl="./mksysctl_openbsd.pl" @@ -319,6 +324,7 @@ openbsd_arm64) mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; openbsd_mips64) + GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors -m64" mksyscall="./mksyscall.pl -openbsd" mksysctl="./mksysctl_openbsd.pl" @@ -327,7 +333,6 @@ openbsd_mips64) # Let the type of C char be signed to make the bare syscall # API consistent between platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" - GOOSARCH_in=syscall_openbsd_mips64.go ;; plan9_386) mkerrors= diff --git a/src/syscall/mkasm.go b/src/syscall/mkasm.go new file mode 100644 index 0000000000..2ebaf8d351 --- /dev/null +++ b/src/syscall/mkasm.go @@ -0,0 +1,64 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +// mkasm.go generates assembly trampolines to call library routines from Go. +// This program must be run after mksyscall.pl. +package main + +import ( + "bytes" + "fmt" + "log" + "os" + "strings" +) + +func main() { + if len(os.Args) != 3 { + log.Fatalf("Usage: %s ", os.Args[0]) + } + goos, arch := os.Args[1], os.Args[2] + + syscallFilename := fmt.Sprintf("syscall_%s.go", goos) + syscallArchFilename := fmt.Sprintf("syscall_%s_%s.go", goos, arch) + + in1, err := os.ReadFile(syscallFilename) + if err != nil { + log.Fatalf("can't open syscall file: %s", err) + } + in2, err := os.ReadFile(syscallArchFilename) + if err != nil { + log.Fatalf("can't open syscall file: %s", err) + } + in3, err := os.ReadFile("z" + syscallArchFilename) + if err != nil { + log.Fatalf("can't open syscall file: %s", err) + } + in := string(in1) + string(in2) + string(in3) + + trampolines := map[string]bool{} + + var out bytes.Buffer + + fmt.Fprintf(&out, "// go run mkasm.go %s\n", strings.Join(os.Args[1:], " ")) + fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") + fmt.Fprintf(&out, "#include \"textflag.h\"\n") + for _, line := range strings.Split(in, "\n") { + if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { + continue + } + fn := line[5 : len(line)-13] + if !trampolines[fn] { + trampolines[fn] = true + fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) + fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) + } + } + err = os.WriteFile(fmt.Sprintf("zsyscall_%s_%s.s", goos, arch), out.Bytes(), 0644) + if err != nil { + log.Fatalf("can't write syscall file: %s", err) + } +} diff --git a/src/syscall/mkasm_darwin.go b/src/syscall/mkasm_darwin.go deleted file mode 100644 index 1783387a53..0000000000 --- a/src/syscall/mkasm_darwin.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. -//This program must be run after mksyscall.pl. -package main - -import ( - "bytes" - "fmt" - "log" - "os" - "strings" -) - -func main() { - in1, err := os.ReadFile("syscall_darwin.go") - if err != nil { - log.Fatalf("can't open syscall_darwin.go: %s", err) - } - arch := os.Args[1] - in2, err := os.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch)) - if err != nil { - log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err) - } - in3, err := os.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch)) - if err != nil { - log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err) - } - in := string(in1) + string(in2) + string(in3) - - trampolines := map[string]bool{} - - var out bytes.Buffer - - fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " ")) - fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") - fmt.Fprintf(&out, "#include \"textflag.h\"\n") - for _, line := range strings.Split(in, "\n") { - if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { - continue - } - fn := line[5 : len(line)-13] - if !trampolines[fn] { - trampolines[fn] = true - fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) - fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) - } - } - err = os.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644) - if err != nil { - log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err) - } -} diff --git a/src/syscall/mkasm_openbsd.go b/src/syscall/mkasm_openbsd.go new file mode 100644 index 0000000000..9b938bde8c --- /dev/null +++ b/src/syscall/mkasm_openbsd.go @@ -0,0 +1,58 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +// mkasm_openbsd.go generates assembly trampolines to call libc routines from Go. +// This program must be run after mksyscall.pl. +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "log" + "os" + "strings" +) + +func main() { + in1, err := ioutil.ReadFile("syscall_openbsd.go") + if err != nil { + log.Fatalf("can't open syscall_openbsd.go: %s", err) + } + arch := os.Args[1] + in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_openbsd_%s.go", arch)) + if err != nil { + log.Fatalf("can't open syscall_openbsd_%s.go: %s", arch, err) + } + in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_openbsd_%s.go", arch)) + if err != nil { + log.Fatalf("can't open zsyscall_openbsd_%s.go: %s", arch, err) + } + in := string(in1) + string(in2) + string(in3) + + trampolines := map[string]bool{} + + var out bytes.Buffer + + fmt.Fprintf(&out, "// go run mkasm_openbsd.go %s\n", strings.Join(os.Args[1:], " ")) + fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") + fmt.Fprintf(&out, "#include \"textflag.h\"\n") + for _, line := range strings.Split(in, "\n") { + if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { + continue + } + fn := line[5 : len(line)-13] + if !trampolines[fn] { + trampolines[fn] = true + fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) + fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) + } + } + err = ioutil.WriteFile(fmt.Sprintf("zsyscall_openbsd_%s.s", arch), out.Bytes(), 0644) + if err != nil { + log.Fatalf("can't write zsyscall_openbsd_%s.s: %s", arch, err) + } +} diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl index 7e2cedfb6c..fa9e684d0f 100755 --- a/src/syscall/mksyscall.pl +++ b/src/syscall/mksyscall.pl @@ -30,6 +30,7 @@ my $openbsd = 0; my $netbsd = 0; my $dragonfly = 0; my $arm = 0; # 64-bit value should use (even, odd)-pair +my $libc = 0; my $tags = ""; # build tags if($ARGV[0] eq "-b32") { @@ -45,6 +46,7 @@ if($ARGV[0] eq "-plan9") { } if($ARGV[0] eq "-darwin") { $darwin = 1; + $libc = 1; shift; } if($ARGV[0] eq "-openbsd") { @@ -63,6 +65,10 @@ if($ARGV[0] eq "-arm") { $arm = 1; shift; } +if($ARGV[0] eq "-libc") { + $libc = 1; + shift; +} if($ARGV[0] eq "-tags") { shift; $tags = $ARGV[0]; @@ -125,7 +131,7 @@ while(<>) { # without reading the header. $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - if ($darwin && $func eq "ptrace1") { + if (($darwin || ($openbsd && $libc)) && $func eq "ptrace") { # The ptrace function is called from forkAndExecInChild where stack # growth is forbidden. $text .= "//go:nosplit\n" @@ -176,7 +182,9 @@ while(<>) { push @args, "uintptr(_p$n)", "uintptr(len($name))"; $n++; } elsif($type eq "int64" && ($openbsd || $netbsd)) { - push @args, "0"; + if (!$libc) { + push @args, "0"; + } if($_32bit eq "big-endian") { push @args, "uintptr($name>>32)", "uintptr($name)"; } elsif($_32bit eq "little-endian") { @@ -220,7 +228,7 @@ while(<>) { $asm = "RawSyscall"; } } - if ($darwin) { + if ($libc) { # Call unexported syscall functions (which take # libc functions instead of syscall numbers). $asm = lcfirst($asm); @@ -243,7 +251,7 @@ while(<>) { print STDERR "$ARGV:$.: too many arguments to system call\n"; } - if ($darwin) { + if ($darwin || ($openbsd && $libc)) { # Use extended versions for calls that generate a 64-bit result. my ($name, $type) = parseparam($out[0]); if ($type eq "int64" || ($type eq "uintptr" && $_32bit eq "")) { @@ -257,13 +265,13 @@ while(<>) { $sysname = "SYS_$func"; $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar $sysname =~ y/a-z/A-Z/; - if($darwin) { + if($libc) { $sysname =~ y/A-Z/a-z/; $sysname = substr $sysname, 4; $funcname = "libc_$sysname"; } } - if($darwin) { + if($libc) { if($funcname eq "") { $sysname = substr $sysname, 4; $funcname = "libc_$sysname"; @@ -338,17 +346,21 @@ while(<>) { } $text .= "\treturn\n"; $text .= "}\n\n"; - if($darwin) { + if($libc) { if (not exists $trampolines{$funcname}) { $trampolines{$funcname} = 1; # The assembly trampoline that jumps to the libc routine. $text .= "func ${funcname}_trampoline()\n"; # Map syscall.funcname to just plain funcname. - # (The jump to this function is in the assembly trampoline, generated by mksyscallasm_darwin.go.) + # (The jump to this function is in the assembly trampoline, generated by mkasm_$GOOS.go.) $text .= "//go:linkname $funcname $funcname\n"; # Tell the linker that funcname can be found in libSystem using varname without the libc_ prefix. my $basename = substr $funcname, 5; - $text .= "//go:cgo_import_dynamic $funcname $basename \"/usr/lib/libSystem.B.dylib\"\n\n"; + my $libc = "libc.so"; + if ($darwin) { + $libc = "/usr/lib/libSystem.B.dylib"; + } + $text .= "//go:cgo_import_dynamic $funcname $basename \"$libc\"\n\n"; } } } diff --git a/src/syscall/syscall_openbsd.go b/src/syscall/syscall_openbsd.go index eebb5ceb1a..5a5ba5a51b 100644 --- a/src/syscall/syscall_openbsd.go +++ b/src/syscall/syscall_openbsd.go @@ -182,7 +182,6 @@ func setattrlistTimes(path string, times []Timespec) error { //sys Rename(from string, to string) (err error) //sys Revoke(path string) (err error) //sys Rmdir(path string) (err error) -//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK //sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) //sysnb Setegid(egid int) (err error) //sysnb Seteuid(euid int) (err error) @@ -207,8 +206,4 @@ func setattrlistTimes(path string, times []Timespec) error { //sys write(fd int, p []byte) (n int, err error) //sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) //sys munmap(addr uintptr, length uintptr) (err error) -//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ -//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) -//sys getcwd(buf []byte) (n int, err error) = SYS___GETCWD -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL diff --git a/src/syscall/syscall_openbsd1.go b/src/syscall/syscall_openbsd1.go new file mode 100644 index 0000000000..d8065374fb --- /dev/null +++ b/src/syscall/syscall_openbsd1.go @@ -0,0 +1,13 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,!amd64 + +package syscall + +//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ +//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE +//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK +//sys getcwd(buf []byte) (n int, err error) = SYS___GETCWD +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL diff --git a/src/syscall/syscall_openbsd_libc.go b/src/syscall/syscall_openbsd_libc.go new file mode 100644 index 0000000000..191c7e0e43 --- /dev/null +++ b/src/syscall/syscall_openbsd_libc.go @@ -0,0 +1,93 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build openbsd,amd64 + +package syscall + +import "unsafe" + +//sys directSyscall(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr) (ret uintptr, err error) = SYS_syscall + +func syscallInternal(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + return syscall6X(funcPC(libc_syscall_trampoline), trap, a1, a2, a3, 0, 0) +} + +func syscall6Internal(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + return syscall10X(funcPC(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) +} + +func rawSyscallInternal(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { + return rawSyscall6X(funcPC(libc_syscall_trampoline), trap, a1, a2, a3, 0, 0) +} + +func rawSyscall6Internal(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { + return rawSyscall10X(funcPC(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) +} + +func syscall9Internal(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { + return rawSyscall10X(funcPC(libc_syscall_trampoline), trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) +} + +// Implemented in the runtime package (runtime/sys_openbsd3.go) +func syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscallX(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2 uintptr, err Errno) +func syscall10X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2 uintptr, err Errno) +func rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func rawSyscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func rawSyscall10X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uintptr) (r1, r2 uintptr, err Errno) + +func syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { + return syscall10(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, 0) +} +func syscall9X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) { + return syscall10X(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9, 0) +} + +// Find the entry point for f. See comments in runtime/proc.go for the +// function of the same name. +//go:nosplit +func funcPC(f func()) uintptr { + return **(**uintptr)(unsafe.Pointer(&f)) +} + +//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_lseek +//sys getcwd(buf []byte) (n int, err error) +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) +//sysnb fork() (pid int, err error) +//sysnb ioctl(fd int, req int, arg int) (err error) +//sysnb execve(path *byte, argv **byte, envp **byte) (err error) +//sysnb exit(res int) (err error) +//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) +//sysnb getentropy(p []byte) (err error) +//sys fstatat(fd int, path string, stat *Stat_t, flags int) (err error) +//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) = SYS_fcntl +//sys unlinkat(fd int, path string, flags int) (err error) +//sys openat(fd int, path string, flags int, perm uint32) (fdret int, err error) + +func init() { + execveOpenBSD = execve +} + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/src/syscall/zsyscall_darwin_amd64.s b/src/syscall/zsyscall_darwin_amd64.s index d99656d028..492f947855 100644 --- a/src/syscall/zsyscall_darwin_amd64.s +++ b/src/syscall/zsyscall_darwin_amd64.s @@ -1,4 +1,4 @@ -// go run mkasm_darwin.go amd64 +// go run mkasm.go darwin amd64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 diff --git a/src/syscall/zsyscall_darwin_arm64.s b/src/syscall/zsyscall_darwin_arm64.s index 0a8879d1c3..b606c6e49e 100644 --- a/src/syscall/zsyscall_darwin_arm64.s +++ b/src/syscall/zsyscall_darwin_arm64.s @@ -1,4 +1,4 @@ -// go run mkasm_darwin.go arm64 +// go run mkasm.go darwin arm64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 diff --git a/src/syscall/zsyscall_openbsd_amd64.go b/src/syscall/zsyscall_openbsd_amd64.go index f7390390e0..67dc0d3733 100644 --- a/src/syscall/zsyscall_openbsd_amd64.go +++ b/src/syscall/zsyscall_openbsd_amd64.go @@ -1,4 +1,4 @@ -// mksyscall.pl -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go +// mksyscall.pl -openbsd -libc -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_libc.go syscall_openbsd_amd64.go // Code generated by the command above; DO NOT EDIT. // +build openbsd,amd64 @@ -10,7 +10,7 @@ import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -18,20 +18,30 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +func libc_getgroups_trampoline() + +//go:linkname libc_getgroups libc_getgroups +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setgroups_trampoline() + +//go:linkname libc_setgroups libc_setgroups +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -39,10 +49,15 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +func libc_wait4_trampoline() + +//go:linkname libc_wait4 libc_wait4 +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -50,30 +65,45 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +func libc_accept_trampoline() + +//go:linkname libc_accept libc_accept +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_bind_trampoline() + +//go:linkname libc_bind libc_bind +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_connect_trampoline() + +//go:linkname libc_connect libc_connect +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -81,66 +111,101 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +func libc_socket_trampoline() + +//go:linkname libc_socket libc_socket +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getsockopt_trampoline() + +//go:linkname libc_getsockopt libc_getsockopt +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setsockopt_trampoline() + +//go:linkname libc_setsockopt libc_setsockopt +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getpeername_trampoline() + +//go:linkname libc_getpeername libc_getpeername +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getsockname_trampoline() + +//go:linkname libc_getsockname libc_getsockname +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_shutdown_trampoline() + +//go:linkname libc_shutdown libc_shutdown +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_socketpair_trampoline() + +//go:linkname libc_socketpair libc_socketpair +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -150,7 +215,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -158,6 +223,11 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +func libc_recvfrom_trampoline() + +//go:linkname libc_recvfrom libc_recvfrom +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -167,17 +237,22 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_sendto_trampoline() + +//go:linkname libc_sendto libc_sendto +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -185,10 +260,15 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +func libc_recvmsg_trampoline() + +//go:linkname libc_recvmsg libc_recvmsg +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -196,10 +276,15 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +func libc_sendmsg_trampoline() + +//go:linkname libc_sendmsg libc_sendmsg +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -207,21 +292,10 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func libc_kevent_trampoline() -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:linkname libc_kevent libc_kevent +//go:cgo_import_dynamic libc_kevent kevent "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -231,27 +305,37 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_utimes_trampoline() + +//go:linkname libc_utimes libc_utimes +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_futimes_trampoline() + +//go:linkname libc_futimes libc_futimes +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -259,20 +343,30 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } +func libc_fcntl_trampoline() + +//go:linkname libc_fcntl libc_fcntl +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := rawSyscall(funcPC(libc_pipe2_trampoline), uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_pipe2_trampoline() + +//go:linkname libc_pipe2 libc_pipe2 +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + r0, _, e1 := syscall6(funcPC(libc_accept4_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -280,6 +374,11 @@ func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int return } +func libc_accept4_trampoline() + +//go:linkname libc_accept4 libc_accept4 +//go:cgo_import_dynamic libc_accept4 accept4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getdents(fd int, buf []byte) (n int, err error) { @@ -289,7 +388,7 @@ func getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall(funcPC(libc_getdents_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,6 +396,11 @@ func getdents(fd int, buf []byte) (n int, err error) { return } +func libc_getdents_trampoline() + +//go:linkname libc_getdents libc_getdents +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -305,23 +409,33 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_access_trampoline() + +//go:linkname libc_access libc_access +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_adjtime_trampoline() + +//go:linkname libc_adjtime libc_adjtime +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -330,13 +444,18 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chdir_trampoline() + +//go:linkname libc_chdir libc_chdir +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -345,13 +464,18 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chflags_trampoline() + +//go:linkname libc_chflags libc_chflags +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -360,13 +484,18 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chmod_trampoline() + +//go:linkname libc_chmod libc_chmod +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -375,13 +504,18 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chown_trampoline() + +//go:linkname libc_chown libc_chown +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -390,27 +524,37 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chroot_trampoline() + +//go:linkname libc_chroot libc_chroot +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_close_trampoline() + +//go:linkname libc_close libc_close +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -418,70 +562,105 @@ func Dup(fd int) (nfd int, err error) { return } +func libc_dup_trampoline() + +//go:linkname libc_dup libc_dup +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_dup2_trampoline() + +//go:linkname libc_dup2 libc_dup2 +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchdir_trampoline() + +//go:linkname libc_fchdir libc_fchdir +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchflags_trampoline() + +//go:linkname libc_fchflags libc_fchflags +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchmod_trampoline() + +//go:linkname libc_fchmod libc_fchmod +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchown_trampoline() + +//go:linkname libc_fchown libc_fchown +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_flock_trampoline() + +//go:linkname libc_flock libc_flock +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -489,74 +668,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +func libc_fpathconf_trampoline() + +//go:linkname libc_fpathconf libc_fpathconf +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fstat_trampoline() + +//go:linkname libc_fstat libc_fstat +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fstatfs_trampoline() + +//go:linkname libc_fstatfs libc_fstatfs +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fsync_trampoline() + +//go:linkname libc_fsync libc_fsync +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + _, _, e1 := syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_ftruncate_trampoline() + +//go:linkname libc_ftruncate libc_ftruncate +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) egid = int(r0) return } +func libc_getegid_trampoline() + +//go:linkname libc_getegid libc_getegid +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) uid = int(r0) return } +func libc_geteuid_trampoline() + +//go:linkname libc_geteuid libc_geteuid +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) gid = int(r0) return } +func libc_getgid_trampoline() + +//go:linkname libc_getgid libc_getgid +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -564,34 +783,54 @@ func Getpgid(pid int) (pgid int, err error) { return } +func libc_getpgid_trampoline() + +//go:linkname libc_getpgid libc_getpgid +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) pgrp = int(r0) return } +func libc_getpgrp_trampoline() + +//go:linkname libc_getpgrp libc_getpgrp +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) pid = int(r0) return } +func libc_getpid_trampoline() + +//go:linkname libc_getpid libc_getpid +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) ppid = int(r0) return } +func libc_getppid_trampoline() + +//go:linkname libc_getppid libc_getppid +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -599,30 +838,45 @@ func Getpriority(which int, who int) (prio int, err error) { return } +func libc_getpriority_trampoline() + +//go:linkname libc_getpriority libc_getpriority +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getrlimit_trampoline() + +//go:linkname libc_getrlimit libc_getrlimit +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getrusage_trampoline() + +//go:linkname libc_getrusage libc_getrusage +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -630,46 +884,71 @@ func Getsid(pid int) (sid int, err error) { return } +func libc_getsid_trampoline() + +//go:linkname libc_getsid libc_getsid +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_gettimeofday_trampoline() + +//go:linkname libc_gettimeofday libc_gettimeofday +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) uid = int(r0) return } +func libc_getuid_trampoline() + +//go:linkname libc_getuid libc_getuid +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) tainted = bool(r0 != 0) return } +func libc_issetugid_trampoline() + +//go:linkname libc_issetugid libc_issetugid +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_kill_trampoline() + +//go:linkname libc_kill libc_kill +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -677,6 +956,11 @@ func Kqueue() (fd int, err error) { return } +func libc_kqueue_trampoline() + +//go:linkname libc_kqueue libc_kqueue +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -685,13 +969,18 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lchown_trampoline() + +//go:linkname libc_lchown libc_lchown +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -705,23 +994,33 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_link_trampoline() + +//go:linkname libc_link libc_link +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_listen_trampoline() + +//go:linkname libc_listen libc_listen +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -730,13 +1029,18 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lstat_trampoline() + +//go:linkname libc_lstat libc_lstat +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -745,13 +1049,18 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mkdir_trampoline() + +//go:linkname libc_mkdir libc_mkdir +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -760,13 +1069,18 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mkfifo_trampoline() + +//go:linkname libc_mkfifo libc_mkfifo +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -775,23 +1089,33 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mknod_trampoline() + +//go:linkname libc_mknod libc_mknod +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall(funcPC(libc_nanosleep_trampoline), uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_nanosleep_trampoline() + +//go:linkname libc_nanosleep libc_nanosleep +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -800,7 +1124,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -808,6 +1132,11 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +func libc_open_trampoline() + +//go:linkname libc_open libc_open +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -816,7 +1145,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -824,6 +1153,11 @@ func Pathconf(path string, name int) (val int, err error) { return } +func libc_pathconf_trampoline() + +//go:linkname libc_pathconf libc_pathconf +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -833,7 +1167,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -841,6 +1175,11 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } +func libc_pread_trampoline() + +//go:linkname libc_pread libc_pread +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -850,7 +1189,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -858,6 +1197,11 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +func libc_pwrite_trampoline() + +//go:linkname libc_pwrite libc_pwrite +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -867,7 +1211,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -875,6 +1219,11 @@ func read(fd int, p []byte) (n int, err error) { return } +func libc_read_trampoline() + +//go:linkname libc_read libc_read +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -889,7 +1238,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -897,6 +1246,11 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +func libc_readlink_trampoline() + +//go:linkname libc_readlink libc_readlink +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -910,13 +1264,18 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_rename_trampoline() + +//go:linkname libc_rename libc_rename +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -925,13 +1284,18 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_revoke_trampoline() + +//go:linkname libc_revoke libc_revoke +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -940,64 +1304,78 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func libc_rmdir_trampoline() -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:linkname libc_rmdir libc_rmdir +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_select_trampoline() + +//go:linkname libc_select libc_select +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setegid_trampoline() + +//go:linkname libc_setegid libc_setegid +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_seteuid_trampoline() + +//go:linkname libc_seteuid libc_seteuid +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setgid_trampoline() + +//go:linkname libc_setgid libc_setgid +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1006,67 +1384,97 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setlogin_trampoline() + +//go:linkname libc_setlogin libc_setlogin +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setpgid_trampoline() + +//go:linkname libc_setpgid libc_setpgid +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setpriority_trampoline() + +//go:linkname libc_setpriority libc_setpriority +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setregid_trampoline() + +//go:linkname libc_setregid libc_setregid +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setreuid_trampoline() + +//go:linkname libc_setreuid libc_setreuid +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setrlimit_trampoline() + +//go:linkname libc_setrlimit libc_setrlimit +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1074,26 +1482,41 @@ func Setsid() (pid int, err error) { return } +func libc_setsid_trampoline() + +//go:linkname libc_setsid libc_setsid +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_settimeofday_trampoline() + +//go:linkname libc_settimeofday libc_settimeofday +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setuid_trampoline() + +//go:linkname libc_setuid libc_setuid +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1102,13 +1525,18 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_stat_trampoline() + +//go:linkname libc_stat libc_stat +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1117,13 +1545,18 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_statfs_trampoline() + +//go:linkname libc_statfs libc_statfs +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1137,23 +1570,33 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_symlink_trampoline() + +//go:linkname libc_symlink libc_symlink +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall(funcPC(libc_sync_trampoline), 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_sync_trampoline() + +//go:linkname libc_sync libc_sync +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1162,21 +1605,31 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + _, _, e1 := syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_truncate_trampoline() + +//go:linkname libc_truncate libc_truncate +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) oldmask = int(r0) return } +func libc_umask_trampoline() + +//go:linkname libc_umask libc_umask +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1185,13 +1638,18 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_unlink_trampoline() + +//go:linkname libc_unlink libc_unlink +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1200,13 +1658,18 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_unmount_trampoline() + +//go:linkname libc_unmount libc_unmount +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1216,7 +1679,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1224,10 +1687,15 @@ func write(fd int, p []byte) (n int, err error) { return } +func libc_write_trampoline() + +//go:linkname libc_write libc_write +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + r0, _, e1 := syscall6X(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1235,53 +1703,78 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +func libc_mmap_trampoline() + +//go:linkname libc_mmap libc_mmap +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_munmap_trampoline() + +//go:linkname libc_munmap libc_munmap +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) +func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall6(funcPC(libc_utimensat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_utimensat_trampoline() + +//go:linkname libc_utimensat libc_utimensat +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) +func directSyscall(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr) (ret uintptr, err error) { + r0, _, e1 := syscall6X(funcPC(libc_syscall_trampoline), uintptr(trap), uintptr(a1), uintptr(a2), uintptr(a3), uintptr(a4), uintptr(a5)) + ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_syscall_trampoline() + +//go:linkname libc_syscall libc_syscall +//go:cgo_import_dynamic libc_syscall syscall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := syscallX(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lseek_trampoline() + +//go:linkname libc_lseek libc_lseek +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getcwd(buf []byte) (n int, err error) { @@ -1291,10 +1784,206 @@ func getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } + +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_sysctl_trampoline() + +//go:linkname libc_sysctl libc_sysctl +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fork() (pid int, err error) { + r0, _, e1 := rawSyscall(funcPC(libc_fork_trampoline), 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fork_trampoline() + +//go:linkname libc_fork libc_fork +//go:cgo_import_dynamic libc_fork fork "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req int, arg int) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_ioctl_trampoline() + +//go:linkname libc_ioctl libc_ioctl +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func execve(path *byte, argv **byte, envp **byte) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_execve_trampoline() + +//go:linkname libc_execve libc_execve +//go:cgo_import_dynamic libc_execve execve "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func exit(res int) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_exit_trampoline), uintptr(res), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_exit_trampoline() + +//go:linkname libc_exit libc_exit +//go:cgo_import_dynamic libc_exit exit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +//go:nosplit +func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { + _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_ptrace_trampoline() + +//go:linkname libc_ptrace libc_ptrace +//go:cgo_import_dynamic libc_ptrace ptrace "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getentropy(p []byte) (err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := rawSyscall(funcPC(libc_getentropy_trampoline), uintptr(_p0), uintptr(len(p)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_getentropy_trampoline() + +//go:linkname libc_getentropy libc_getentropy +//go:cgo_import_dynamic libc_getentropy getentropy "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fstatat_trampoline() + +//go:linkname libc_fstatat libc_fstatat +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { + r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unlinkat(fd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall(funcPC(libc_unlinkat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_unlinkat_trampoline() + +//go:linkname libc_unlinkat libc_unlinkat +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall6(funcPC(libc_openat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(perm), 0, 0) + fdret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_openat_trampoline() + +//go:linkname libc_openat libc_openat +//go:cgo_import_dynamic libc_openat openat "libc.so" diff --git a/src/syscall/zsyscall_openbsd_amd64.s b/src/syscall/zsyscall_openbsd_amd64.s new file mode 100644 index 0000000000..e5c5dde930 --- /dev/null +++ b/src/syscall/zsyscall_openbsd_amd64.s @@ -0,0 +1,233 @@ +// go run mkasm.go openbsd amd64 +// Code generated by the command above; DO NOT EDIT. +#include "textflag.h" +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 + JMP libc_accept4(SB) +TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 + JMP libc_syscall(SB) +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fork(SB) +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 + JMP libc_execve(SB) +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ptrace(SB) +TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getentropy(SB) +TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) -- cgit v1.3-5-g9baa From 6c8fbfbdcfa48ca29926097b20767fe83409b3ed Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 26 Jan 2021 17:52:19 +1100 Subject: runtime: convert openbsd/arm64 locking to libc Switch openbsd/arm64 to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I2f30432c4bc232224cf87dca750665b8c40c7b72 Reviewed-on: https://go-review.googlesource.com/c/go/+/286813 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- src/runtime/os_openbsd_syscall1.go | 2 +- src/runtime/sys_openbsd1.go | 2 +- src/runtime/sys_openbsd_arm64.s | 43 +++++++++++++++++--------------------- 3 files changed, 21 insertions(+), 26 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_openbsd_syscall1.go b/src/runtime/os_openbsd_syscall1.go index 08928cfef4..b0bef4c504 100644 --- a/src/runtime/os_openbsd_syscall1.go +++ b/src/runtime/os_openbsd_syscall1.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,!amd64 +// +build openbsd,!amd64,!arm64 package runtime diff --git a/src/runtime/sys_openbsd1.go b/src/runtime/sys_openbsd1.go index a201a16c53..e2886218db 100644 --- a/src/runtime/sys_openbsd1.go +++ b/src/runtime/sys_openbsd1.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s index 2ec9d038ba..7e454a9867 100644 --- a/src/runtime/sys_openbsd_arm64.s +++ b/src/runtime/sys_openbsd_arm64.s @@ -188,6 +188,25 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 ADD $16, RSP RET +TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - clock_id + MOVD 16(R0), R2 // arg 3 - abstime + MOVD 24(R0), R3 // arg 4 - lock + MOVD 32(R0), R4 // arg 5 - abort + MOVD 0(R0), R0 // arg 1 - id + CALL libc_thrsleep(SB) + RET + +TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - count + MOVD 0(R0), R0 // arg 1 - id + CALL libc_thrwakeup(SB) + RET + +TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0 + CALL libc_sched_yield(SB) + RET + // Exit the entire program (like C exit) TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0 MOVW code+0(FP), R0 // arg 1 - status @@ -422,30 +441,6 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$0 MOVD R8, (R8) RET -TEXT runtime·osyield(SB),NOSPLIT,$0 - MOVD $298, R8 // sys_sched_yield - INVOKE_SYSCALL - RET - -TEXT runtime·thrsleep(SB),NOSPLIT,$0 - MOVD ident+0(FP), R0 // arg 1 - ident - MOVW clock_id+8(FP), R1 // arg 2 - clock_id - MOVD tsp+16(FP), R2 // arg 3 - tsp - MOVD lock+24(FP), R3 // arg 4 - lock - MOVD abort+32(FP), R4 // arg 5 - abort - MOVD $94, R8 // sys___thrsleep - INVOKE_SYSCALL - MOVW R0, ret+40(FP) - RET - -TEXT runtime·thrwakeup(SB),NOSPLIT,$0 - MOVD ident+0(FP), R0 // arg 1 - ident - MOVW n+8(FP), R1 // arg 2 - n - MOVD $301, R8 // sys___thrwakeup - INVOKE_SYSCALL - MOVW R0, ret+16(FP) - RET - TEXT runtime·sysctl(SB),NOSPLIT,$0 MOVD mib+0(FP), R0 // arg 1 - mib MOVW miblen+8(FP), R1 // arg 2 - miblen -- cgit v1.3-5-g9baa From cd176b361591420f84fcbcaaf0cf24351aed0995 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 26 Jan 2021 23:06:51 +1100 Subject: runtime: switch runtime to libc for openbsd/arm64 Use libc rather than performing direct system calls for the runtime on openbsd/arm64. Updates #36435 Change-Id: I8bd41dfec16209f2b9a83dda24b9a1e4b06757c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/286814 Trust: Joel Sing Reviewed-by: Cherry Zhang --- src/runtime/defs_openbsd_arm64.go | 5 + src/runtime/os_openbsd_syscall2.go | 2 +- src/runtime/proc.go | 2 +- src/runtime/sys_openbsd2.go | 2 +- src/runtime/sys_openbsd_arm64.s | 485 +++++++++++++++---------------------- 5 files changed, 201 insertions(+), 295 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/defs_openbsd_arm64.go b/src/runtime/defs_openbsd_arm64.go index 63ea8dfecc..d2b947feb2 100644 --- a/src/runtime/defs_openbsd_arm64.go +++ b/src/runtime/defs_openbsd_arm64.go @@ -33,6 +33,11 @@ const ( _PTHREAD_CREATE_DETACHED = 0x1 + _F_SETFD = 0x2 + _F_GETFL = 0x3 + _F_SETFL = 0x4 + _FD_CLOEXEC = 0x1 + _SIGHUP = 0x1 _SIGINT = 0x2 _SIGQUIT = 0x3 diff --git a/src/runtime/os_openbsd_syscall2.go b/src/runtime/os_openbsd_syscall2.go index 74eb271c2c..ab940510af 100644 --- a/src/runtime/os_openbsd_syscall2.go +++ b/src/runtime/os_openbsd_syscall2.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,!amd64 +// +build openbsd,!amd64,!arm64 package runtime diff --git a/src/runtime/proc.go b/src/runtime/proc.go index d51dcb0d22..73a789c189 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1213,7 +1213,7 @@ func usesLibcall() bool { case "aix", "darwin", "illumos", "ios", "solaris", "windows": return true case "openbsd": - return GOARCH == "amd64" + return GOARCH == "amd64" || GOARCH == "arm64" } return false } diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go index 73592df226..474e7145e7 100644 --- a/src/runtime/sys_openbsd2.go +++ b/src/runtime/sys_openbsd2.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s index 7e454a9867..0fd983ef25 100644 --- a/src/runtime/sys_openbsd_arm64.s +++ b/src/runtime/sys_openbsd_arm64.s @@ -15,17 +15,6 @@ #define CLOCK_REALTIME $0 #define CLOCK_MONOTONIC $3 -// With OpenBSD 6.7 onwards, an arm64 syscall returns two instructions -// after the SVC instruction, to allow for a speculative execution -// barrier to be placed after the SVC without impacting performance. -// For now use hardware no-ops as this works with both older and newer -// kernels. After OpenBSD 6.8 is released this should be changed to -// speculation barriers. -#define INVOKE_SYSCALL \ - SVC; \ - NOOP; \ - NOOP - // mstart_stub is the first function executed on a new thread started by pthread_create. // It just does some low-level setup and then calls mstart. // Note: called with the C calling convention. @@ -188,6 +177,13 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 ADD $16, RSP RET +TEXT runtime·thrkill_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - signal + MOVD $0, R2 // arg 3 - tcb + MOVW 0(R0), R0 // arg 1 - tid + CALL libc_thrkill(SB) + RET + TEXT runtime·thrsleep_trampoline(SB),NOSPLIT,$0 MOVW 8(R0), R1 // arg 2 - clock_id MOVD 16(R0), R2 // arg 3 - abstime @@ -203,302 +199,207 @@ TEXT runtime·thrwakeup_trampoline(SB),NOSPLIT,$0 CALL libc_thrwakeup(SB) RET +TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 + MOVW 0(R0), R0 // arg 1 - status + CALL libc_exit(SB) + MOVD $0, R0 // crash on failure + MOVD R0, (R0) + RET + +TEXT runtime·getthrid_trampoline(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + CALL libc_getthrid(SB) + MOVW R0, 0(R19) // return value + RET + +TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + CALL libc_getpid(SB) // arg 1 - pid + MOVW 0(R19), R1 // arg 2 - signal + CALL libc_kill(SB) + RET + TEXT runtime·sched_yield_trampoline(SB),NOSPLIT,$0 CALL libc_sched_yield(SB) RET -// Exit the entire program (like C exit) -TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0 - MOVW code+0(FP), R0 // arg 1 - status - MOVD $1, R8 // sys_exit - INVOKE_SYSCALL - BCC 3(PC) - MOVD $0, R0 // crash on syscall failure +TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + MOVD 0(R19), R0 // arg 1 - addr + MOVD 8(R19), R1 // arg 2 - len + MOVW 16(R19), R2 // arg 3 - prot + MOVW 20(R19), R3 // arg 4 - flags + MOVW 24(R19), R4 // arg 5 - fid + MOVW 28(R19), R5 // arg 6 - offset + CALL libc_mmap(SB) + MOVD $0, R1 + CMP $-1, R0 + BNE noerr + CALL libc_errno(SB) + MOVW (R0), R1 // errno + MOVD $0, R0 +noerr: + MOVD R0, 32(R19) + MOVD R1, 40(R19) + RET + +TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - len + MOVD 0(R0), R0 // arg 1 - addr + CALL libc_munmap(SB) + CMP $-1, R0 + BNE 3(PC) + MOVD $0, R0 // crash on failure MOVD R0, (R0) RET -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$0 - MOVD wait+0(FP), R0 // arg 1 - notdead - MOVD $302, R8 // sys___threxit - INVOKE_SYSCALL - MOVD $0, R0 // crash on syscall failure +TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 + MOVD 8(R0), R1 // arg 2 - len + MOVW 16(R0), R2 // arg 3 - advice + MOVD 0(R0), R0 // arg 1 - addr + CALL libc_madvise(SB) + // ignore failure - maybe pages are locked + RET + +TEXT runtime·open_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - flags + MOVW 12(R0), R2 // arg 3 - mode + MOVD 0(R0), R0 // arg 1 - path + MOVD $0, R3 // varargs + CALL libc_open(SB) + RET + +TEXT runtime·close_trampoline(SB),NOSPLIT,$0 + MOVD 0(R0), R0 // arg 1 - fd + CALL libc_close(SB) + RET + +TEXT runtime·read_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - buf + MOVW 16(R0), R2 // arg 3 - count + MOVW 0(R0), R0 // arg 1 - fd + CALL libc_read(SB) + CMP $-1, R0 + BNE noerr + CALL libc_errno(SB) + MOVW (R0), R0 // errno + NEG R0, R0 // caller expects negative errno value +noerr: + RET + +TEXT runtime·write_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - buf + MOVW 16(R0), R2 // arg 3 - count + MOVW 0(R0), R0 // arg 1 - fd + CALL libc_write(SB) + CMP $-1, R0 + BNE noerr + CALL libc_errno(SB) + MOVW (R0), R0 // errno + NEG R0, R0 // caller expects negative errno value +noerr: + RET + +TEXT runtime·pipe2_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - flags + MOVD 0(R0), R0 // arg 1 - filedes + CALL libc_pipe2(SB) + CMP $-1, R0 + BNE noerr + CALL libc_errno(SB) + MOVW (R0), R0 // errno + NEG R0, R0 // caller expects negative errno value +noerr: + RET + +TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - new + MOVD 16(R0), R2 // arg 3 - old + MOVW 0(R0), R0 // arg 1 - which + CALL libc_setitimer(SB) + RET + +TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0 + MOVD 0(R0), R0 // arg 1 - usec + CALL libc_usleep(SB) + RET + +TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 + MOVW 8(R0), R1 // arg 2 - miblen + MOVD 16(R0), R2 // arg 3 - out + MOVD 24(R0), R3 // arg 4 - size + MOVD 32(R0), R4 // arg 5 - dst + MOVD 40(R0), R5 // arg 6 - ndst + MOVD 0(R0), R0 // arg 1 - mib + CALL libc_sysctl(SB) + RET + +TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0 + CALL libc_kqueue(SB) + RET + +TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - keventt + MOVW 16(R0), R2 // arg 3 - nch + MOVD 24(R0), R3 // arg 4 - ev + MOVW 32(R0), R4 // arg 5 - nev + MOVD 40(R0), R5 // arg 6 - ts + MOVW 0(R0), R0 // arg 1 - kq + CALL libc_kevent(SB) + CMP $-1, R0 + BNE noerr + CALL libc_errno(SB) + MOVW (R0), R0 // errno + NEG R0, R0 // caller expects negative errno value +noerr: + RET + +TEXT runtime·clock_gettime_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - tp + MOVD 0(R0), R0 // arg 1 - clock_id + CALL libc_clock_gettime(SB) + CMP $-1, R0 + BNE 3(PC) + MOVD $0, R0 // crash on failure MOVD R0, (R0) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0 - MOVD name+0(FP), R0 // arg 1 - path - MOVW mode+8(FP), R1 // arg 2 - mode - MOVW perm+12(FP), R2 // arg 3 - perm - MOVD $5, R8 // sys_open - INVOKE_SYSCALL - BCC 2(PC) - MOVW $-1, R0 - MOVW R0, ret+16(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0 - MOVW fd+0(FP), R0 // arg 1 - fd - MOVD $6, R8 // sys_close - INVOKE_SYSCALL - BCC 2(PC) - MOVW $-1, R0 - MOVW R0, ret+8(FP) - RET - -TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0 - MOVW fd+0(FP), R0 // arg 1 - fd - MOVD p+8(FP), R1 // arg 2 - buf - MOVW n+16(FP), R2 // arg 3 - nbyte - MOVD $3, R8 // sys_read - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, ret+24(FP) - RET - -// func pipe() (r, w int32, errno int32) -TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12 - MOVD $r+0(FP), R0 - MOVW $0, R1 - MOVD $101, R8 // sys_pipe2 - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, errno+8(FP) - RET - -// func pipe2(flags int32) (r, w int32, errno int32) -TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20 - MOVD $r+8(FP), R0 - MOVW flags+0(FP), R1 - MOVD $101, R8 // sys_pipe2 - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, errno+16(FP) - RET - -TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0 - MOVD fd+0(FP), R0 // arg 1 - fd - MOVD p+8(FP), R1 // arg 2 - buf - MOVW n+16(FP), R2 // arg 3 - nbyte - MOVD $4, R8 // sys_write - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, ret+24(FP) - RET - -TEXT runtime·usleep(SB),NOSPLIT,$24-4 - MOVWU usec+0(FP), R3 - MOVD R3, R5 - MOVW $1000000, R4 - UDIV R4, R3 - MOVD R3, 8(RSP) // tv_sec - MUL R3, R4 - SUB R4, R5 - MOVW $1000, R4 - MUL R4, R5 - MOVD R5, 16(RSP) // tv_nsec - - ADD $8, RSP, R0 // arg 1 - rqtp - MOVD $0, R1 // arg 2 - rmtp - MOVD $91, R8 // sys_nanosleep - INVOKE_SYSCALL - RET - -TEXT runtime·getthrid(SB),NOSPLIT,$0-4 - MOVD $299, R8 // sys_getthrid - INVOKE_SYSCALL - MOVW R0, ret+0(FP) - RET - -TEXT runtime·thrkill(SB),NOSPLIT,$0-16 - MOVW tid+0(FP), R0 // arg 1 - tid - MOVD sig+8(FP), R1 // arg 2 - signum - MOVW $0, R2 // arg 3 - tcb - MOVD $119, R8 // sys_thrkill - INVOKE_SYSCALL - RET - -TEXT runtime·raiseproc(SB),NOSPLIT,$0 - MOVD $20, R8 // sys_getpid - INVOKE_SYSCALL - // arg 1 - pid, already in R0 - MOVW sig+0(FP), R1 // arg 2 - signum - MOVD $122, R8 // sys_kill - INVOKE_SYSCALL - RET - -TEXT runtime·mmap(SB),NOSPLIT,$0 - MOVD addr+0(FP), R0 // arg 1 - addr - MOVD n+8(FP), R1 // arg 2 - len - MOVW prot+16(FP), R2 // arg 3 - prot - MOVW flags+20(FP), R3 // arg 4 - flags - MOVW fd+24(FP), R4 // arg 5 - fd - MOVW $0, R5 // arg 6 - pad - MOVW off+28(FP), R6 // arg 7 - offset - MOVD $197, R8 // sys_mmap - INVOKE_SYSCALL - MOVD $0, R1 - BCC 3(PC) - MOVD R0, R1 // if error, move to R1 - MOVD $0, R0 - MOVD R0, p+32(FP) - MOVD R1, err+40(FP) RET -TEXT runtime·munmap(SB),NOSPLIT,$0 - MOVD addr+0(FP), R0 // arg 1 - addr - MOVD n+8(FP), R1 // arg 2 - len - MOVD $73, R8 // sys_munmap - INVOKE_SYSCALL - BCC 3(PC) +TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0 + MOVW 4(R0), R1 // arg 2 - cmd + MOVW 8(R0), R2 // arg 3 - arg + MOVW 0(R0), R0 // arg 1 - fd + MOVD $0, R3 // vararg + CALL libc_fcntl(SB) + RET + +TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - new + MOVD 16(R0), R2 // arg 3 - old + MOVW 0(R0), R0 // arg 1 - sig + CALL libc_sigaction(SB) + CMP $-1, R0 + BNE 3(PC) MOVD $0, R0 // crash on syscall failure MOVD R0, (R0) RET -TEXT runtime·madvise(SB),NOSPLIT,$0 - MOVD addr+0(FP), R0 // arg 1 - addr - MOVD n+8(FP), R1 // arg 2 - len - MOVW flags+16(FP), R2 // arg 2 - flags - MOVD $75, R8 // sys_madvise - INVOKE_SYSCALL - BCC 2(PC) - MOVW $-1, R0 - MOVW R0, ret+24(FP) - RET - -TEXT runtime·setitimer(SB),NOSPLIT,$0 - MOVW mode+0(FP), R0 // arg 1 - mode - MOVD new+8(FP), R1 // arg 2 - new value - MOVD old+16(FP), R2 // arg 3 - old value - MOVD $69, R8 // sys_setitimer - INVOKE_SYSCALL - RET - -// func walltime1() (sec int64, nsec int32) -TEXT runtime·walltime1(SB), NOSPLIT, $32 - MOVW CLOCK_REALTIME, R0 // arg 1 - clock_id - MOVD $8(RSP), R1 // arg 2 - tp - MOVD $87, R8 // sys_clock_gettime - INVOKE_SYSCALL - - MOVD 8(RSP), R0 // sec - MOVD 16(RSP), R1 // nsec - MOVD R0, sec+0(FP) - MOVW R1, nsec+8(FP) - - RET - -// int64 nanotime1(void) so really -// void nanotime1(int64 *nsec) -TEXT runtime·nanotime1(SB),NOSPLIT,$32 - MOVW CLOCK_MONOTONIC, R0 // arg 1 - clock_id - MOVD $8(RSP), R1 // arg 2 - tp - MOVD $87, R8 // sys_clock_gettime - INVOKE_SYSCALL - - MOVW 8(RSP), R3 // sec - MOVW 16(RSP), R5 // nsec - - MOVD $1000000000, R4 - MUL R4, R3 - ADD R5, R3 - MOVD R3, ret+0(FP) - RET - -TEXT runtime·sigaction(SB),NOSPLIT,$0 - MOVW sig+0(FP), R0 // arg 1 - signum - MOVD new+8(FP), R1 // arg 2 - new sigaction - MOVD old+16(FP), R2 // arg 3 - old sigaction - MOVD $46, R8 // sys_sigaction - INVOKE_SYSCALL - BCC 3(PC) - MOVD $3, R0 // crash on syscall failure +TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - new + MOVD 16(R0), R2 // arg 3 - old + MOVW 0(R0), R0 // arg 1 - how + CALL libc_pthread_sigmask(SB) + CMP $-1, R0 + BNE 3(PC) + MOVD $0, R0 // crash on syscall failure MOVD R0, (R0) RET -TEXT runtime·obsdsigprocmask(SB),NOSPLIT,$0 - MOVW how+0(FP), R0 // arg 1 - mode - MOVW new+4(FP), R1 // arg 2 - new - MOVD $48, R8 // sys_sigprocmask - INVOKE_SYSCALL - BCC 3(PC) - MOVD $3, R8 // crash on syscall failure - MOVD R8, (R8) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·sigaltstack(SB),NOSPLIT,$0 - MOVD new+0(FP), R0 // arg 1 - new sigaltstack - MOVD old+8(FP), R1 // arg 2 - old sigaltstack - MOVD $288, R8 // sys_sigaltstack - INVOKE_SYSCALL - BCC 3(PC) - MOVD $0, R8 // crash on syscall failure - MOVD R8, (R8) - RET - -TEXT runtime·sysctl(SB),NOSPLIT,$0 - MOVD mib+0(FP), R0 // arg 1 - mib - MOVW miblen+8(FP), R1 // arg 2 - miblen - MOVD out+16(FP), R2 // arg 3 - out - MOVD size+24(FP), R3 // arg 4 - size - MOVD dst+32(FP), R4 // arg 5 - dest - MOVD ndst+40(FP), R5 // arg 6 - newlen - MOVD $202, R8 // sys___sysctl - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, ret+48(FP) - RET - -// int32 runtime·kqueue(void); -TEXT runtime·kqueue(SB),NOSPLIT,$0 - MOVD $269, R8 // sys_kqueue - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, ret+0(FP) - RET - -// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout); -TEXT runtime·kevent(SB),NOSPLIT,$0 - MOVW kq+0(FP), R0 // arg 1 - kq - MOVD ch+8(FP), R1 // arg 2 - changelist - MOVW nch+16(FP), R2 // arg 3 - nchanges - MOVD ev+24(FP), R3 // arg 4 - eventlist - MOVW nev+32(FP), R4 // arg 5 - nevents - MOVD ts+40(FP), R5 // arg 6 - timeout - MOVD $72, R8 // sys_kevent - INVOKE_SYSCALL - BCC 2(PC) - NEG R0, R0 - MOVW R0, ret+48(FP) - RET - -// func closeonexec(fd int32) -TEXT runtime·closeonexec(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 // arg 1 - fd - MOVD $2, R1 // arg 2 - cmd (F_SETFD) - MOVD $1, R2 // arg 3 - arg (FD_CLOEXEC) - MOVD $92, R8 // sys_fcntl - INVOKE_SYSCALL - RET - -// func runtime·setNonblock(int32 fd) -TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4 - MOVW fd+0(FP), R0 // arg 1 - fd - MOVD $3, R1 // arg 2 - cmd (F_GETFL) - MOVD $0, R2 // arg 3 - MOVD $92, R8 // sys_fcntl - INVOKE_SYSCALL - MOVD $4, R2 // O_NONBLOCK - ORR R0, R2 // arg 3 - flags - MOVW fd+0(FP), R0 // arg 1 - fd - MOVD $4, R1 // arg 2 - cmd (F_SETFL) - MOVD $92, R8 // sys_fcntl - INVOKE_SYSCALL +TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 + MOVD 8(R0), R1 // arg 2 - old + MOVD 0(R0), R0 // arg 1 - new + CALL libc_sigaltstack(SB) + CMP $-1, R0 + BNE 3(PC) + MOVD $0, R0 // crash on syscall failure + MOVD R0, (R0) RET -- cgit v1.3-5-g9baa From 8cfa01943a7f43493543efba81996221bb0f27f8 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Wed, 27 Jan 2021 19:02:37 +0000 Subject: runtime: block console ctrlhandler when the signal is handled Fixes #41884 I can confirm this change fixes my issue. I can't confirm that this doesn't break any and everything else. I see that this code has been tweaked repeatedly, so I would really welcome guidance into further testing. Change-Id: I1986dd0c2f30cfe10257f0d8c658988d6986f7a6 GitHub-Last-Rev: 92f02c96973e12f1472511bcf3c5ebb36c6b0440 GitHub-Pull-Request: golang/go#41886 Reviewed-on: https://go-review.googlesource.com/c/go/+/261057 Run-TryBot: Jason A. Donenfeld TryBot-Result: Go Bot Reviewed-by: Jason A. Donenfeld Trust: Jason A. Donenfeld Trust: Alex Brainman --- src/runtime/os_windows.go | 7 ++++ src/runtime/signal_windows_test.go | 64 ++++++++++++++++++++++++++++++ src/runtime/testdata/testwinsignal/main.go | 19 +++++++++ 3 files changed, 90 insertions(+) create mode 100644 src/runtime/testdata/testwinsignal/main.go (limited to 'src/runtime') diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 83d0d63e5d..e6b22e3167 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -46,6 +46,7 @@ const ( //go:cgo_import_dynamic runtime._SetThreadPriority SetThreadPriority%2 "kernel32.dll" //go:cgo_import_dynamic runtime._SetUnhandledExceptionFilter SetUnhandledExceptionFilter%1 "kernel32.dll" //go:cgo_import_dynamic runtime._SetWaitableTimer SetWaitableTimer%6 "kernel32.dll" +//go:cgo_import_dynamic runtime._Sleep Sleep%1 "kernel32.dll" //go:cgo_import_dynamic runtime._SuspendThread SuspendThread%1 "kernel32.dll" //go:cgo_import_dynamic runtime._SwitchToThread SwitchToThread%0 "kernel32.dll" //go:cgo_import_dynamic runtime._TlsAlloc TlsAlloc%0 "kernel32.dll" @@ -97,6 +98,7 @@ var ( _SetThreadPriority, _SetUnhandledExceptionFilter, _SetWaitableTimer, + _Sleep, _SuspendThread, _SwitchToThread, _TlsAlloc, @@ -1094,6 +1096,11 @@ func ctrlhandler1(_type uint32) uint32 { } if sigsend(s) { + if s == _SIGTERM { + // Windows terminates the process after this handler returns. + // Block indefinitely to give signal handlers a chance to clean up. + stdcall1(_Sleep, uintptr(_INFINITE)) + } return 1 } return 0 diff --git a/src/runtime/signal_windows_test.go b/src/runtime/signal_windows_test.go index a5a885c2f7..33a9b92ee7 100644 --- a/src/runtime/signal_windows_test.go +++ b/src/runtime/signal_windows_test.go @@ -11,6 +11,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strconv" "strings" "syscall" "testing" @@ -79,6 +80,69 @@ func sendCtrlBreak(pid int) error { return nil } +// TestCtrlHandler tests that Go can gracefully handle closing the console window. +// See https://golang.org/issues/41884. +func TestCtrlHandler(t *testing.T) { + testenv.MustHaveGoBuild(t) + t.Parallel() + + // build go program + exe := filepath.Join(t.TempDir(), "test.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe, "testdata/testwinsignal/main.go") + out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() + if err != nil { + t.Fatalf("failed to build go exe: %v\n%s", err, out) + } + + // run test program + cmd = exec.Command(exe) + var stderr bytes.Buffer + cmd.Stderr = &stderr + outPipe, err := cmd.StdoutPipe() + if err != nil { + t.Fatalf("Failed to create stdout pipe: %v", err) + } + outReader := bufio.NewReader(outPipe) + + // in a new command window + const _CREATE_NEW_CONSOLE = 0x00000010 + cmd.SysProcAttr = &syscall.SysProcAttr{ + CreationFlags: _CREATE_NEW_CONSOLE, + HideWindow: true, + } + if err := cmd.Start(); err != nil { + t.Fatalf("Start failed: %v", err) + } + defer func() { + cmd.Process.Kill() + cmd.Wait() + }() + + // wait for child to be ready to receive signals + if line, err := outReader.ReadString('\n'); err != nil { + t.Fatalf("could not read stdout: %v", err) + } else if strings.TrimSpace(line) != "ready" { + t.Fatalf("unexpected message: %s", line) + } + + // gracefully kill pid, this closes the command window + if err := exec.Command("taskkill.exe", "/pid", strconv.Itoa(cmd.Process.Pid)).Run(); err != nil { + t.Fatalf("failed to kill: %v", err) + } + + // check child received, handled SIGTERM + if line, err := outReader.ReadString('\n'); err != nil { + t.Fatalf("could not read stdout: %v", err) + } else if expected, got := syscall.SIGTERM.String(), strings.TrimSpace(line); expected != got { + t.Fatalf("Expected '%s' got: %s", expected, got) + } + + // check child exited gracefully, did not timeout + if err := cmd.Wait(); err != nil { + t.Fatalf("Program exited with error: %v\n%s", err, &stderr) + } +} + // TestLibraryCtrlHandler tests that Go DLL allows calling program to handle console control events. // See https://golang.org/issues/35965. func TestLibraryCtrlHandler(t *testing.T) { diff --git a/src/runtime/testdata/testwinsignal/main.go b/src/runtime/testdata/testwinsignal/main.go new file mode 100644 index 0000000000..d8cd884ffa --- /dev/null +++ b/src/runtime/testdata/testwinsignal/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "os" + "os/signal" + "time" +) + +func main() { + c := make(chan os.Signal, 1) + signal.Notify(c) + + fmt.Println("ready") + sig := <-c + + time.Sleep(time.Second) + fmt.Println(sig) +} -- cgit v1.3-5-g9baa From a5a5e2c968eb14335f4e46606d8edfbdbdcea728 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Mon, 25 Jan 2021 17:51:03 -0800 Subject: runtime: make sure to remove open-coded defer entries in all cases after a recover We add entries to the defer list at panic/goexit time on-the-fly for frames with open-coded defers. We do this so that we can correctly process open-coded defers and non-open-coded defers in the correct order during panics/goexits. But we need to remove entries for open-coded defers from the defer list when there is a recover, since those entries may never get removed otherwise and will get stale, since their corresponding defers may now be processed normally (inline). This bug here is that we were only removing higher-up stale entries during a recover if all defers in the current frame were done. But we could have more defers in the current frame (as the new test case shows). In this case, we need to leave the current defer entry around for use by deferreturn, but still remove any stale entries further along the chain. For bug 43921, simple change that we should abort the removal loop for any defer entry that is started (i.e. in process by a still not-recovered outer panic), even if it is not an open-coded defer. This change does not fix bug 43920, which looks to be a more complex fix. Fixes #43882 Fixes #43921 Change-Id: Ie05b2fa26973aa26b25c8899a2abc916090ee4f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/286712 Run-TryBot: Dan Scales TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky Reviewed-by: Keith Randall Trust: Dan Scales --- src/runtime/crash_test.go | 12 ++++++ src/runtime/defer_test.go | 28 ++++++++++++++ src/runtime/panic.go | 63 +++++++++++++++++-------------- src/runtime/testdata/testprog/deadlock.go | 39 +++++++++++++++++++ 4 files changed, 113 insertions(+), 29 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go index 58ad4f3eba..e5bd7973b7 100644 --- a/src/runtime/crash_test.go +++ b/src/runtime/crash_test.go @@ -294,6 +294,18 @@ func TestRecursivePanic4(t *testing.T) { } +func TestRecursivePanic5(t *testing.T) { + output := runTestProg(t, "testprog", "RecursivePanic5") + want := `first panic +second panic +panic: third panic +` + if !strings.HasPrefix(output, want) { + t.Fatalf("output does not start with %q:\n%s", want, output) + } + +} + func TestGoexitCrash(t *testing.T) { // External linking brings in cgo, causing deadlock detection not working. testenv.MustInternalLink(t) diff --git a/src/runtime/defer_test.go b/src/runtime/defer_test.go index 5ac0814564..9a40ea1984 100644 --- a/src/runtime/defer_test.go +++ b/src/runtime/defer_test.go @@ -410,3 +410,31 @@ func rec1(max int) { rec1(max - 1) } } + +func TestIssue43921(t *testing.T) { + defer func() { + expect(t, 1, recover()) + }() + func() { + // Prevent open-coded defers + for { + defer func() {}() + break + } + + defer func() { + defer func() { + expect(t, 4, recover()) + }() + panic(4) + }() + panic(1) + + }() +} + +func expect(t *testing.T, n int, err interface{}) { + if n != err { + t.Fatalf("have %v, want %v", err, n) + } +} diff --git a/src/runtime/panic.go b/src/runtime/panic.go index aed17d6fc6..5b2ccdd874 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -1000,37 +1000,42 @@ func gopanic(e interface{}) { } atomic.Xadd(&runningPanicDefers, -1) - if done { - // Remove any remaining non-started, open-coded - // defer entries after a recover, since the - // corresponding defers will be executed normally - // (inline). Any such entry will become stale once - // we run the corresponding defers inline and exit - // the associated stack frame. - d := gp._defer - var prev *_defer - for d != nil { - if d.openDefer { - if d.started { - // This defer is started but we - // are in the middle of a - // defer-panic-recover inside of - // it, so don't remove it or any - // further defer entries - break - } - if prev == nil { - gp._defer = d.link - } else { - prev.link = d.link - } - newd := d.link - freedefer(d) - d = newd + // Remove any remaining non-started, open-coded + // defer entries after a recover, since the + // corresponding defers will be executed normally + // (inline). Any such entry will become stale once + // we run the corresponding defers inline and exit + // the associated stack frame. + d := gp._defer + var prev *_defer + if !done { + // Skip our current frame, if not done. It is + // needed to complete any remaining defers in + // deferreturn() + prev = d + d = d.link + } + for d != nil { + if d.started { + // This defer is started but we + // are in the middle of a + // defer-panic-recover inside of + // it, so don't remove it or any + // further defer entries + break + } + if d.openDefer { + if prev == nil { + gp._defer = d.link } else { - prev = d - d = d.link + prev.link = d.link } + newd := d.link + freedefer(d) + d = newd + } else { + prev = d + d = d.link } } diff --git a/src/runtime/testdata/testprog/deadlock.go b/src/runtime/testdata/testprog/deadlock.go index 105d6a5faa..781acbd770 100644 --- a/src/runtime/testdata/testprog/deadlock.go +++ b/src/runtime/testdata/testprog/deadlock.go @@ -25,6 +25,7 @@ func init() { register("RecursivePanic2", RecursivePanic2) register("RecursivePanic3", RecursivePanic3) register("RecursivePanic4", RecursivePanic4) + register("RecursivePanic5", RecursivePanic5) register("GoexitExit", GoexitExit) register("GoNil", GoNil) register("MainGoroutineID", MainGoroutineID) @@ -160,6 +161,44 @@ func RecursivePanic4() { panic("first panic") } +// Test case where we have an open-coded defer higher up the stack (in two), and +// in the current function (three) we recover in a defer while we still have +// another defer to be processed. +func RecursivePanic5() { + one() + panic("third panic") +} + +//go:noinline +func one() { + two() +} + +//go:noinline +func two() { + defer func() { + }() + + three() +} + +//go:noinline +func three() { + defer func() { + }() + + defer func() { + fmt.Println(recover()) + }() + + defer func() { + fmt.Println(recover()) + panic("second panic") + }() + + panic("first panic") +} + func GoexitExit() { println("t1") go func() { -- cgit v1.3-5-g9baa From 376518d77fb5d718f90c8b66ea25660aa3734032 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Wed, 27 Jan 2021 01:48:47 +1100 Subject: runtime,syscall: convert syscall on openbsd/arm64 to libc Convert the syscall package on openbsd/arm64 to use libc rather than performing direct system calls. Updates #36435 Change-Id: I7e1da8537cea9ed9bf2676f181e56ae99383333f Reviewed-on: https://go-review.googlesource.com/c/go/+/286815 Trust: Joel Sing Reviewed-by: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot --- src/runtime/sys_openbsd3.go | 2 +- src/runtime/sys_openbsd_arm64.s | 295 +++++++++++ src/syscall/asm_openbsd_arm64.s | 140 +---- src/syscall/exec_bsd.go | 2 +- src/syscall/exec_libc2.go | 2 +- src/syscall/mkall.sh | 5 +- src/syscall/syscall_openbsd1.go | 2 +- src/syscall/syscall_openbsd_libc.go | 2 +- src/syscall/zsyscall_openbsd_arm64.go | 941 +++++++++++++++++++++++++++++----- src/syscall/zsyscall_openbsd_arm64.s | 233 +++++++++ 10 files changed, 1372 insertions(+), 252 deletions(-) create mode 100644 src/syscall/zsyscall_openbsd_arm64.s (limited to 'src/runtime') diff --git a/src/runtime/sys_openbsd3.go b/src/runtime/sys_openbsd3.go index a8f9b0ee14..4d4c88e3ac 100644 --- a/src/runtime/sys_openbsd3.go +++ b/src/runtime/sys_openbsd3.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package runtime diff --git a/src/runtime/sys_openbsd_arm64.s b/src/runtime/sys_openbsd_arm64.s index 0fd983ef25..9b4acc90a5 100644 --- a/src/runtime/sys_openbsd_arm64.s +++ b/src/runtime/sys_openbsd_arm64.s @@ -403,3 +403,298 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 MOVD $0, R0 // crash on syscall failure MOVD R0, (R0) RET + +// syscall calls a function in libc on behalf of the syscall package. +// syscall takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall expects a 32-bit result and tests for 32-bit -1 +// to decide there was an error. +TEXT runtime·syscall(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD $0, R3 // vararg + + CALL R11 + + MOVD R0, (4*8)(R19) // r1 + MOVD R1, (5*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMPW $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (6*8)(R19) // err + +ok: + RET + +// syscallX calls a function in libc on behalf of the syscall package. +// syscallX takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscallX must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscallX is like syscall but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscallX(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD $0, R3 // vararg + + CALL R11 + + MOVD R0, (4*8)(R19) // r1 + MOVD R1, (5*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMP $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (6*8)(R19) // err + +ok: + RET + +// syscall6 calls a function in libc on behalf of the syscall package. +// syscall6 takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall6 must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall6 expects a 32-bit result and tests for 32-bit -1 +// to decide there was an error. +TEXT runtime·syscall6(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD (4*8)(R19), R3 // a4 + MOVD (5*8)(R19), R4 // a5 + MOVD (6*8)(R19), R5 // a6 + MOVD $0, R6 // vararg + + CALL R11 + + MOVD R0, (7*8)(R19) // r1 + MOVD R1, (8*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMPW $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (9*8)(R19) // err + +ok: + RET + +// syscall6X calls a function in libc on behalf of the syscall package. +// syscall6X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall6X must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall6X is like syscall6 but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscall6X(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD (4*8)(R19), R3 // a4 + MOVD (5*8)(R19), R4 // a5 + MOVD (6*8)(R19), R5 // a6 + MOVD $0, R6 // vararg + + CALL R11 + + MOVD R0, (7*8)(R19) // r1 + MOVD R1, (8*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMP $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (9*8)(R19) // err + +ok: + RET + +// syscall10 calls a function in libc on behalf of the syscall package. +// syscall10 takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall10 must be called on the g0 stack with the +// C calling convention (use libcCall). +TEXT runtime·syscall10(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD (4*8)(R19), R3 // a4 + MOVD (5*8)(R19), R4 // a5 + MOVD (6*8)(R19), R5 // a6 + MOVD (7*8)(R19), R6 // a7 + MOVD (8*8)(R19), R7 // a8 + MOVD (9*8)(R19), R8 // a9 + MOVD (10*8)(R19), R9 // a10 + MOVD $0, R10 // vararg + + CALL R11 + + MOVD R0, (11*8)(R19) // r1 + MOVD R1, (12*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMPW $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (13*8)(R19) // err + +ok: + RET + +// syscall10X calls a function in libc on behalf of the syscall package. +// syscall10X takes a pointer to a struct like: +// struct { +// fn uintptr +// a1 uintptr +// a2 uintptr +// a3 uintptr +// a4 uintptr +// a5 uintptr +// a6 uintptr +// a7 uintptr +// a8 uintptr +// a9 uintptr +// a10 uintptr +// r1 uintptr +// r2 uintptr +// err uintptr +// } +// syscall10X must be called on the g0 stack with the +// C calling convention (use libcCall). +// +// syscall10X is like syscall10 but expects a 64-bit result +// and tests for 64-bit -1 to decide there was an error. +TEXT runtime·syscall10X(SB),NOSPLIT,$0 + MOVD R0, R19 // pointer to args + + MOVD (0*8)(R19), R11 // fn + MOVD (1*8)(R19), R0 // a1 + MOVD (2*8)(R19), R1 // a2 + MOVD (3*8)(R19), R2 // a3 + MOVD (4*8)(R19), R3 // a4 + MOVD (5*8)(R19), R4 // a5 + MOVD (6*8)(R19), R5 // a6 + MOVD (7*8)(R19), R6 // a7 + MOVD (8*8)(R19), R7 // a8 + MOVD (9*8)(R19), R8 // a9 + MOVD (10*8)(R19), R9 // a10 + MOVD $0, R10 // vararg + + CALL R11 + + MOVD R0, (11*8)(R19) // r1 + MOVD R1, (12*8)(R19) // r2 + + // Standard libc functions return -1 on error + // and set errno. + CMP $-1, R0 + BNE ok + + // Get error code from libc. + CALL libc_errno(SB) + MOVW (R0), R0 + MOVD R0, (13*8)(R19) // err + +ok: + RET diff --git a/src/syscall/asm_openbsd_arm64.s b/src/syscall/asm_openbsd_arm64.s index dcbed10cbe..61595a11a3 100644 --- a/src/syscall/asm_openbsd_arm64.s +++ b/src/syscall/asm_openbsd_arm64.s @@ -4,127 +4,29 @@ #include "textflag.h" -// See comment in runtime/sys_openbsd_arm64.s re this construction. -#define INVOKE_SYSCALL \ - SVC; \ - NOOP; \ - NOOP +// +// System call support for ARM64, OpenBSD +// -// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64); -TEXT ·Syscall(SB),NOSPLIT,$0-56 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R0 - MOVD a2+16(FP), R1 - MOVD a3+24(FP), R2 - MOVD $0, R3 - MOVD $0, R4 - MOVD $0, R5 - MOVD trap+0(FP), R8 // syscall number - INVOKE_SYSCALL - BCC ok - MOVD $-1, R4 - MOVD R4, r1+32(FP) // r1 - MOVD ZR, r2+40(FP) // r2 - MOVD R0, err+48(FP) // errno - BL runtime·exitsyscall(SB) - RET -ok: - MOVD R0, r1+32(FP) // r1 - MOVD R1, r2+40(FP) // r2 - MOVD ZR, err+48(FP) // errno - BL runtime·exitsyscall(SB) - RET +// Provide these function names via assembly so they are provided as ABI0, +// rather than ABIInternal. -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R0 - MOVD a2+16(FP), R1 - MOVD a3+24(FP), R2 - MOVD a4+32(FP), R3 - MOVD a5+40(FP), R4 - MOVD a6+48(FP), R5 - MOVD trap+0(FP), R8 // syscall number - INVOKE_SYSCALL - BCC ok - MOVD $-1, R4 - MOVD R4, r1+56(FP) // r1 - MOVD ZR, r2+64(FP) // r2 - MOVD R0, err+72(FP) // errno - BL runtime·exitsyscall(SB) - RET -ok: - MOVD R0, r1+56(FP) // r1 - MOVD R1, r2+64(FP) // r2 - MOVD ZR, err+72(FP) // errno - BL runtime·exitsyscall(SB) - RET +// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP ·syscallInternal(SB) -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - BL runtime·entersyscall(SB) - MOVD a1+8(FP), R0 - MOVD a2+16(FP), R1 - MOVD a3+24(FP), R2 - MOVD a4+32(FP), R3 - MOVD a5+40(FP), R4 - MOVD a6+48(FP), R5 - MOVD a7+56(FP), R6 - MOVD a8+64(FP), R7 - MOVD a9+72(FP), R8 // on stack - MOVD R8, 8(RSP) - MOVD num+0(FP), R8 // syscall number - INVOKE_SYSCALL - BCC ok - MOVD $-1, R4 - MOVD R4, r1+80(FP) // r1 - MOVD ZR, r2+88(FP) // r2 - MOVD R0, err+96(FP) // errno - BL runtime·exitsyscall(SB) - RET -ok: - MOVD R0, r1+80(FP) // r1 - MOVD R1, r2+88(FP) // r2 - MOVD ZR, err+96(FP) // errno - BL runtime·exitsyscall(SB) - RET +// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP ·syscall6Internal(SB) -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - MOVD a1+8(FP), R0 - MOVD a2+16(FP), R1 - MOVD a3+24(FP), R2 - MOVD $0, R3 - MOVD $0, R4 - MOVD $0, R5 - MOVD trap+0(FP), R8 // syscall number - INVOKE_SYSCALL - BCC ok - MOVD $-1, R4 - MOVD R4, r1+32(FP) // r1 - MOVD ZR, r2+40(FP) // r2 - MOVD R0, err+48(FP) // errno - RET -ok: - MOVD R0, r1+32(FP) // r1 - MOVD R1, r2+40(FP) // r2 - MOVD ZR, err+48(FP) // errno - RET +// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP ·rawSyscallInternal(SB) -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - MOVD a1+8(FP), R0 - MOVD a2+16(FP), R1 - MOVD a3+24(FP), R2 - MOVD a4+32(FP), R3 - MOVD a5+40(FP), R4 - MOVD a6+48(FP), R5 - MOVD trap+0(FP), R8 // syscall number - INVOKE_SYSCALL - BCC ok - MOVD $-1, R4 - MOVD R4, r1+56(FP) // r1 - MOVD ZR, r2+64(FP) // r2 - MOVD R0, err+72(FP) // errno - RET -ok: - MOVD R0, r1+56(FP) // r1 - MOVD R1, r2+64(FP) // r2 - MOVD ZR, err+72(FP) // errno - RET +// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP ·rawSyscall6Internal(SB) + +// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP ·syscall9Internal(SB) diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go index 9069ef4613..940a81b58e 100644 --- a/src/syscall/exec_bsd.go +++ b/src/syscall/exec_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd netbsd openbsd,!amd64 +// +build dragonfly freebsd netbsd openbsd,!amd64,!arm64 package syscall diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go index 496e7cf4c3..45d3f85baf 100644 --- a/src/syscall/exec_libc2.go +++ b/src/syscall/exec_libc2.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin openbsd,amd64 +// +build darwin openbsd,amd64 openbsd,arm64 package syscall diff --git a/src/syscall/mkall.sh b/src/syscall/mkall.sh index 87e5157416..d1e28efa8c 100755 --- a/src/syscall/mkall.sh +++ b/src/syscall/mkall.sh @@ -313,15 +313,16 @@ openbsd_arm) mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; openbsd_arm64) - GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" + GOOSARCH_in="syscall_openbsd_libc.go syscall_openbsd_$GOARCH.go" mkerrors="$mkerrors -m64" - mksyscall="./mksyscall.pl -openbsd" + mksyscall="./mksyscall.pl -openbsd -libc" mksysctl="./mksysctl_openbsd.pl" zsysctl="zsysctl_openbsd.go" mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl" # Let the type of C char be signed to make the bare syscall # API consistent between platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + mkasm="go run mkasm.go" ;; openbsd_mips64) GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go" diff --git a/src/syscall/syscall_openbsd1.go b/src/syscall/syscall_openbsd1.go index d8065374fb..2c7d0f8c90 100644 --- a/src/syscall/syscall_openbsd1.go +++ b/src/syscall/syscall_openbsd1.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,!amd64 +// +build openbsd,!amd64,!arm64 package syscall diff --git a/src/syscall/syscall_openbsd_libc.go b/src/syscall/syscall_openbsd_libc.go index 191c7e0e43..2fcc2011bc 100644 --- a/src/syscall/syscall_openbsd_libc.go +++ b/src/syscall/syscall_openbsd_libc.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd,amd64 +// +build openbsd,amd64 openbsd,arm64 package syscall diff --git a/src/syscall/zsyscall_openbsd_arm64.go b/src/syscall/zsyscall_openbsd_arm64.go index 626ce17703..90a46f3c4b 100644 --- a/src/syscall/zsyscall_openbsd_arm64.go +++ b/src/syscall/zsyscall_openbsd_arm64.go @@ -1,4 +1,4 @@ -// mksyscall.pl -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go +// mksyscall.pl -openbsd -libc -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_libc.go syscall_openbsd_arm64.go // Code generated by the command above; DO NOT EDIT. // +build openbsd,arm64 @@ -10,7 +10,7 @@ import "unsafe" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -18,20 +18,30 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } +func libc_getgroups_trampoline() + +//go:linkname libc_getgroups libc_getgroups +//go:cgo_import_dynamic libc_getgroups getgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setgroups_trampoline() + +//go:linkname libc_setgroups libc_setgroups +//go:cgo_import_dynamic libc_setgroups setgroups "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -39,10 +49,15 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } +func libc_wait4_trampoline() + +//go:linkname libc_wait4 libc_wait4 +//go:cgo_import_dynamic libc_wait4 wait4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -50,30 +65,45 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } +func libc_accept_trampoline() + +//go:linkname libc_accept libc_accept +//go:cgo_import_dynamic libc_accept accept "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_bind_trampoline() + +//go:linkname libc_bind libc_bind +//go:cgo_import_dynamic libc_bind bind "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_connect_trampoline() + +//go:linkname libc_connect libc_connect +//go:cgo_import_dynamic libc_connect connect "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -81,66 +111,101 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } +func libc_socket_trampoline() + +//go:linkname libc_socket libc_socket +//go:cgo_import_dynamic libc_socket socket "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getsockopt_trampoline() + +//go:linkname libc_getsockopt libc_getsockopt +//go:cgo_import_dynamic libc_getsockopt getsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setsockopt_trampoline() + +//go:linkname libc_setsockopt libc_setsockopt +//go:cgo_import_dynamic libc_setsockopt setsockopt "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getpeername_trampoline() + +//go:linkname libc_getpeername libc_getpeername +//go:cgo_import_dynamic libc_getpeername getpeername "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getsockname_trampoline() + +//go:linkname libc_getsockname libc_getsockname +//go:cgo_import_dynamic libc_getsockname getsockname "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + _, _, e1 := syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_shutdown_trampoline() + +//go:linkname libc_shutdown libc_shutdown +//go:cgo_import_dynamic libc_shutdown shutdown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_socketpair_trampoline() + +//go:linkname libc_socketpair libc_socketpair +//go:cgo_import_dynamic libc_socketpair socketpair "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -150,7 +215,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -158,6 +223,11 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } +func libc_recvfrom_trampoline() + +//go:linkname libc_recvfrom libc_recvfrom +//go:cgo_import_dynamic libc_recvfrom recvfrom "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -167,17 +237,22 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_sendto_trampoline() + +//go:linkname libc_sendto libc_sendto +//go:cgo_import_dynamic libc_sendto sendto "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -185,10 +260,15 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +func libc_recvmsg_trampoline() + +//go:linkname libc_recvmsg libc_recvmsg +//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -196,10 +276,15 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } +func libc_sendmsg_trampoline() + +//go:linkname libc_sendmsg libc_sendmsg +//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -207,6 +292,11 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } +func libc_kevent_trampoline() + +//go:linkname libc_kevent libc_kevent +//go:cgo_import_dynamic libc_kevent kevent "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -215,27 +305,37 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_utimes_trampoline() + +//go:linkname libc_utimes libc_utimes +//go:cgo_import_dynamic libc_utimes utimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_futimes_trampoline() + +//go:linkname libc_futimes libc_futimes +//go:cgo_import_dynamic libc_futimes futimes "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -243,20 +343,30 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } +func libc_fcntl_trampoline() + +//go:linkname libc_fcntl libc_fcntl +//go:cgo_import_dynamic libc_fcntl fcntl "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + _, _, e1 := rawSyscall(funcPC(libc_pipe2_trampoline), uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_pipe2_trampoline() + +//go:linkname libc_pipe2 libc_pipe2 +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) { - r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + r0, _, e1 := syscall6(funcPC(libc_accept4_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -264,6 +374,11 @@ func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int return } +func libc_accept4_trampoline() + +//go:linkname libc_accept4 libc_accept4 +//go:cgo_import_dynamic libc_accept4 accept4 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getdents(fd int, buf []byte) (n int, err error) { @@ -273,7 +388,7 @@ func getdents(fd int, buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + r0, _, e1 := syscall(funcPC(libc_getdents_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,6 +396,11 @@ func getdents(fd int, buf []byte) (n int, err error) { return } +func libc_getdents_trampoline() + +//go:linkname libc_getdents libc_getdents +//go:cgo_import_dynamic libc_getdents getdents "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -289,23 +409,33 @@ func Access(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_access_trampoline() + +//go:linkname libc_access libc_access +//go:cgo_import_dynamic libc_access access "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_adjtime_trampoline() + +//go:linkname libc_adjtime libc_adjtime +//go:cgo_import_dynamic libc_adjtime adjtime "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -314,13 +444,18 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chdir_trampoline() + +//go:linkname libc_chdir libc_chdir +//go:cgo_import_dynamic libc_chdir chdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -329,13 +464,18 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chflags_trampoline() + +//go:linkname libc_chflags libc_chflags +//go:cgo_import_dynamic libc_chflags chflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -344,13 +484,18 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chmod_trampoline() + +//go:linkname libc_chmod libc_chmod +//go:cgo_import_dynamic libc_chmod chmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -359,13 +504,18 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chown_trampoline() + +//go:linkname libc_chown libc_chown +//go:cgo_import_dynamic libc_chown chown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -374,27 +524,37 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_chroot_trampoline() + +//go:linkname libc_chroot libc_chroot +//go:cgo_import_dynamic libc_chroot chroot "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_close_trampoline() + +//go:linkname libc_close libc_close +//go:cgo_import_dynamic libc_close close "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + r0, _, e1 := syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -402,70 +562,105 @@ func Dup(fd int) (nfd int, err error) { return } +func libc_dup_trampoline() + +//go:linkname libc_dup libc_dup +//go:cgo_import_dynamic libc_dup dup "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + _, _, e1 := syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_dup2_trampoline() + +//go:linkname libc_dup2 libc_dup2 +//go:cgo_import_dynamic libc_dup2 dup2 "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchdir_trampoline() + +//go:linkname libc_fchdir libc_fchdir +//go:cgo_import_dynamic libc_fchdir fchdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchflags_trampoline() + +//go:linkname libc_fchflags libc_fchflags +//go:cgo_import_dynamic libc_fchflags fchflags "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchmod_trampoline() + +//go:linkname libc_fchmod libc_fchmod +//go:cgo_import_dynamic libc_fchmod fchmod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fchown_trampoline() + +//go:linkname libc_fchown libc_fchown +//go:cgo_import_dynamic libc_fchown fchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_flock_trampoline() + +//go:linkname libc_flock libc_flock +//go:cgo_import_dynamic libc_flock flock "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -473,74 +668,114 @@ func Fpathconf(fd int, name int) (val int, err error) { return } +func libc_fpathconf_trampoline() + +//go:linkname libc_fpathconf libc_fpathconf +//go:cgo_import_dynamic libc_fpathconf fpathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fstat_trampoline() + +//go:linkname libc_fstat libc_fstat +//go:cgo_import_dynamic libc_fstat fstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fstatfs_trampoline() + +//go:linkname libc_fstatfs libc_fstatfs +//go:cgo_import_dynamic libc_fstatfs fstatfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + _, _, e1 := syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_fsync_trampoline() + +//go:linkname libc_fsync libc_fsync +//go:cgo_import_dynamic libc_fsync fsync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + _, _, e1 := syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_ftruncate_trampoline() + +//go:linkname libc_ftruncate libc_ftruncate +//go:cgo_import_dynamic libc_ftruncate ftruncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) egid = int(r0) return } +func libc_getegid_trampoline() + +//go:linkname libc_getegid libc_getegid +//go:cgo_import_dynamic libc_getegid getegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) uid = int(r0) return } +func libc_geteuid_trampoline() + +//go:linkname libc_geteuid libc_geteuid +//go:cgo_import_dynamic libc_geteuid geteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) gid = int(r0) return } +func libc_getgid_trampoline() + +//go:linkname libc_getgid libc_getgid +//go:cgo_import_dynamic libc_getgid getgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -548,34 +783,54 @@ func Getpgid(pid int) (pgid int, err error) { return } +func libc_getpgid_trampoline() + +//go:linkname libc_getpgid libc_getpgid +//go:cgo_import_dynamic libc_getpgid getpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) pgrp = int(r0) return } +func libc_getpgrp_trampoline() + +//go:linkname libc_getpgrp libc_getpgrp +//go:cgo_import_dynamic libc_getpgrp getpgrp "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) pid = int(r0) return } +func libc_getpid_trampoline() + +//go:linkname libc_getpid libc_getpid +//go:cgo_import_dynamic libc_getpid getpid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) ppid = int(r0) return } +func libc_getppid_trampoline() + +//go:linkname libc_getppid libc_getppid +//go:cgo_import_dynamic libc_getppid getppid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -583,30 +838,45 @@ func Getpriority(which int, who int) (prio int, err error) { return } +func libc_getpriority_trampoline() + +//go:linkname libc_getpriority libc_getpriority +//go:cgo_import_dynamic libc_getpriority getpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getrlimit_trampoline() + +//go:linkname libc_getrlimit libc_getrlimit +//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_getrusage_trampoline() + +//go:linkname libc_getrusage libc_getrusage +//go:cgo_import_dynamic libc_getrusage getrusage "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -614,46 +884,71 @@ func Getsid(pid int) (sid int, err error) { return } +func libc_getsid_trampoline() + +//go:linkname libc_getsid libc_getsid +//go:cgo_import_dynamic libc_getsid getsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_gettimeofday_trampoline() + +//go:linkname libc_gettimeofday libc_gettimeofday +//go:cgo_import_dynamic libc_gettimeofday gettimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + r0, _, _ := rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) uid = int(r0) return } +func libc_getuid_trampoline() + +//go:linkname libc_getuid libc_getuid +//go:cgo_import_dynamic libc_getuid getuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := syscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) tainted = bool(r0 != 0) return } +func libc_issetugid_trampoline() + +//go:linkname libc_issetugid libc_issetugid +//go:cgo_import_dynamic libc_issetugid issetugid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kill(pid int, signum Signal) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + _, _, e1 := syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_kill_trampoline() + +//go:linkname libc_kill libc_kill +//go:cgo_import_dynamic libc_kill kill "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + r0, _, e1 := syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -661,6 +956,11 @@ func Kqueue() (fd int, err error) { return } +func libc_kqueue_trampoline() + +//go:linkname libc_kqueue libc_kqueue +//go:cgo_import_dynamic libc_kqueue kqueue "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -669,13 +969,18 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lchown_trampoline() + +//go:linkname libc_lchown libc_lchown +//go:cgo_import_dynamic libc_lchown lchown "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -689,23 +994,33 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_link_trampoline() + +//go:linkname libc_link libc_link +//go:cgo_import_dynamic libc_link link "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_listen_trampoline() + +//go:linkname libc_listen libc_listen +//go:cgo_import_dynamic libc_listen listen "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -714,13 +1029,18 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lstat_trampoline() + +//go:linkname libc_lstat libc_lstat +//go:cgo_import_dynamic libc_lstat lstat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -729,13 +1049,18 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mkdir_trampoline() + +//go:linkname libc_mkdir libc_mkdir +//go:cgo_import_dynamic libc_mkdir mkdir "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -744,13 +1069,18 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mkfifo_trampoline() + +//go:linkname libc_mkfifo libc_mkfifo +//go:cgo_import_dynamic libc_mkfifo mkfifo "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -759,23 +1089,33 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_mknod_trampoline() + +//go:linkname libc_mknod libc_mknod +//go:cgo_import_dynamic libc_mknod mknod "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Nanosleep(time *Timespec, leftover *Timespec) (err error) { - _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + _, _, e1 := syscall(funcPC(libc_nanosleep_trampoline), uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_nanosleep_trampoline() + +//go:linkname libc_nanosleep libc_nanosleep +//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -784,7 +1124,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -792,6 +1132,11 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } +func libc_open_trampoline() + +//go:linkname libc_open libc_open +//go:cgo_import_dynamic libc_open open "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -800,7 +1145,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -808,6 +1153,11 @@ func Pathconf(path string, name int) (val int, err error) { return } +func libc_pathconf_trampoline() + +//go:linkname libc_pathconf libc_pathconf +//go:cgo_import_dynamic libc_pathconf pathconf "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -817,7 +1167,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -825,6 +1175,11 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } +func libc_pread_trampoline() + +//go:linkname libc_pread libc_pread +//go:cgo_import_dynamic libc_pread pread "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -834,7 +1189,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + r0, _, e1 := syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -842,6 +1197,11 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } +func libc_pwrite_trampoline() + +//go:linkname libc_pwrite libc_pwrite +//go:cgo_import_dynamic libc_pwrite pwrite "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -851,7 +1211,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -859,6 +1219,11 @@ func read(fd int, p []byte) (n int, err error) { return } +func libc_read_trampoline() + +//go:linkname libc_read libc_read +//go:cgo_import_dynamic libc_read read "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -873,7 +1238,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -881,6 +1246,11 @@ func Readlink(path string, buf []byte) (n int, err error) { return } +func libc_readlink_trampoline() + +//go:linkname libc_readlink libc_readlink +//go:cgo_import_dynamic libc_readlink readlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -894,13 +1264,18 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_rename_trampoline() + +//go:linkname libc_rename libc_rename +//go:cgo_import_dynamic libc_rename rename "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -909,13 +1284,18 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_revoke_trampoline() + +//go:linkname libc_revoke libc_revoke +//go:cgo_import_dynamic libc_revoke revoke "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -924,64 +1304,78 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func libc_rmdir_trampoline() -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} +//go:linkname libc_rmdir libc_rmdir +//go:cgo_import_dynamic libc_rmdir rmdir "libc.so" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { - _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + _, _, e1 := syscall6(funcPC(libc_select_trampoline), uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_select_trampoline() + +//go:linkname libc_select libc_select +//go:cgo_import_dynamic libc_select select "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setegid_trampoline() + +//go:linkname libc_setegid libc_setegid +//go:cgo_import_dynamic libc_setegid setegid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_seteuid_trampoline() + +//go:linkname libc_seteuid libc_seteuid +//go:cgo_import_dynamic libc_seteuid seteuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setgid_trampoline() + +//go:linkname libc_setgid libc_setgid +//go:cgo_import_dynamic libc_setgid setgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -990,67 +1384,97 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setlogin_trampoline() + +//go:linkname libc_setlogin libc_setlogin +//go:cgo_import_dynamic libc_setlogin setlogin "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setpgid_trampoline() + +//go:linkname libc_setpgid libc_setpgid +//go:cgo_import_dynamic libc_setpgid setpgid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setpriority_trampoline() + +//go:linkname libc_setpriority libc_setpriority +//go:cgo_import_dynamic libc_setpriority setpriority "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setregid_trampoline() + +//go:linkname libc_setregid libc_setregid +//go:cgo_import_dynamic libc_setregid setregid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + _, _, e1 := rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setreuid_trampoline() + +//go:linkname libc_setreuid libc_setreuid +//go:cgo_import_dynamic libc_setreuid setreuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setrlimit_trampoline() + +//go:linkname libc_setrlimit libc_setrlimit +//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + r0, _, e1 := rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1058,26 +1482,41 @@ func Setsid() (pid int, err error) { return } +func libc_setsid_trampoline() + +//go:linkname libc_setsid libc_setsid +//go:cgo_import_dynamic libc_setsid setsid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_settimeofday_trampoline() + +//go:linkname libc_settimeofday libc_settimeofday +//go:cgo_import_dynamic libc_settimeofday settimeofday "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + _, _, e1 := rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_setuid_trampoline() + +//go:linkname libc_setuid libc_setuid +//go:cgo_import_dynamic libc_setuid setuid "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1086,13 +1525,18 @@ func Stat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_stat_trampoline() + +//go:linkname libc_stat libc_stat +//go:cgo_import_dynamic libc_stat stat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1101,13 +1545,18 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_statfs_trampoline() + +//go:linkname libc_statfs libc_statfs +//go:cgo_import_dynamic libc_statfs statfs "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1121,23 +1570,33 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_symlink_trampoline() + +//go:linkname libc_symlink libc_symlink +//go:cgo_import_dynamic libc_symlink symlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + _, _, e1 := syscall(funcPC(libc_sync_trampoline), 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_sync_trampoline() + +//go:linkname libc_sync libc_sync +//go:cgo_import_dynamic libc_sync sync "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1146,21 +1605,31 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + _, _, e1 := syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_truncate_trampoline() + +//go:linkname libc_truncate libc_truncate +//go:cgo_import_dynamic libc_truncate truncate "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + r0, _, _ := syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) oldmask = int(r0) return } +func libc_umask_trampoline() + +//go:linkname libc_umask libc_umask +//go:cgo_import_dynamic libc_umask umask "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1169,13 +1638,18 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_unlink_trampoline() + +//go:linkname libc_unlink libc_unlink +//go:cgo_import_dynamic libc_unlink unlink "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1184,13 +1658,18 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_unmount_trampoline() + +//go:linkname libc_unmount libc_unmount +//go:cgo_import_dynamic libc_unmount unmount "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1200,7 +1679,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1208,10 +1687,15 @@ func write(fd int, p []byte) (n int, err error) { return } +func libc_write_trampoline() + +//go:linkname libc_write libc_write +//go:cgo_import_dynamic libc_write write "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + r0, _, e1 := syscall6X(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1219,53 +1703,78 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } +func libc_mmap_trampoline() + +//go:linkname libc_mmap libc_mmap +//go:cgo_import_dynamic libc_mmap mmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_munmap_trampoline() + +//go:linkname libc_munmap libc_munmap +//go:cgo_import_dynamic libc_munmap munmap "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) +func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall6(funcPC(libc_utimensat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_utimensat_trampoline() + +//go:linkname libc_utimensat libc_utimensat +//go:cgo_import_dynamic libc_utimensat utimensat "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) +func directSyscall(trap uintptr, a1 uintptr, a2 uintptr, a3 uintptr, a4 uintptr, a5 uintptr) (ret uintptr, err error) { + r0, _, e1 := syscall6X(funcPC(libc_syscall_trampoline), uintptr(trap), uintptr(a1), uintptr(a2), uintptr(a3), uintptr(a4), uintptr(a5)) + ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_syscall_trampoline() + +//go:linkname libc_syscall libc_syscall +//go:cgo_import_dynamic libc_syscall syscall "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0) +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := syscallX(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) } return } +func libc_lseek_trampoline() + +//go:linkname libc_lseek libc_lseek +//go:cgo_import_dynamic libc_lseek lseek "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getcwd(buf []byte) (n int, err error) { @@ -1275,7 +1784,7 @@ func getcwd(buf []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + r0, _, e1 := syscall(funcPC(libc_getcwd_trampoline), uintptr(_p0), uintptr(len(buf)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1283,6 +1792,11 @@ func getcwd(buf []byte) (n int, err error) { return } +func libc_getcwd_trampoline() + +//go:linkname libc_getcwd libc_getcwd +//go:cgo_import_dynamic libc_getcwd getcwd "libc.so" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -1292,9 +1806,184 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_sysctl_trampoline() + +//go:linkname libc_sysctl libc_sysctl +//go:cgo_import_dynamic libc_sysctl sysctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fork() (pid int, err error) { + r0, _, e1 := rawSyscall(funcPC(libc_fork_trampoline), 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fork_trampoline() + +//go:linkname libc_fork libc_fork +//go:cgo_import_dynamic libc_fork fork "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req int, arg int) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_ioctl_trampoline() + +//go:linkname libc_ioctl libc_ioctl +//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func execve(path *byte, argv **byte, envp **byte) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_execve_trampoline), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(argv)), uintptr(unsafe.Pointer(envp))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_execve_trampoline() + +//go:linkname libc_execve libc_execve +//go:cgo_import_dynamic libc_execve execve "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func exit(res int) (err error) { + _, _, e1 := rawSyscall(funcPC(libc_exit_trampoline), uintptr(res), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_exit_trampoline() + +//go:linkname libc_exit libc_exit +//go:cgo_import_dynamic libc_exit exit "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +//go:nosplit +func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { + _, _, e1 := syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_ptrace_trampoline() + +//go:linkname libc_ptrace libc_ptrace +//go:cgo_import_dynamic libc_ptrace ptrace "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getentropy(p []byte) (err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := rawSyscall(funcPC(libc_getentropy_trampoline), uintptr(_p0), uintptr(len(p)), 0) if e1 != 0 { err = errnoErr(e1) } return } + +func libc_getentropy_trampoline() + +//go:linkname libc_getentropy libc_getentropy +//go:cgo_import_dynamic libc_getentropy getentropy "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_fstatat_trampoline() + +//go:linkname libc_fstatat libc_fstatat +//go:cgo_import_dynamic libc_fstatat fstatat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { + r0, _, e1 := syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unlinkat(fd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall(funcPC(libc_unlinkat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_unlinkat_trampoline() + +//go:linkname libc_unlinkat libc_unlinkat +//go:cgo_import_dynamic libc_unlinkat unlinkat "libc.so" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall6(funcPC(libc_openat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(perm), 0, 0) + fdret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_openat_trampoline() + +//go:linkname libc_openat libc_openat +//go:cgo_import_dynamic libc_openat openat "libc.so" diff --git a/src/syscall/zsyscall_openbsd_arm64.s b/src/syscall/zsyscall_openbsd_arm64.s new file mode 100644 index 0000000000..37778b1db5 --- /dev/null +++ b/src/syscall/zsyscall_openbsd_arm64.s @@ -0,0 +1,233 @@ +// go run mkasm.go openbsd arm64 +// Code generated by the command above; DO NOT EDIT. +#include "textflag.h" +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getgroups(SB) +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setgroups(SB) +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + JMP libc_wait4(SB) +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + JMP libc_accept(SB) +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + JMP libc_bind(SB) +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + JMP libc_connect(SB) +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + JMP libc_socket(SB) +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsockopt(SB) +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setsockopt(SB) +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpeername(SB) +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsockname(SB) +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_shutdown(SB) +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + JMP libc_socketpair(SB) +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + JMP libc_recvfrom(SB) +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sendto(SB) +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + JMP libc_recvmsg(SB) +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sendmsg(SB) +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kevent(SB) +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + JMP libc_utimes(SB) +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + JMP libc_futimes(SB) +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fcntl(SB) +TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pipe2(SB) +TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 + JMP libc_accept4(SB) +TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getdents(SB) +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + JMP libc_access(SB) +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + JMP libc_adjtime(SB) +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chdir(SB) +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chflags(SB) +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chmod(SB) +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chown(SB) +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + JMP libc_chroot(SB) +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + JMP libc_close(SB) +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + JMP libc_dup(SB) +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + JMP libc_dup2(SB) +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchdir(SB) +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchflags(SB) +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchmod(SB) +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fchown(SB) +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + JMP libc_flock(SB) +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fpathconf(SB) +TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstat(SB) +TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstatfs(SB) +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fsync(SB) +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ftruncate(SB) +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getegid(SB) +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_geteuid(SB) +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getgid(SB) +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpgid(SB) +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpgrp(SB) +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpid(SB) +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getppid(SB) +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getpriority(SB) +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getrlimit(SB) +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getrusage(SB) +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getsid(SB) +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getuid(SB) +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_issetugid(SB) +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kill(SB) +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + JMP libc_kqueue(SB) +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lchown(SB) +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + JMP libc_link(SB) +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + JMP libc_listen(SB) +TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lstat(SB) +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mkdir(SB) +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mkfifo(SB) +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mknod(SB) +TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 + JMP libc_nanosleep(SB) +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + JMP libc_open(SB) +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pathconf(SB) +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pread(SB) +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + JMP libc_pwrite(SB) +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + JMP libc_read(SB) +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_readlink(SB) +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + JMP libc_rename(SB) +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + JMP libc_revoke(SB) +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + JMP libc_rmdir(SB) +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + JMP libc_select(SB) +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setegid(SB) +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_seteuid(SB) +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setgid(SB) +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setlogin(SB) +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setpgid(SB) +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setpriority(SB) +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setregid(SB) +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setreuid(SB) +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setrlimit(SB) +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setsid(SB) +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + JMP libc_settimeofday(SB) +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + JMP libc_setuid(SB) +TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_stat(SB) +TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 + JMP libc_statfs(SB) +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_symlink(SB) +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sync(SB) +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + JMP libc_truncate(SB) +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + JMP libc_umask(SB) +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unlink(SB) +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unmount(SB) +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + JMP libc_write(SB) +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + JMP libc_mmap(SB) +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + JMP libc_munmap(SB) +TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_utimensat(SB) +TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 + JMP libc_syscall(SB) +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + JMP libc_lseek(SB) +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_sysctl(SB) +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fork(SB) +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ioctl(SB) +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 + JMP libc_execve(SB) +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + JMP libc_exit(SB) +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 + JMP libc_ptrace(SB) +TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 + JMP libc_getentropy(SB) +TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_fstatat(SB) +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_unlinkat(SB) +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + JMP libc_openat(SB) -- cgit v1.3-5-g9baa From 725a642c2d0b42e2b4435dfbfbff6b138d37d2ce Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Wed, 27 Jan 2021 23:09:57 +1100 Subject: runtime: correct syscall10/syscall10X on openbsd/amd64 The syscall10/syscall10X implementation uses an incorrect stack offset for arguments a7 to a10. Correct this so that the syscall arguments work as intended. Updates #36435 Fixes #43927 Change-Id: Ia7ae6cc8c89f50acfd951c0f271f3b3309934499 Reviewed-on: https://go-review.googlesource.com/c/go/+/287252 Trust: Joel Sing Reviewed-by: Cherry Zhang --- src/runtime/sys_openbsd_amd64.s | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/sys_openbsd_amd64.s b/src/runtime/sys_openbsd_amd64.s index 534645eec4..b3a76b57a3 100644 --- a/src/runtime/sys_openbsd_amd64.s +++ b/src/runtime/sys_openbsd_amd64.s @@ -676,27 +676,31 @@ TEXT runtime·syscall10(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $48, SP + + // Arguments a1 to a6 get passed in registers, with a7 onwards being + // passed via the stack per the x86-64 System V ABI + // (https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf). MOVQ (7*8)(DI), R10 // a7 MOVQ (8*8)(DI), R11 // a8 MOVQ (9*8)(DI), R12 // a9 MOVQ (10*8)(DI), R13 // a10 - MOVQ R10, (1*8)(SP) // a7 - MOVQ R11, (2*8)(SP) // a8 - MOVQ R12, (3*8)(SP) // a9 - MOVQ R13, (4*8)(SP) // a10 + MOVQ R10, (0*8)(SP) // a7 + MOVQ R11, (1*8)(SP) // a8 + MOVQ R12, (2*8)(SP) // a9 + MOVQ R13, (3*8)(SP) // a10 MOVQ (0*8)(DI), R11 // fn MOVQ (2*8)(DI), SI // a2 MOVQ (3*8)(DI), DX // a3 MOVQ (4*8)(DI), CX // a4 MOVQ (5*8)(DI), R8 // a5 MOVQ (6*8)(DI), R9 // a6 - MOVQ DI, (SP) + MOVQ DI, (4*8)(SP) MOVQ (1*8)(DI), DI // a1 XORL AX, AX // vararg: say "no float args" CALL R11 - MOVQ (SP), DI + MOVQ (4*8)(SP), DI MOVQ AX, (11*8)(DI) // r1 MOVQ DX, (12*8)(DI) // r2 @@ -705,7 +709,7 @@ TEXT runtime·syscall10(SB),NOSPLIT,$0 CALL libc_errno(SB) MOVLQSX (AX), AX - MOVQ (SP), DI + MOVQ (4*8)(SP), DI MOVQ AX, (13*8)(DI) // err ok: @@ -741,27 +745,31 @@ TEXT runtime·syscall10X(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $48, SP + + // Arguments a1 to a6 get passed in registers, with a7 onwards being + // passed via the stack per the x86-64 System V ABI + // (https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf). MOVQ (7*8)(DI), R10 // a7 MOVQ (8*8)(DI), R11 // a8 MOVQ (9*8)(DI), R12 // a9 MOVQ (10*8)(DI), R13 // a10 - MOVQ R10, (1*8)(SP) // a7 - MOVQ R11, (2*8)(SP) // a8 - MOVQ R12, (3*8)(SP) // a9 - MOVQ R13, (4*8)(SP) // a10 + MOVQ R10, (0*8)(SP) // a7 + MOVQ R11, (1*8)(SP) // a8 + MOVQ R12, (2*8)(SP) // a9 + MOVQ R13, (3*8)(SP) // a10 MOVQ (0*8)(DI), R11 // fn MOVQ (2*8)(DI), SI // a2 MOVQ (3*8)(DI), DX // a3 MOVQ (4*8)(DI), CX // a4 MOVQ (5*8)(DI), R8 // a5 MOVQ (6*8)(DI), R9 // a6 - MOVQ DI, (SP) + MOVQ DI, (4*8)(SP) MOVQ (1*8)(DI), DI // a1 XORL AX, AX // vararg: say "no float args" CALL R11 - MOVQ (SP), DI + MOVQ (4*8)(SP), DI MOVQ AX, (11*8)(DI) // r1 MOVQ DX, (12*8)(DI) // r2 @@ -770,7 +778,7 @@ TEXT runtime·syscall10X(SB),NOSPLIT,$0 CALL libc_errno(SB) MOVLQSX (AX), AX - MOVQ (SP), DI + MOVQ (4*8)(SP), DI MOVQ AX, (13*8)(DI) // err ok: -- cgit v1.3-5-g9baa From 68058edc39edae96e34225ca163002233b623c97 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Thu, 28 Jan 2021 14:57:55 -0500 Subject: runtime: document pointer write atomicity for memclrNoHeapPointers memclrNoHeapPointers is the underlying implementation of typedmemclr and memclrHasPointers, so it still needs to write pointer-aligned words atomically. Document this requirement. Updates #41428. Change-Id: Ice00dee5de7a96a50e51ff019fcef069e8a8406a Reviewed-on: https://go-review.googlesource.com/c/go/+/287692 Trust: Cherry Zhang Reviewed-by: Keith Randall --- src/runtime/memclr_386.s | 2 ++ src/runtime/memclr_amd64.s | 2 ++ src/runtime/memclr_arm.s | 2 ++ src/runtime/memclr_arm64.s | 2 ++ src/runtime/memclr_mips64x.s | 2 ++ src/runtime/memclr_mipsx.s | 2 ++ src/runtime/memclr_plan9_386.s | 2 ++ src/runtime/memclr_plan9_amd64.s | 2 ++ src/runtime/memclr_ppc64x.s | 2 ++ src/runtime/memclr_riscv64.s | 2 ++ src/runtime/memclr_s390x.s | 2 ++ src/runtime/memclr_wasm.s | 2 ++ src/runtime/stubs.go | 8 ++++++++ 13 files changed, 32 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/memclr_386.s b/src/runtime/memclr_386.s index 65f7196312..5e090ef09e 100644 --- a/src/runtime/memclr_386.s +++ b/src/runtime/memclr_386.s @@ -9,6 +9,8 @@ // NOTE: Windows externalthreadhandler expects memclr to preserve DX. +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-8 MOVL ptr+0(FP), DI diff --git a/src/runtime/memclr_amd64.s b/src/runtime/memclr_amd64.s index d79078fd00..37fe9745b1 100644 --- a/src/runtime/memclr_amd64.s +++ b/src/runtime/memclr_amd64.s @@ -9,6 +9,8 @@ // NOTE: Windows externalthreadhandler expects memclr to preserve DX. +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-16 MOVQ ptr+0(FP), DI diff --git a/src/runtime/memclr_arm.s b/src/runtime/memclr_arm.s index 7326b8be34..f113a1aa2d 100644 --- a/src/runtime/memclr_arm.s +++ b/src/runtime/memclr_arm.s @@ -30,6 +30,8 @@ #define N R12 #define TMP R12 /* N and TMP don't overlap */ +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8 MOVW ptr+0(FP), TO diff --git a/src/runtime/memclr_arm64.s b/src/runtime/memclr_arm64.s index a56a6dfb85..bef77651e4 100644 --- a/src/runtime/memclr_arm64.s +++ b/src/runtime/memclr_arm64.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 MOVD ptr+0(FP), R0 diff --git a/src/runtime/memclr_mips64x.s b/src/runtime/memclr_mips64x.s index 4c2292eae8..d7a3251e20 100644 --- a/src/runtime/memclr_mips64x.s +++ b/src/runtime/memclr_mips64x.s @@ -7,6 +7,8 @@ #include "go_asm.h" #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 MOVV ptr+0(FP), R1 diff --git a/src/runtime/memclr_mipsx.s b/src/runtime/memclr_mipsx.s index 1561a23dbe..eb2a8a7219 100644 --- a/src/runtime/memclr_mipsx.s +++ b/src/runtime/memclr_mipsx.s @@ -14,6 +14,8 @@ #define MOVWLO MOVWL #endif +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8 MOVW n+4(FP), R2 diff --git a/src/runtime/memclr_plan9_386.s b/src/runtime/memclr_plan9_386.s index 5b880ae86f..54701a9453 100644 --- a/src/runtime/memclr_plan9_386.s +++ b/src/runtime/memclr_plan9_386.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-8 MOVL ptr+0(FP), DI diff --git a/src/runtime/memclr_plan9_amd64.s b/src/runtime/memclr_plan9_amd64.s index ad383cd6b3..8c6a1cc780 100644 --- a/src/runtime/memclr_plan9_amd64.s +++ b/src/runtime/memclr_plan9_amd64.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 MOVQ ptr+0(FP), DI diff --git a/src/runtime/memclr_ppc64x.s b/src/runtime/memclr_ppc64x.s index 072963f756..7512620894 100644 --- a/src/runtime/memclr_ppc64x.s +++ b/src/runtime/memclr_ppc64x.s @@ -6,6 +6,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT|NOFRAME, $0-16 MOVD ptr+0(FP), R3 diff --git a/src/runtime/memclr_riscv64.s b/src/runtime/memclr_riscv64.s index ba7704e805..54ddaa4560 100644 --- a/src/runtime/memclr_riscv64.s +++ b/src/runtime/memclr_riscv64.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // void runtime·memclrNoHeapPointers(void*, uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 MOV ptr+0(FP), T1 diff --git a/src/runtime/memclr_s390x.s b/src/runtime/memclr_s390x.s index dd14a441cc..fa657ef66e 100644 --- a/src/runtime/memclr_s390x.s +++ b/src/runtime/memclr_s390x.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT|NOFRAME,$0-16 MOVD ptr+0(FP), R4 diff --git a/src/runtime/memclr_wasm.s b/src/runtime/memclr_wasm.s index 68ffe2f67b..5a053049f8 100644 --- a/src/runtime/memclr_wasm.s +++ b/src/runtime/memclr_wasm.s @@ -4,6 +4,8 @@ #include "textflag.h" +// See memclrNoHeapPointers Go doc for important implementation constraints. + // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) TEXT runtime·memclrNoHeapPointers(SB), NOSPLIT, $0-16 MOVD ptr+0(FP), R0 diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index b55c3c0590..2ee2c74dfe 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -73,7 +73,15 @@ func badsystemstack() { // *ptr is uninitialized memory (e.g., memory that's being reused // for a new allocation) and hence contains only "junk". // +// memclrNoHeapPointers ensures that if ptr is pointer-aligned, and n +// is a multiple of the pointer size, then any pointer-aligned, +// pointer-sized portion is cleared atomically. Despite the function +// name, this is necessary because this function is the underlying +// implementation of typedmemclr and memclrHasPointers. See the doc of +// memmove for more details. +// // The (CPU-specific) implementations of this function are in memclr_*.s. +// //go:noescape func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) -- cgit v1.3-5-g9baa From bfc7418e6d3a505fe348718fd113473c9d92b135 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 29 Jan 2021 12:03:32 -0500 Subject: [dev.regabi] runtime, syscall, etc.: mark Darwin syscall wrappers as ABIInternal Mark the syscall wrappers as ABIInternal, as they have addresses taken from Go code, and it is important to call to them without wrappers. Previously, the wrapper is just a single JMP instruction, which makes it not matter. In the next CL we'll make the wrapper actually have a frame. The real wrappers will mess up things such as stack alignment for C ABI. This doesn't look really nice, but I don't know how we can do better... TODO: other OSes. Change-Id: Ifb3920494990a7775e3e6902fbcaf137df3cc653 Reviewed-on: https://go-review.googlesource.com/c/go/+/288092 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Than McIntosh --- src/cmd/dist/build.go | 2 + src/cmd/internal/objabi/path.go | 2 + src/crypto/x509/internal/macos/corefoundation.s | 21 +- src/crypto/x509/internal/macos/security.s | 11 +- src/runtime/sys_darwin_amd64.s | 96 ++++----- src/syscall/mkasm.go | 3 +- src/syscall/zsyscall_darwin_amd64.s | 250 ++++++++++++------------ src/syscall/zsyscall_darwin_arm64.s | 250 ++++++++++++------------ src/syscall/zsyscall_openbsd_amd64.s | 230 +++++++++++----------- src/syscall/zsyscall_openbsd_arm64.s | 230 +++++++++++----------- 10 files changed, 554 insertions(+), 541 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index c8c3212d16..332f2fab58 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1765,6 +1765,8 @@ func IsRuntimePackagePath(pkgpath string) bool { rval = true case "syscall": rval = true + case "crypto/x509/internal/macos": // libc function wrappers need to be ABIInternal + rval = true default: rval = strings.HasPrefix(pkgpath, "runtime/internal") } diff --git a/src/cmd/internal/objabi/path.go b/src/cmd/internal/objabi/path.go index fd1c9981c6..1a0784cf7f 100644 --- a/src/cmd/internal/objabi/path.go +++ b/src/cmd/internal/objabi/path.go @@ -56,6 +56,8 @@ func IsRuntimePackagePath(pkgpath string) bool { rval = true case "syscall": rval = true + case "crypto/x509/internal/macos": // libc function wrappers need to be ABIInternal + rval = true default: rval = strings.HasPrefix(pkgpath, "runtime/internal") } diff --git a/src/crypto/x509/internal/macos/corefoundation.s b/src/crypto/x509/internal/macos/corefoundation.s index a4495d68dd..1ce39fac9d 100644 --- a/src/crypto/x509/internal/macos/corefoundation.s +++ b/src/crypto/x509/internal/macos/corefoundation.s @@ -6,21 +6,24 @@ #include "textflag.h" -TEXT ·x509_CFArrayGetCount_trampoline(SB),NOSPLIT,$0-0 +// The trampolines are ABIInternal as they are address-taken in +// Go code. + +TEXT ·x509_CFArrayGetCount_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFArrayGetCount(SB) -TEXT ·x509_CFArrayGetValueAtIndex_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFArrayGetValueAtIndex_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFArrayGetValueAtIndex(SB) -TEXT ·x509_CFDataGetBytePtr_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFDataGetBytePtr_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFDataGetBytePtr(SB) -TEXT ·x509_CFDataGetLength_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFDataGetLength_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFDataGetLength(SB) -TEXT ·x509_CFStringCreateWithBytes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFStringCreateWithBytes_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFStringCreateWithBytes(SB) -TEXT ·x509_CFRelease_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFRelease_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFRelease(SB) -TEXT ·x509_CFDictionaryGetValueIfPresent_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFDictionaryGetValueIfPresent_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFDictionaryGetValueIfPresent(SB) -TEXT ·x509_CFNumberGetValue_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFNumberGetValue_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFNumberGetValue(SB) -TEXT ·x509_CFEqual_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_CFEqual_trampoline(SB),NOSPLIT,$0-0 JMP x509_CFEqual(SB) diff --git a/src/crypto/x509/internal/macos/security.s b/src/crypto/x509/internal/macos/security.s index bd446dbcbe..bea265a5ef 100644 --- a/src/crypto/x509/internal/macos/security.s +++ b/src/crypto/x509/internal/macos/security.s @@ -6,11 +6,14 @@ #include "textflag.h" -TEXT ·x509_SecTrustSettingsCopyCertificates_trampoline(SB),NOSPLIT,$0-0 +// The trampolines are ABIInternal as they are address-taken in +// Go code. + +TEXT ·x509_SecTrustSettingsCopyCertificates_trampoline(SB),NOSPLIT,$0-0 JMP x509_SecTrustSettingsCopyCertificates(SB) -TEXT ·x509_SecItemExport_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_SecItemExport_trampoline(SB),NOSPLIT,$0-0 JMP x509_SecItemExport(SB) -TEXT ·x509_SecTrustSettingsCopyTrustSettings_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_SecTrustSettingsCopyTrustSettings_trampoline(SB),NOSPLIT,$0-0 JMP x509_SecTrustSettingsCopyTrustSettings(SB) -TEXT ·x509_SecPolicyCopyProperties_trampoline(SB),NOSPLIT,$0-0 +TEXT ·x509_SecPolicyCopyProperties_trampoline(SB),NOSPLIT,$0-0 JMP x509_SecPolicyCopyProperties(SB) diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s index 630fb5df64..0fe8c7e172 100644 --- a/src/runtime/sys_darwin_amd64.s +++ b/src/runtime/sys_darwin_amd64.s @@ -5,6 +5,8 @@ // System calls and other sys.stuff for AMD64, Darwin // System calls are implemented in libSystem, this file contains // trampolines that convert from Go to C calling convention. +// The trampolines are ABIInternal as they are referenced from +// Go code with funcPC. #include "go_asm.h" #include "go_tls.h" @@ -13,7 +15,7 @@ #define CLOCK_REALTIME 0 // Exit the entire program (like C exit) -TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 +TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 0(DI), DI // arg 1 exit status @@ -22,7 +24,7 @@ TEXT runtime·exit_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·open_trampoline(SB),NOSPLIT,$0 +TEXT runtime·open_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 8(DI), SI // arg 2 flags @@ -33,7 +35,7 @@ TEXT runtime·open_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·close_trampoline(SB),NOSPLIT,$0 +TEXT runtime·close_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 0(DI), DI // arg 1 fd @@ -41,7 +43,7 @@ TEXT runtime·close_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·read_trampoline(SB),NOSPLIT,$0 +TEXT runtime·read_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 buf @@ -57,7 +59,7 @@ noerr: POPQ BP RET -TEXT runtime·write_trampoline(SB),NOSPLIT,$0 +TEXT runtime·write_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 buf @@ -73,7 +75,7 @@ noerr: POPQ BP RET -TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP CALL libc_pipe(SB) // pointer already in DI @@ -84,7 +86,7 @@ TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 +TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 new @@ -94,7 +96,7 @@ TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 +TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 len @@ -105,12 +107,12 @@ TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0 POPQ BP RET -TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0 +TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0 UNDEF // unimplemented GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size) -TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 +TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ DI, BX @@ -139,7 +141,7 @@ initialized: POPQ BP RET -TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0 +TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0 PUSHQ BP // make a frame; keep stack aligned MOVQ SP, BP MOVQ DI, SI // arg 2 timespec @@ -148,7 +150,7 @@ TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 +TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 new @@ -161,7 +163,7 @@ TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 +TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 new @@ -174,7 +176,7 @@ TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 +TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 old @@ -186,7 +188,7 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0 +TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 0(DI), BX // signal @@ -212,7 +214,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 // This is the function registered during sigaction and is invoked when // a signal is received. It just redirects to the Go function sigtrampgo. -TEXT runtime·sigtramp(SB),NOSPLIT,$0 +TEXT runtime·sigtramp(SB),NOSPLIT,$0 // This runs on the signal stack, so we have lots of stack available. // We allocate our own stack space, because if we tell the linker // how much we're using, the NOSPLIT check fails. @@ -246,7 +248,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0 // Used instead of sigtramp in programs that use cgo. // Arguments from kernel are in DI, SI, DX. -TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0 +TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0 // If no traceback function, do usual sigtramp. MOVQ runtime·cgoTraceback(SB), AX TESTQ AX, AX @@ -289,12 +291,12 @@ TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0 // The first three arguments, and the fifth, are already in registers. // Set the two remaining arguments now. MOVQ runtime·cgoTraceback(SB), CX - MOVQ $runtime·sigtramp(SB), R9 + MOVQ $runtime·sigtramp(SB), R9 MOVQ _cgo_callers(SB), AX JMP AX sigtramp: - JMP runtime·sigtramp(SB) + JMP runtime·sigtramp(SB) sigtrampnog: // Signal arrived on a non-Go thread. If this is SIGPROF, get a @@ -320,7 +322,7 @@ sigtrampnog: MOVQ _cgo_callers(SB), AX JMP AX -TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 +TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0 PUSHQ BP // make a frame; keep stack aligned MOVQ SP, BP MOVQ DI, BX @@ -343,7 +345,7 @@ ok: POPQ BP RET -TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 +TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 len @@ -355,7 +357,7 @@ TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0 +TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 0(DI), DI // arg 1 usec @@ -367,7 +369,7 @@ TEXT runtime·settls(SB),NOSPLIT,$32 // Nothing to do on Darwin, pthread already set thread-local storage up. RET -TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 +TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 8(DI), SI // arg 2 miblen @@ -380,7 +382,7 @@ TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0 +TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 oldp @@ -392,14 +394,14 @@ TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0 +TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP CALL libc_kqueue(SB) POPQ BP RET -TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 +TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 keventt @@ -418,7 +420,7 @@ ok: POPQ BP RET -TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0 +TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 4(DI), SI // arg 2 cmd @@ -475,7 +477,7 @@ TEXT runtime·mstart_stub(SB),NOSPLIT,$0 // A pointer to the arguments is passed in DI. // A single int32 result is returned in AX. // (For more results, make an args/results structure.) -TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 PUSHQ BP // make frame, keep stack 16-byte aligned. MOVQ SP, BP MOVQ 0(DI), DI // arg 1 attr @@ -483,7 +485,7 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 size @@ -492,7 +494,7 @@ TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 state @@ -501,7 +503,7 @@ TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -514,7 +516,7 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·raise_trampoline(SB),NOSPLIT,$0 +TEXT runtime·raise_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVL 0(DI), DI // arg 1 signal @@ -522,7 +524,7 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 attr @@ -531,7 +533,7 @@ TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 0(DI), DI // arg 1 mutex @@ -539,7 +541,7 @@ TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 0(DI), DI // arg 1 mutex @@ -547,7 +549,7 @@ TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 attr @@ -556,7 +558,7 @@ TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 mutex @@ -565,7 +567,7 @@ TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 mutex @@ -575,7 +577,7 @@ TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 0(DI), DI // arg 1 cond @@ -583,7 +585,7 @@ TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ DI, BX // BX is caller-save @@ -592,7 +594,7 @@ TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0 POPQ BP RET -TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 +TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP MOVQ 8(DI), SI // arg 2 sig @@ -617,7 +619,7 @@ TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0 // // syscall expects a 32-bit result and tests for 32-bit -1 // to decide there was an error. -TEXT runtime·syscall(SB),NOSPLIT,$0 +TEXT runtime·syscall(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -667,7 +669,7 @@ ok: // // syscallX is like syscall but expects a 64-bit result // and tests for 64-bit -1 to decide there was an error. -TEXT runtime·syscallX(SB),NOSPLIT,$0 +TEXT runtime·syscallX(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -703,7 +705,7 @@ ok: // syscallPtr is like syscallX except that the libc function reports an // error by returning NULL and setting errno. -TEXT runtime·syscallPtr(SB),NOSPLIT,$0 +TEXT runtime·syscallPtr(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -756,7 +758,7 @@ ok: // // syscall6 expects a 32-bit result and tests for 32-bit -1 // to decide there was an error. -TEXT runtime·syscall6(SB),NOSPLIT,$0 +TEXT runtime·syscall6(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -809,7 +811,7 @@ ok: // // syscall6X is like syscall6 but expects a 64-bit result // and tests for 64-bit -1 to decide there was an error. -TEXT runtime·syscall6X(SB),NOSPLIT,$0 +TEXT runtime·syscall6X(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP @@ -845,7 +847,7 @@ ok: // syscallNoErr is like syscall6 but does not check for errors, and // only returns one value, for use with standard C ABI library functions. -TEXT runtime·syscallNoErr(SB),NOSPLIT,$0 +TEXT runtime·syscallNoErr(SB),NOSPLIT,$0 PUSHQ BP MOVQ SP, BP SUBQ $16, SP diff --git a/src/syscall/mkasm.go b/src/syscall/mkasm.go index 2ebaf8d351..e53d14bed1 100644 --- a/src/syscall/mkasm.go +++ b/src/syscall/mkasm.go @@ -53,7 +53,8 @@ func main() { fn := line[5 : len(line)-13] if !trampolines[fn] { trampolines[fn] = true - fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) + // The trampolines are ABIInternal as they are address-taken in Go code. + fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) } } diff --git a/src/syscall/zsyscall_darwin_amd64.s b/src/syscall/zsyscall_darwin_amd64.s index 492f947855..5eb48cee44 100644 --- a/src/syscall/zsyscall_darwin_amd64.s +++ b/src/syscall/zsyscall_darwin_amd64.s @@ -1,253 +1,253 @@ // go run mkasm.go darwin amd64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_getfsstat(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0 JMP libc_writev(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 JMP libc_fork(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 JMP libc_execve(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatfs64(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_lstat64(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 JMP libc_statfs64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatat64(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) diff --git a/src/syscall/zsyscall_darwin_arm64.s b/src/syscall/zsyscall_darwin_arm64.s index b606c6e49e..73e4a3fd8d 100644 --- a/src/syscall/zsyscall_darwin_arm64.s +++ b/src/syscall/zsyscall_darwin_arm64.s @@ -1,253 +1,253 @@ // go run mkasm.go darwin arm64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_getfsstat(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0 JMP libc_writev(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 JMP libc_fork(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 JMP libc_execve(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) diff --git a/src/syscall/zsyscall_openbsd_amd64.s b/src/syscall/zsyscall_openbsd_amd64.s index e5c5dde930..8256a451f5 100644 --- a/src/syscall/zsyscall_openbsd_amd64.s +++ b/src/syscall/zsyscall_openbsd_amd64.s @@ -1,233 +1,233 @@ // go run mkasm.go openbsd amd64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe2(SB) -TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept4(SB) -TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdents(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) -TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 JMP libc_syscall(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 JMP libc_fork(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 JMP libc_execve(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 JMP libc_getentropy(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 JMP libc_openat(SB) diff --git a/src/syscall/zsyscall_openbsd_arm64.s b/src/syscall/zsyscall_openbsd_arm64.s index 37778b1db5..f6e0a8da94 100644 --- a/src/syscall/zsyscall_openbsd_arm64.s +++ b/src/syscall/zsyscall_openbsd_arm64.s @@ -1,233 +1,233 @@ // go run mkasm.go openbsd arm64 // Code generated by the command above; DO NOT EDIT. #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0 JMP libc_pipe2(SB) -TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0 JMP libc_accept4(SB) -TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0 JMP libc_getdents(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_gettimeofday(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0 JMP libc_nanosleep(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0 JMP libc_utimensat(SB) -TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0 JMP libc_syscall(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0 JMP libc_getcwd(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0 JMP libc_fork(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0 JMP libc_execve(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 JMP libc_ptrace(SB) -TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0 JMP libc_getentropy(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 +TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -- cgit v1.3-5-g9baa From 401d7e5a242f1007c2637a25111a6fa985728c08 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 29 Jan 2021 13:46:34 -0500 Subject: [dev.regabi] cmd/compile: reserve X15 as zero register on AMD64 In ABIInternal, reserve X15 as constant zero, and use it to zero memory. (Maybe there can be more use of it?) The register is zeroed when transition to ABIInternal from ABI0. Caveat: using X15 generates longer instructions than using X0. Maybe we want to use X0? Change-Id: I12d5ee92a01fc0b59dad4e5ab023ac71bc2a8b7d Reviewed-on: https://go-review.googlesource.com/c/go/+/288093 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: David Chase --- src/cmd/compile/internal/amd64/ggen.go | 4 +- src/cmd/compile/internal/amd64/ssa.go | 43 +++- src/cmd/compile/internal/ssa/config.go | 1 + src/cmd/compile/internal/ssa/gen/AMD64.rules | 26 +-- src/cmd/compile/internal/ssa/gen/AMD64Ops.go | 41 ++-- src/cmd/compile/internal/ssa/op.go | 4 +- src/cmd/compile/internal/ssa/opGen.go | 281 ++++++++++++++------------- src/cmd/compile/internal/ssa/rewriteAMD64.go | 96 ++++----- src/cmd/compile/internal/ssagen/abi.go | 15 +- src/cmd/compile/internal/ssagen/ssa.go | 5 +- src/runtime/duff_amd64.s | 128 ++++++------ src/runtime/mkduff.go | 14 +- test/codegen/structs.go | 4 +- 13 files changed, 347 insertions(+), 315 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/compile/internal/amd64/ggen.go b/src/cmd/compile/internal/amd64/ggen.go index dacdb07a38..aefdb14a69 100644 --- a/src/cmd/compile/internal/amd64/ggen.go +++ b/src/cmd/compile/internal/amd64/ggen.go @@ -22,8 +22,8 @@ var isPlan9 = objabi.GOOS == "plan9" const ( dzBlocks = 16 // number of MOV/ADD blocks dzBlockLen = 4 // number of clears per block - dzBlockSize = 19 // size of instructions in a single block - dzMovSize = 4 // size of single MOV instruction w/ offset + dzBlockSize = 23 // size of instructions in a single block + dzMovSize = 5 // size of single MOV instruction w/ offset dzLeaqSize = 4 // size of single LEAQ instruction dzClearStep = 16 // number of bytes cleared by each MOV instruction diff --git a/src/cmd/compile/internal/amd64/ssa.go b/src/cmd/compile/internal/amd64/ssa.go index da355c49d1..d9c97183fd 100644 --- a/src/cmd/compile/internal/amd64/ssa.go +++ b/src/cmd/compile/internal/amd64/ssa.go @@ -813,6 +813,20 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) { p.To.Type = obj.TYPE_MEM p.To.Reg = v.Args[0].Reg() ssagen.AddAux2(&p.To, v, sc.Off()) + case ssa.OpAMD64MOVOstorezero: + if s.ABI != obj.ABIInternal { + v.Fatalf("MOVOstorezero can be only used in ABIInternal functions") + } + if !base.Flag.ABIWrap { + // zeroing X15 manually if wrappers are not used + opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + } + p := s.Prog(v.Op.Asm()) + p.From.Type = obj.TYPE_REG + p.From.Reg = x86.REG_X15 + p.To.Type = obj.TYPE_MEM + p.To.Reg = v.Args[0].Reg() + ssagen.AddAux(&p.To, v) case ssa.OpAMD64MOVQstoreconstidx1, ssa.OpAMD64MOVQstoreconstidx8, ssa.OpAMD64MOVLstoreconstidx1, ssa.OpAMD64MOVLstoreconstidx4, ssa.OpAMD64MOVWstoreconstidx1, ssa.OpAMD64MOVWstoreconstidx2, ssa.OpAMD64MOVBstoreconstidx1, ssa.OpAMD64ADDLconstmodifyidx1, ssa.OpAMD64ADDLconstmodifyidx4, ssa.OpAMD64ADDLconstmodifyidx8, ssa.OpAMD64ADDQconstmodifyidx1, ssa.OpAMD64ADDQconstmodifyidx8, ssa.OpAMD64ANDLconstmodifyidx1, ssa.OpAMD64ANDLconstmodifyidx4, ssa.OpAMD64ANDLconstmodifyidx8, ssa.OpAMD64ANDQconstmodifyidx1, ssa.OpAMD64ANDQconstmodifyidx8, @@ -900,6 +914,13 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) { v.Fatalf("input[0] and output not in same register %s", v.LongString()) } case ssa.OpAMD64DUFFZERO: + if s.ABI != obj.ABIInternal { + v.Fatalf("MOVOconst can be only used in ABIInternal functions") + } + if !base.Flag.ABIWrap { + // zeroing X15 manually if wrappers are not used + opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + } off := duffStart(v.AuxInt) adj := duffAdj(v.AuxInt) var p *obj.Prog @@ -915,12 +936,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) { p.To.Type = obj.TYPE_ADDR p.To.Sym = ir.Syms.Duffzero p.To.Offset = off - case ssa.OpAMD64MOVOconst: - if v.AuxInt != 0 { - v.Fatalf("MOVOconst can only do constant=0") - } - r := v.Reg() - opregreg(s, x86.AXORPS, r, r) case ssa.OpAMD64DUFFCOPY: p := s.Prog(obj.ADUFFCOPY) p.To.Type = obj.TYPE_ADDR @@ -1000,7 +1015,17 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) { q.To.Type = obj.TYPE_REG q.To.Reg = r } - case ssa.OpAMD64CALLstatic, ssa.OpAMD64CALLclosure, ssa.OpAMD64CALLinter: + case ssa.OpAMD64CALLstatic: + if s.ABI == obj.ABI0 && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABIInternal { + // zeroing X15 when entering ABIInternal from ABI0 + opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + } + s.Call(v) + if s.ABI == obj.ABIInternal && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABI0 { + // zeroing X15 when entering ABIInternal from ABI0 + opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + } + case ssa.OpAMD64CALLclosure, ssa.OpAMD64CALLinter: s.Call(v) case ssa.OpAMD64LoweredGetCallerPC: @@ -1297,6 +1322,10 @@ func ssaGenBlock(s *ssagen.State, b, next *ssa.Block) { case ssa.BlockRet: s.Prog(obj.ARET) case ssa.BlockRetJmp: + if s.ABI == obj.ABI0 && b.Aux.(*obj.LSym).ABI() == obj.ABIInternal { + // zeroing X15 when entering ABIInternal from ABI0 + opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + } p := s.Prog(obj.ARET) p.To.Type = obj.TYPE_MEM p.To.Name = obj.NAME_EXTERN diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index e952c73d9b..32cfd7e61e 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -194,6 +194,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.registers = registersAMD64[:] c.gpRegMask = gpRegMaskAMD64 c.fpRegMask = fpRegMaskAMD64 + c.specialRegMask = specialRegMaskAMD64 c.FPReg = framepointerRegAMD64 c.LinkReg = linkRegAMD64 c.hasGReg = false diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index 7d46266411..706336289e 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -361,31 +361,31 @@ // Adjust zeros to be a multiple of 16 bytes. (Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE => (Zero [s-s%16] (OffPtr destptr [s%16]) - (MOVOstore destptr (MOVOconst [0]) mem)) + (MOVOstorezero destptr mem)) (Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 <= 8 && config.useSSE => (Zero [s-s%16] (OffPtr destptr [s%16]) (MOVQstoreconst [makeValAndOff32(0,0)] destptr mem)) (Zero [16] destptr mem) && config.useSSE => - (MOVOstore destptr (MOVOconst [0]) mem) + (MOVOstorezero destptr mem) (Zero [32] destptr mem) && config.useSSE => - (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) - (MOVOstore destptr (MOVOconst [0]) mem)) + (MOVOstorezero (OffPtr destptr [16]) + (MOVOstorezero destptr mem)) (Zero [48] destptr mem) && config.useSSE => - (MOVOstore (OffPtr destptr [32]) (MOVOconst [0]) - (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) - (MOVOstore destptr (MOVOconst [0]) mem))) + (MOVOstorezero (OffPtr destptr [32]) + (MOVOstorezero (OffPtr destptr [16]) + (MOVOstorezero destptr mem))) (Zero [64] destptr mem) && config.useSSE => - (MOVOstore (OffPtr destptr [48]) (MOVOconst [0]) - (MOVOstore (OffPtr destptr [32]) (MOVOconst [0]) - (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) - (MOVOstore destptr (MOVOconst [0]) mem)))) + (MOVOstorezero (OffPtr destptr [48]) + (MOVOstorezero (OffPtr destptr [32]) + (MOVOstorezero (OffPtr destptr [16]) + (MOVOstorezero destptr mem)))) // Medium zeroing uses a duff device. (Zero [s] destptr mem) && s > 64 && s <= 1024 && s%16 == 0 && !config.noDuffDevice => - (DUFFZERO [s] destptr (MOVOconst [0]) mem) + (DUFFZERO [s] destptr mem) // Large zeroing uses REP STOSQ. (Zero [s] destptr mem) @@ -1900,7 +1900,7 @@ && c.Val() == 0 && c2.Val() == 0 && clobber(x) - => (MOVOstore [c2.Off32()] {s} p (MOVOconst [0]) mem) + => (MOVOstorezero [c2.Off32()] {s} p mem) // Combine stores into larger (unaligned) stores. Little endian. (MOVBstore [i] {s} p (SHR(W|L|Q)const [8] w) x:(MOVBstore [i-1] {s} p w mem)) diff --git a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go index de5372670b..0a411bbdca 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go @@ -61,7 +61,7 @@ var regNamesAMD64 = []string{ "X12", "X13", "X14", - "X15", + "X15", // constant 0 in ABIInternal // If you add registers, update asyncPreempt in runtime @@ -97,7 +97,8 @@ func init() { dx = buildReg("DX") bx = buildReg("BX") gp = buildReg("AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15") - fp = buildReg("X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15") + fp = buildReg("X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14") + x15 = buildReg("X15") gpsp = gp | buildReg("SP") gpspsb = gpsp | buildReg("SB") callerSave = gp | fp @@ -684,19 +685,20 @@ func init() { // Note: LEAx{1,2,4,8} must not have OpSB as either argument. // auxint+aux == add auxint and the offset of the symbol in aux (if any) to the effective address - {name: "MOVBload", argLength: 2, reg: gpload, asm: "MOVBLZX", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"}, // load byte from arg0+auxint+aux. arg1=mem. Zero extend. - {name: "MOVBQSXload", argLength: 2, reg: gpload, asm: "MOVBQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 - {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVWLZX", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"}, // load 2 bytes from arg0+auxint+aux. arg1=mem. Zero extend. - {name: "MOVWQSXload", argLength: 2, reg: gpload, asm: "MOVWQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 - {name: "MOVLload", argLength: 2, reg: gpload, asm: "MOVL", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"}, // load 4 bytes from arg0+auxint+aux. arg1=mem. Zero extend. - {name: "MOVLQSXload", argLength: 2, reg: gpload, asm: "MOVLQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 - {name: "MOVQload", argLength: 2, reg: gpload, asm: "MOVQ", aux: "SymOff", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"}, // load 8 bytes from arg0+auxint+aux. arg1=mem - {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store byte in arg1 to arg0+auxint+aux. arg2=mem - {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes in arg1 to arg0+auxint+aux. arg2=mem - {name: "MOVLstore", argLength: 3, reg: gpstore, asm: "MOVL", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes in arg1 to arg0+auxint+aux. arg2=mem - {name: "MOVQstore", argLength: 3, reg: gpstore, asm: "MOVQ", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes in arg1 to arg0+auxint+aux. arg2=mem - {name: "MOVOload", argLength: 2, reg: fpload, asm: "MOVUPS", aux: "SymOff", typ: "Int128", faultOnNilArg0: true, symEffect: "Read"}, // load 16 bytes from arg0+auxint+aux. arg1=mem - {name: "MOVOstore", argLength: 3, reg: fpstore, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVBload", argLength: 2, reg: gpload, asm: "MOVBLZX", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"}, // load byte from arg0+auxint+aux. arg1=mem. Zero extend. + {name: "MOVBQSXload", argLength: 2, reg: gpload, asm: "MOVBQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 + {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVWLZX", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"}, // load 2 bytes from arg0+auxint+aux. arg1=mem. Zero extend. + {name: "MOVWQSXload", argLength: 2, reg: gpload, asm: "MOVWQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 + {name: "MOVLload", argLength: 2, reg: gpload, asm: "MOVL", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"}, // load 4 bytes from arg0+auxint+aux. arg1=mem. Zero extend. + {name: "MOVLQSXload", argLength: 2, reg: gpload, asm: "MOVLQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64 + {name: "MOVQload", argLength: 2, reg: gpload, asm: "MOVQ", aux: "SymOff", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"}, // load 8 bytes from arg0+auxint+aux. arg1=mem + {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store byte in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVLstore", argLength: 3, reg: gpstore, asm: "MOVL", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVQstore", argLength: 3, reg: gpstore, asm: "MOVQ", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVOload", argLength: 2, reg: fpload, asm: "MOVUPS", aux: "SymOff", typ: "Int128", faultOnNilArg0: true, symEffect: "Read"}, // load 16 bytes from arg0+auxint+aux. arg1=mem + {name: "MOVOstore", argLength: 3, reg: fpstore, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes in arg1 to arg0+auxint+aux. arg2=mem + {name: "MOVOstorezero", argLength: 2, reg: regInfo{inputs: []regMask{gpspsb, 0}}, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes of zero to arg0+auxint+aux. arg1=mem // indexed loads/stores {name: "MOVBloadidx1", argLength: 3, reg: gploadidx, commutative: true, asm: "MOVBLZX", scale: 1, aux: "SymOff", typ: "UInt8", symEffect: "Read"}, // load a byte from arg0+arg1+auxint+aux. arg2=mem @@ -735,22 +737,20 @@ func init() { {name: "MOVQstoreconstidx8", argLength: 3, reg: gpstoreconstidx, asm: "MOVQ", scale: 8, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... 8*arg1 ... // arg0 = pointer to start of memory to zero - // arg1 = value to store (will always be zero) - // arg2 = mem + // arg1 = mem // auxint = # of bytes to zero // returns mem { name: "DUFFZERO", aux: "Int64", - argLength: 3, + argLength: 2, reg: regInfo{ - inputs: []regMask{buildReg("DI"), buildReg("X0")}, + inputs: []regMask{buildReg("DI")}, clobbers: buildReg("DI"), }, faultOnNilArg0: true, unsafePoint: true, // FP maintenance around DUFFCOPY can be clobbered by interrupts }, - {name: "MOVOconst", reg: regInfo{nil, 0, []regMask{fp}}, typ: "Int128", aux: "Int128", rematerializeable: true}, // arg0 = address of memory to zero // arg1 = # of 8-byte words to zero @@ -935,6 +935,7 @@ func init() { regnames: regNamesAMD64, gpregmask: gp, fpregmask: fp, + specialregmask: x15, framepointerreg: int8(num["BP"]), linkreg: -1, // not used }) diff --git a/src/cmd/compile/internal/ssa/op.go b/src/cmd/compile/internal/ssa/op.go index c64b145107..f41d014d41 100644 --- a/src/cmd/compile/internal/ssa/op.go +++ b/src/cmd/compile/internal/ssa/op.go @@ -202,9 +202,9 @@ func ClosureAuxCall(args []Param, results []Param) *AuxCall { func (*AuxCall) CanBeAnSSAAux() {} // OwnAuxCall returns a function's own AuxCall -func OwnAuxCall(args []Param, results []Param) *AuxCall { +func OwnAuxCall(fn *obj.LSym, args []Param, results []Param) *AuxCall { // TODO if this remains identical to ClosureAuxCall above after new ABI is done, should deduplicate. - return &AuxCall{Fn: nil, args: args, results: results} + return &AuxCall{Fn: fn, args: args, results: results} } const ( diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index e590f6ba5d..9ad4c2f305 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -970,6 +970,7 @@ const ( OpAMD64MOVQstore OpAMD64MOVOload OpAMD64MOVOstore + OpAMD64MOVOstorezero OpAMD64MOVBloadidx1 OpAMD64MOVWloadidx1 OpAMD64MOVWloadidx2 @@ -998,7 +999,6 @@ const ( OpAMD64MOVQstoreconstidx1 OpAMD64MOVQstoreconstidx8 OpAMD64DUFFZERO - OpAMD64MOVOconst OpAMD64REPSTOSQ OpAMD64CALLstatic OpAMD64CALLclosure @@ -6162,11 +6162,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6178,11 +6178,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6193,11 +6193,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6208,11 +6208,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6224,11 +6224,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AMULSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6240,11 +6240,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AMULSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6255,11 +6255,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ADIVSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6270,11 +6270,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ADIVSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6290,7 +6290,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6306,7 +6306,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6318,7 +6318,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSS, reg: regInfo{ outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6330,7 +6330,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSD, reg: regInfo{ outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6347,7 +6347,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6364,7 +6364,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6381,7 +6381,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6398,7 +6398,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6411,7 +6411,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSS, reg: regInfo{ inputs: []inputInfo{ - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6425,7 +6425,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSD, reg: regInfo{ inputs: []inputInfo{ - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6439,8 +6439,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ + {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6454,8 +6454,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ + {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6469,8 +6469,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ + {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6484,8 +6484,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ + {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -6500,11 +6500,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6518,11 +6518,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6536,11 +6536,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6554,11 +6554,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6572,11 +6572,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AMULSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6590,11 +6590,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AMULSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6608,11 +6608,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ADIVSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6626,11 +6626,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ADIVSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6644,12 +6644,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6663,12 +6663,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6682,12 +6682,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6701,12 +6701,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6720,12 +6720,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6739,12 +6739,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6758,12 +6758,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6777,12 +6777,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6796,12 +6796,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6815,12 +6815,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6834,12 +6834,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6853,12 +6853,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6872,12 +6872,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6891,12 +6891,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6910,12 +6910,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -6929,12 +6929,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -8245,8 +8245,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AUCOMISS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -8256,8 +8256,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AUCOMISD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -11628,10 +11628,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASQRTSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -11642,10 +11642,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AROUNDSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -11656,12 +11656,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AVFMADD231SD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12097,7 +12097,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTTSD2SL, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12110,7 +12110,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTTSD2SQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12123,7 +12123,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTTSS2SL, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12136,7 +12136,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTTSS2SQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12152,7 +12152,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12165,7 +12165,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12178,7 +12178,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12191,7 +12191,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12201,10 +12201,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSD2SS, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12214,10 +12214,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSS2SD, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12229,7 +12229,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12238,7 +12238,7 @@ var opcodeTable = [...]opInfo{ argLen: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12253,7 +12253,7 @@ var opcodeTable = [...]opInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12262,7 +12262,7 @@ var opcodeTable = [...]opInfo{ argLen: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 @@ -12277,11 +12277,11 @@ var opcodeTable = [...]opInfo{ asm: x86.APXOR, reg: regInfo{ inputs: []inputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12720,7 +12720,7 @@ var opcodeTable = [...]opInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, }, @@ -12733,7 +12733,20 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVUPS, reg: regInfo{ inputs: []inputInfo{ - {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + }, + }, + }, + { + name: "MOVOstorezero", + auxType: auxSymOff, + argLen: 2, + faultOnNilArg0: true, + symEffect: SymWrite, + asm: x86.AMOVUPS, + reg: regInfo{ + inputs: []inputInfo{ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB }, }, @@ -13159,28 +13172,16 @@ var opcodeTable = [...]opInfo{ { name: "DUFFZERO", auxType: auxInt64, - argLen: 3, + argLen: 2, faultOnNilArg0: true, unsafePoint: true, reg: regInfo{ inputs: []inputInfo{ - {0, 128}, // DI - {1, 65536}, // X0 + {0, 128}, // DI }, clobbers: 128, // DI }, }, - { - name: "MOVOconst", - auxType: auxInt128, - argLen: 0, - rematerializeable: true, - reg: regInfo{ - outputs: []outputInfo{ - {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 - }, - }, - }, { name: "REPSTOSQ", argLen: 4, @@ -13201,7 +13202,7 @@ var opcodeTable = [...]opInfo{ clobberFlags: true, call: true, reg: regInfo{ - clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13215,7 +13216,7 @@ var opcodeTable = [...]opInfo{ {1, 4}, // DX {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, - clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13228,7 +13229,7 @@ var opcodeTable = [...]opInfo{ inputs: []inputInfo{ {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 }, - clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13328,7 +13329,7 @@ var opcodeTable = [...]opInfo{ {0, 128}, // DI {1, 879}, // AX CX DX BX BP SI R8 R9 }, - clobbers: 4294901760, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 + clobbers: 2147418112, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -36193,8 +36194,8 @@ var registersAMD64 = [...]Register{ {32, 0, -1, "SB"}, } var gpRegMaskAMD64 = regMask(65519) -var fpRegMaskAMD64 = regMask(4294901760) -var specialRegMaskAMD64 = regMask(0) +var fpRegMaskAMD64 = regMask(2147418112) +var specialRegMaskAMD64 = regMask(2147483648) var framepointerRegAMD64 = int8(5) var linkRegAMD64 = int8(-1) var registersARM = [...]Register{ diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index db2dc7a004..6087874fa9 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -14226,7 +14226,7 @@ func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value) bool { } // match: (MOVQstoreconst [c] {s} p x:(MOVQstoreconst [c2] {s} p mem)) // cond: config.useSSE && x.Uses == 1 && c2.Off() + 8 == c.Off() && c.Val() == 0 && c2.Val() == 0 && clobber(x) - // result: (MOVOstore [c2.Off32()] {s} p (MOVOconst [0]) mem) + // result: (MOVOstorezero [c2.Off32()] {s} p mem) for { c := auxIntToValAndOff(v.AuxInt) s := auxToSym(v.Aux) @@ -14243,12 +14243,10 @@ func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value) bool { if p != x.Args[0] || !(config.useSSE && x.Uses == 1 && c2.Off()+8 == c.Off() && c.Val() == 0 && c2.Val() == 0 && clobber(x)) { break } - v.reset(OpAMD64MOVOstore) + v.reset(OpAMD64MOVOstorezero) v.AuxInt = int32ToAuxInt(c2.Off32()) v.Aux = symToAux(s) - v0 := b.NewValue0(x.Pos, OpAMD64MOVOconst, types.TypeInt128) - v0.AuxInt = int128ToAuxInt(0) - v.AddArg3(p, v0, mem) + v.AddArg2(p, mem) return true } // match: (MOVQstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem) @@ -34163,7 +34161,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool { } // match: (Zero [s] destptr mem) // cond: s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE - // result: (Zero [s-s%16] (OffPtr destptr [s%16]) (MOVOstore destptr (MOVOconst [0]) mem)) + // result: (Zero [s-s%16] (OffPtr destptr [s%16]) (MOVOstorezero destptr mem)) for { s := auxIntToInt64(v.AuxInt) destptr := v_0 @@ -34176,10 +34174,8 @@ func rewriteValueAMD64_OpZero(v *Value) bool { v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) v0.AuxInt = int64ToAuxInt(s % 16) v0.AddArg(destptr) - v1 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v2 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v2.AuxInt = int128ToAuxInt(0) - v1.AddArg3(destptr, v2, mem) + v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v1.AddArg2(destptr, mem) v.AddArg2(v0, v1) return true } @@ -34206,7 +34202,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool { } // match: (Zero [16] destptr mem) // cond: config.useSSE - // result: (MOVOstore destptr (MOVOconst [0]) mem) + // result: (MOVOstorezero destptr mem) for { if auxIntToInt64(v.AuxInt) != 16 { break @@ -34216,15 +34212,13 @@ func rewriteValueAMD64_OpZero(v *Value) bool { if !(config.useSSE) { break } - v.reset(OpAMD64MOVOstore) - v0 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v0.AuxInt = int128ToAuxInt(0) - v.AddArg3(destptr, v0, mem) + v.reset(OpAMD64MOVOstorezero) + v.AddArg2(destptr, mem) return true } // match: (Zero [32] destptr mem) // cond: config.useSSE - // result: (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem)) + // result: (MOVOstorezero (OffPtr destptr [16]) (MOVOstorezero destptr mem)) for { if auxIntToInt64(v.AuxInt) != 32 { break @@ -34234,20 +34228,18 @@ func rewriteValueAMD64_OpZero(v *Value) bool { if !(config.useSSE) { break } - v.reset(OpAMD64MOVOstore) + v.reset(OpAMD64MOVOstorezero) v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) v0.AuxInt = int64ToAuxInt(16) v0.AddArg(destptr) - v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v1.AuxInt = int128ToAuxInt(0) - v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v2.AddArg3(destptr, v1, mem) - v.AddArg3(v0, v1, v2) + v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v1.AddArg2(destptr, mem) + v.AddArg2(v0, v1) return true } // match: (Zero [48] destptr mem) // cond: config.useSSE - // result: (MOVOstore (OffPtr destptr [32]) (MOVOconst [0]) (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem))) + // result: (MOVOstorezero (OffPtr destptr [32]) (MOVOstorezero (OffPtr destptr [16]) (MOVOstorezero destptr mem))) for { if auxIntToInt64(v.AuxInt) != 48 { break @@ -34257,25 +34249,23 @@ func rewriteValueAMD64_OpZero(v *Value) bool { if !(config.useSSE) { break } - v.reset(OpAMD64MOVOstore) + v.reset(OpAMD64MOVOstorezero) v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) v0.AuxInt = int64ToAuxInt(32) v0.AddArg(destptr) - v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v1.AuxInt = int128ToAuxInt(0) - v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v3 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) - v3.AuxInt = int64ToAuxInt(16) - v3.AddArg(destptr) - v4 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v4.AddArg3(destptr, v1, mem) - v2.AddArg3(v3, v1, v4) - v.AddArg3(v0, v1, v2) + v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v2 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) + v2.AuxInt = int64ToAuxInt(16) + v2.AddArg(destptr) + v3 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v3.AddArg2(destptr, mem) + v1.AddArg2(v2, v3) + v.AddArg2(v0, v1) return true } // match: (Zero [64] destptr mem) // cond: config.useSSE - // result: (MOVOstore (OffPtr destptr [48]) (MOVOconst [0]) (MOVOstore (OffPtr destptr [32]) (MOVOconst [0]) (MOVOstore (OffPtr destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem)))) + // result: (MOVOstorezero (OffPtr destptr [48]) (MOVOstorezero (OffPtr destptr [32]) (MOVOstorezero (OffPtr destptr [16]) (MOVOstorezero destptr mem)))) for { if auxIntToInt64(v.AuxInt) != 64 { break @@ -34285,30 +34275,28 @@ func rewriteValueAMD64_OpZero(v *Value) bool { if !(config.useSSE) { break } - v.reset(OpAMD64MOVOstore) + v.reset(OpAMD64MOVOstorezero) v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) v0.AuxInt = int64ToAuxInt(48) v0.AddArg(destptr) - v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v1.AuxInt = int128ToAuxInt(0) - v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v3 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) - v3.AuxInt = int64ToAuxInt(32) - v3.AddArg(destptr) - v4 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v5 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) - v5.AuxInt = int64ToAuxInt(16) - v5.AddArg(destptr) - v6 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem) - v6.AddArg3(destptr, v1, mem) - v4.AddArg3(v5, v1, v6) - v2.AddArg3(v3, v1, v4) - v.AddArg3(v0, v1, v2) + v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v2 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) + v2.AuxInt = int64ToAuxInt(32) + v2.AddArg(destptr) + v3 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v4 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type) + v4.AuxInt = int64ToAuxInt(16) + v4.AddArg(destptr) + v5 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem) + v5.AddArg2(destptr, mem) + v3.AddArg2(v4, v5) + v1.AddArg2(v2, v3) + v.AddArg2(v0, v1) return true } // match: (Zero [s] destptr mem) // cond: s > 64 && s <= 1024 && s%16 == 0 && !config.noDuffDevice - // result: (DUFFZERO [s] destptr (MOVOconst [0]) mem) + // result: (DUFFZERO [s] destptr mem) for { s := auxIntToInt64(v.AuxInt) destptr := v_0 @@ -34318,9 +34306,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool { } v.reset(OpAMD64DUFFZERO) v.AuxInt = int64ToAuxInt(s) - v0 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128) - v0.AuxInt = int128ToAuxInt(0) - v.AddArg3(destptr, v0, mem) + v.AddArg2(destptr, mem) return true } // match: (Zero [s] destptr mem) diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go index 5bebce1db5..7180b3816c 100644 --- a/src/cmd/compile/internal/ssagen/abi.go +++ b/src/cmd/compile/internal/ssagen/abi.go @@ -300,9 +300,20 @@ func makeABIWrapper(f *ir.Func, wrapperABI obj.ABI) { // to allocate any stack space). Doing this will require some // extra work in typecheck/walk/ssa, might want to add a new node // OTAILCALL or something to this effect. - var tail ir.Node - if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 && !(base.Ctxt.Arch.Name == "ppc64le" && base.Ctxt.Flag_dynlink) { + tailcall := tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 + if base.Ctxt.Arch.Name == "ppc64le" && base.Ctxt.Flag_dynlink { + // cannot tailcall on PPC64 with dynamic linking, as we need + // to restore R2 after call. + tailcall = false + } + if base.Ctxt.Arch.Name == "amd64" && wrapperABI == obj.ABIInternal { + // cannot tailcall from ABIInternal to ABI0 on AMD64, as we need + // to special registers (X15) when returning to ABIInternal. + tailcall = false + } + var tail ir.Node + if tailcall { tail = ir.NewTailCallStmt(base.Pos, f.Nname) } else { call := ir.NewCallExpr(base.Pos, ir.OCALL, f.Nname, nil) diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go index b042c132d5..6b1ddebd32 100644 --- a/src/cmd/compile/internal/ssagen/ssa.go +++ b/src/cmd/compile/internal/ssagen/ssa.go @@ -468,7 +468,7 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func { s.Fatalf("local variable with class %v unimplemented", n.Class) } } - s.f.OwnAux = ssa.OwnAuxCall(args, results) + s.f.OwnAux = ssa.OwnAuxCall(fn.LSym, args, results) // Populate SSAable arguments. for _, n := range fn.Dcl { @@ -6266,6 +6266,8 @@ type Branch struct { // State contains state needed during Prog generation. type State struct { + ABI obj.ABI + pp *objw.Progs // Branches remembers all the branch instructions we've seen @@ -6361,6 +6363,7 @@ func (s *State) DebugFriendlySetPosFrom(v *ssa.Value) { // genssa appends entries to pp for each instruction in f. func genssa(f *ssa.Func, pp *objw.Progs) { var s State + s.ABI = f.OwnAux.Fn.ABI() e := f.Frontend().(*ssafn) diff --git a/src/runtime/duff_amd64.s b/src/runtime/duff_amd64.s index 2ff5bf6dbc..df010f5853 100644 --- a/src/runtime/duff_amd64.s +++ b/src/runtime/duff_amd64.s @@ -5,100 +5,100 @@ #include "textflag.h" TEXT runtime·duffzero(SB), NOSPLIT, $0-0 - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI - MOVUPS X0,(DI) - MOVUPS X0,16(DI) - MOVUPS X0,32(DI) - MOVUPS X0,48(DI) + MOVUPS X15,(DI) + MOVUPS X15,16(DI) + MOVUPS X15,32(DI) + MOVUPS X15,48(DI) LEAQ 64(DI),DI RET diff --git a/src/runtime/mkduff.go b/src/runtime/mkduff.go index 94ae75fbfe..ef297f073e 100644 --- a/src/runtime/mkduff.go +++ b/src/runtime/mkduff.go @@ -62,15 +62,15 @@ func gen(arch string, tags, zero, copy func(io.Writer)) { func notags(w io.Writer) { fmt.Fprintln(w) } func zeroAMD64(w io.Writer) { - // X0: zero + // X15: zero // DI: ptr to memory to be zeroed // DI is updated as a side effect. - fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT, $0-0") + fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT, $0-0") for i := 0; i < 16; i++ { - fmt.Fprintln(w, "\tMOVUPS\tX0,(DI)") - fmt.Fprintln(w, "\tMOVUPS\tX0,16(DI)") - fmt.Fprintln(w, "\tMOVUPS\tX0,32(DI)") - fmt.Fprintln(w, "\tMOVUPS\tX0,48(DI)") + fmt.Fprintln(w, "\tMOVUPS\tX15,(DI)") + fmt.Fprintln(w, "\tMOVUPS\tX15,16(DI)") + fmt.Fprintln(w, "\tMOVUPS\tX15,32(DI)") + fmt.Fprintln(w, "\tMOVUPS\tX15,48(DI)") fmt.Fprintln(w, "\tLEAQ\t64(DI),DI") // We use lea instead of add, to avoid clobbering flags fmt.Fprintln(w) } @@ -84,7 +84,7 @@ func copyAMD64(w io.Writer) { // // This is equivalent to a sequence of MOVSQ but // for some reason that is 3.5x slower than this code. - fmt.Fprintln(w, "TEXT runtime·duffcopy(SB), NOSPLIT, $0-0") + fmt.Fprintln(w, "TEXT runtime·duffcopy(SB), NOSPLIT, $0-0") for i := 0; i < 64; i++ { fmt.Fprintln(w, "\tMOVUPS\t(SI), X0") fmt.Fprintln(w, "\tADDQ\t$16, SI") diff --git a/test/codegen/structs.go b/test/codegen/structs.go index 9eddc5b16e..c4bcb55c63 100644 --- a/test/codegen/structs.go +++ b/test/codegen/structs.go @@ -18,7 +18,7 @@ type Z1 struct { } func Zero1(t *Z1) { // Issue #18370 - // amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)` + // amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)` *t = Z1{} } @@ -27,7 +27,7 @@ type Z2 struct { } func Zero2(t *Z2) { - // amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)` + // amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)` // amd64:`.*runtime[.]gcWriteBarrier.*\(SB\)` *t = Z2{} } -- cgit v1.3-5-g9baa From 8869086d8f0a31033ccdc103106c768dc17216b1 Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Thu, 4 Feb 2021 02:47:37 +0000 Subject: runtime: fix typo in histogram.go indicies -> indices Change-Id: Ia50ae5918fc7a53c23590a94a18087a99bfd9bb7 GitHub-Last-Rev: 98eb724275fd61d5f5ce5dad6b1010c10f76906d GitHub-Pull-Request: golang/go#44095 Reviewed-on: https://go-review.googlesource.com/c/go/+/289529 Reviewed-by: Ian Lance Taylor Trust: Keith Randall --- src/runtime/histogram.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/histogram.go b/src/runtime/histogram.go index 42baa6c5e2..da4910d341 100644 --- a/src/runtime/histogram.go +++ b/src/runtime/histogram.go @@ -26,7 +26,7 @@ const ( // The number of super-buckets (timeHistNumSuperBuckets), on the // other hand, defines the range. To reserve room for sub-buckets, // bit timeHistSubBucketBits is the first bit considered for - // super-buckets, so super-bucket indicies are adjusted accordingly. + // super-buckets, so super-bucket indices are adjusted accordingly. // // As an example, consider 45 super-buckets with 16 sub-buckets. // -- cgit v1.3-5-g9baa From 63de2110148eec432c4954dced7ff674a4942115 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Tue, 2 Feb 2021 17:26:57 -0500 Subject: [dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64 Currently, when using cgo, the g pointer is set via a separate call to setg_gcc or with inline assembly in threadentry. This CL changes it to call setg_gcc in crosscall_amd64, like other g- register platforms. When we have an actual g register on AMD64, we'll need to set the register immediately before calling into Go. Change-Id: Ib1171e05cd0dabba3b7d12e072084d141051cf3d Reviewed-on: https://go-review.googlesource.com/c/go/+/289192 Trust: Cherry Zhang Reviewed-by: Ian Lance Taylor Reviewed-by: Than McIntosh --- src/runtime/cgo/gcc_amd64.S | 7 ++++++- src/runtime/cgo/gcc_darwin_amd64.c | 11 +++++------ src/runtime/cgo/gcc_dragonfly_amd64.c | 7 +------ src/runtime/cgo/gcc_freebsd_amd64.c | 7 +------ src/runtime/cgo/gcc_linux_amd64.c | 7 +------ src/runtime/cgo/gcc_netbsd_amd64.c | 7 +------ src/runtime/cgo/gcc_openbsd_amd64.c | 7 +------ src/runtime/cgo/gcc_solaris_amd64.c | 7 +------ src/runtime/cgo/gcc_windows_amd64.c | 10 +++++----- src/runtime/cgo/libcgo.h | 2 +- 10 files changed, 23 insertions(+), 49 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/cgo/gcc_amd64.S b/src/runtime/cgo/gcc_amd64.S index 17d9d47ef4..d75f864666 100644 --- a/src/runtime/cgo/gcc_amd64.S +++ b/src/runtime/cgo/gcc_amd64.S @@ -30,9 +30,14 @@ EXT(crosscall_amd64): pushq %r15 #if defined(_WIN64) + movq %r8, %rdi /* arg of setg_gcc */ + call *%rdx /* setg_gcc */ call *%rcx /* fn */ #else - call *%rdi /* fn */ + movq %rdi, %rbx + movq %rdx, %rdi /* arg of setg_gcc */ + call *%rsi /* setg_gcc */ + call *%rbx /* fn */ #endif popq %r15 diff --git a/src/runtime/cgo/gcc_darwin_amd64.c b/src/runtime/cgo/gcc_darwin_amd64.c index 51410d5026..d5b7fd8fd8 100644 --- a/src/runtime/cgo/gcc_darwin_amd64.c +++ b/src/runtime/cgo/gcc_darwin_amd64.c @@ -9,13 +9,16 @@ #include "libcgo_unix.h" static void* threadentry(void*); +static void (*setg_gcc)(void*); void -x_cgo_init(G *g) +x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) { pthread_attr_t attr; size_t size; + setg_gcc = setg; + pthread_attr_init(&attr); pthread_attr_getstacksize(&attr, &size); g->stacklo = (uintptr)&attr - size + 4096; @@ -57,10 +60,6 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); - // Move the g pointer into the slot reserved in thread local storage. - // Constant must match the one in cmd/link/internal/ld/sym.go. - asm volatile("movq %0, %%gs:0x30" :: "r"(ts.g)); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_dragonfly_amd64.c b/src/runtime/cgo/gcc_dragonfly_amd64.c index d25db91900..0003414bf8 100644 --- a/src/runtime/cgo/gcc_dragonfly_amd64.c +++ b/src/runtime/cgo/gcc_dragonfly_amd64.c @@ -61,11 +61,6 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_freebsd_amd64.c b/src/runtime/cgo/gcc_freebsd_amd64.c index 514a2f8a23..6071ec3909 100644 --- a/src/runtime/cgo/gcc_freebsd_amd64.c +++ b/src/runtime/cgo/gcc_freebsd_amd64.c @@ -69,11 +69,6 @@ threadentry(void *v) free(v); _cgo_tsan_release(); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_linux_amd64.c b/src/runtime/cgo/gcc_linux_amd64.c index f2bf6482cb..c25e7e769b 100644 --- a/src/runtime/cgo/gcc_linux_amd64.c +++ b/src/runtime/cgo/gcc_linux_amd64.c @@ -89,11 +89,6 @@ threadentry(void *v) free(v); _cgo_tsan_release(); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_netbsd_amd64.c b/src/runtime/cgo/gcc_netbsd_amd64.c index dc966fc45b..9f4b031a08 100644 --- a/src/runtime/cgo/gcc_netbsd_amd64.c +++ b/src/runtime/cgo/gcc_netbsd_amd64.c @@ -62,11 +62,6 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - // On NetBSD, a new thread inherits the signal stack of the // creating thread. That confuses minit, so we remove that // signal stack here before calling the regular mstart. It's @@ -78,6 +73,6 @@ threadentry(void *v) ss.ss_flags = SS_DISABLE; sigaltstack(&ss, nil); - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_openbsd_amd64.c b/src/runtime/cgo/gcc_openbsd_amd64.c index 34319fb0b8..09d2750f3a 100644 --- a/src/runtime/cgo/gcc_openbsd_amd64.c +++ b/src/runtime/cgo/gcc_openbsd_amd64.c @@ -60,11 +60,6 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_solaris_amd64.c b/src/runtime/cgo/gcc_solaris_amd64.c index 079bd12898..e89e844b1e 100644 --- a/src/runtime/cgo/gcc_solaris_amd64.c +++ b/src/runtime/cgo/gcc_solaris_amd64.c @@ -72,11 +72,6 @@ threadentry(void *v) ts = *(ThreadStart*)v; free(v); - /* - * Set specific keys. - */ - setg_gcc((void*)ts.g); - - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); return nil; } diff --git a/src/runtime/cgo/gcc_windows_amd64.c b/src/runtime/cgo/gcc_windows_amd64.c index 0f8c817f0e..25cfd086dd 100644 --- a/src/runtime/cgo/gcc_windows_amd64.c +++ b/src/runtime/cgo/gcc_windows_amd64.c @@ -12,10 +12,12 @@ #include "libcgo_windows.h" static void threadentry(void*); +static void (*setg_gcc)(void*); void -x_cgo_init(G *g) +x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase) { + setg_gcc = setg; } @@ -46,10 +48,8 @@ threadentry(void *v) */ asm volatile ( "movq %0, %%gs:0x28\n" // MOVL tls0, 0x28(GS) - "movq %%gs:0x28, %%rax\n" // MOVQ 0x28(GS), tmp - "movq %1, 0(%%rax)\n" // MOVQ g, 0(GS) - :: "r"(ts.tls), "r"(ts.g) : "%rax" + :: "r"(ts.tls) ); - crosscall_amd64(ts.fn); + crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g); } diff --git a/src/runtime/cgo/libcgo.h b/src/runtime/cgo/libcgo.h index aba500a301..af4960e7e9 100644 --- a/src/runtime/cgo/libcgo.h +++ b/src/runtime/cgo/libcgo.h @@ -66,7 +66,7 @@ uintptr_t _cgo_wait_runtime_init_done(void); /* * Call fn in the 6c world. */ -void crosscall_amd64(void (*fn)(void)); +void crosscall_amd64(void (*fn)(void), void (*setg_gcc)(void*), void *g); /* * Call fn in the 8c world. -- cgit v1.3-5-g9baa From 7cc6de59f25911ff786a4d54420f2ddbf21c00f2 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 3 Feb 2021 11:53:35 -0500 Subject: [dev.regabi] runtime: don't mark rt0_go ABIInternal rt0_go is not actually ABIInternal, and it actually has callers (e.g. _rt0_amd64). Change-Id: Id730176e620ad9f443e6bfca6ded81a1367531ba Reviewed-on: https://go-review.googlesource.com/c/go/+/289193 Trust: Cherry Zhang Reviewed-by: Than McIntosh --- src/runtime/asm_amd64.s | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index b5d01ba73c..aece84bde8 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -84,9 +84,7 @@ GLOBL _rt0_amd64_lib_argc<>(SB),NOPTR, $8 DATA _rt0_amd64_lib_argv<>(SB)/8, $0 GLOBL _rt0_amd64_lib_argv<>(SB),NOPTR, $8 -// Defined as ABIInternal since it does not use the stack-based Go ABI (and -// in addition there are no calls to this entry point from Go code). -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT,$0 // copy arguments forward on an even stack MOVQ DI, AX // argc MOVQ SI, BX // argv -- cgit v1.3-5-g9baa From e79c2fd428372f64e6183bed9f765c1556816111 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Tue, 2 Feb 2021 18:09:03 -0500 Subject: [dev.regabi] runtime: mark racecallbackthunk as ABIInternal racecallbackthunk is called from C, and it needs to follow C ABI. The assembly code preserves C callee-save registers. It must not be called via wrappers, which may not preserve those registers. Change-Id: Icd72c399f4424d73c4882860d85057fe2671f6aa Reviewed-on: https://go-review.googlesource.com/c/go/+/289194 Trust: Cherry Zhang Reviewed-by: Than McIntosh --- src/runtime/race_amd64.s | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s index 9818bc6ddf..cf0a51462f 100644 --- a/src/runtime/race_amd64.s +++ b/src/runtime/race_amd64.s @@ -419,7 +419,9 @@ call: // The overall effect of Go->C->Go call chain is similar to that of mcall. // RARG0 contains command code. RARG1 contains command-specific context. // See racecallback for command codes. -TEXT runtime·racecallbackthunk(SB), NOSPLIT, $56-8 +// Defined as ABIInternal so as to avoid introducing a wrapper, +// because its address is passed to C via funcPC. +TEXT runtime·racecallbackthunk(SB), NOSPLIT, $56-8 // Handle command raceGetProcCmd (0) here. // First, code below assumes that we are on curg, while raceGetProcCmd // can be executed on g0. Second, it is called frequently, so will -- cgit v1.3-5-g9baa From 946351d5a27d7dc5550f579ddfec926790903fc5 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Tue, 2 Feb 2021 18:25:39 -0500 Subject: [dev.regabi] runtime: zero X15 in racecall racecall can be called in ABIInternal context (e.g. raceread calling racecalladdr calling racecall) without wrapper. racecall calls C code, which doesn't preserve our special registers. Set them explicitly in racecall upon returning from C. Change-Id: Ic990479c1fca6bb8a3b151325c7a89be8331a530 Reviewed-on: https://go-review.googlesource.com/c/go/+/289709 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Michael Knyszek Reviewed-by: Jeremy Faller --- src/runtime/race_amd64.s | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s index cf0a51462f..fd41b5690a 100644 --- a/src/runtime/race_amd64.s +++ b/src/runtime/race_amd64.s @@ -412,6 +412,9 @@ call: ANDQ $~15, SP // alignment for gcc ABI CALL AX MOVQ R12, SP + // Back to Go world, set special registers. + // The g register (R14) is preserved in C. + XORPS X15, X15 RET // C->Go callback thunk that allows to call runtime·racesymbolize from C code. -- cgit v1.3-5-g9baa From 8fa84772ba035b74975572fbc9df0330523cc388 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Thu, 4 Feb 2021 12:59:06 -0500 Subject: [dev.regabi] runtime: delete gosave function The runtime.gosave function is not used anywhere. Delete. Note: there is also a gosave<> function, which is actually used and not deleted. Change-Id: I64149a7afdd217de26d1e6396233f2becfad7153 Reviewed-on: https://go-review.googlesource.com/c/go/+/289719 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Michael Knyszek --- src/runtime/asm_386.s | 19 ------------------- src/runtime/asm_amd64.s | 20 -------------------- src/runtime/asm_arm.s | 17 ----------------- src/runtime/asm_arm64.s | 17 ----------------- src/runtime/asm_mips64x.s | 15 --------------- src/runtime/asm_mipsx.s | 15 --------------- src/runtime/asm_ppc64x.s | 17 ----------------- src/runtime/asm_riscv64.s | 15 --------------- src/runtime/asm_s390x.s | 15 --------------- src/runtime/stubs.go | 1 - 10 files changed, 151 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index fa3b1be339..429f3fef82 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -273,25 +273,6 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT, $0-4 - MOVL buf+0(FP), AX // gobuf - LEAL buf+0(FP), BX // caller's SP - MOVL BX, gobuf_sp(AX) - MOVL 0(SP), BX // caller's PC - MOVL BX, gobuf_pc(AX) - MOVL $0, gobuf_ret(AX) - // Assert ctxt is zero. See func save. - MOVL gobuf_ctxt(AX), BX - TESTL BX, BX - JZ 2(PC) - CALL runtime·badctxt(SB) - get_tls(CX) - MOVL g(CX), BX - MOVL BX, gobuf_g(AX) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $8-4 diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index aece84bde8..a9456dc9ff 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -254,26 +254,6 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 * go-routine */ -// func gosave(buf *gobuf) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT, $0-8 - MOVQ buf+0(FP), AX // gobuf - LEAQ buf+0(FP), BX // caller's SP - MOVQ BX, gobuf_sp(AX) - MOVQ 0(SP), BX // caller's PC - MOVQ BX, gobuf_pc(AX) - MOVQ $0, gobuf_ret(AX) - MOVQ BP, gobuf_bp(AX) - // Assert ctxt is zero. See func save. - MOVQ gobuf_ctxt(AX), BX - TESTQ BX, BX - JZ 2(PC) - CALL runtime·badctxt(SB) - get_tls(CX) - MOVQ g(CX), BX - MOVQ BX, gobuf_g(AX) - RET - // func gogo(buf *gobuf) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $16-8 diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index c54b4eb006..8eec84d3f2 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -206,23 +206,6 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB),NOSPLIT|NOFRAME,$0-4 - MOVW buf+0(FP), R0 - MOVW R13, gobuf_sp(R0) - MOVW LR, gobuf_pc(R0) - MOVW g, gobuf_g(R0) - MOVW $0, R11 - MOVW R11, gobuf_lr(R0) - MOVW R11, gobuf_ret(R0) - // Assert ctxt is zero. See func save. - MOVW gobuf_ctxt(R0), R0 - CMP R0, R11 - B.EQ 2(PC) - CALL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB),NOSPLIT,$8-4 diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index a09172f0c9..8e4a1f74f9 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -113,23 +113,6 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8 - MOVD buf+0(FP), R3 - MOVD RSP, R0 - MOVD R0, gobuf_sp(R3) - MOVD R29, gobuf_bp(R3) - MOVD LR, gobuf_pc(R3) - MOVD g, gobuf_g(R3) - MOVD ZR, gobuf_lr(R3) - MOVD ZR, gobuf_ret(R3) - // Assert ctxt is zero. See func save. - MOVD gobuf_ctxt(R3), R0 - CBZ R0, 2(PC) - CALL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $24-8 diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 19781f7885..054a89dc37 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -89,21 +89,6 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8 - MOVV buf+0(FP), R1 - MOVV R29, gobuf_sp(R1) - MOVV R31, gobuf_pc(R1) - MOVV g, gobuf_g(R1) - MOVV R0, gobuf_lr(R1) - MOVV R0, gobuf_ret(R1) - // Assert ctxt is zero. See func save. - MOVV gobuf_ctxt(R1), R1 - BEQ R1, 2(PC) - JAL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $16-8 diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index ee87d81436..f57437d590 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -90,21 +90,6 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB),NOSPLIT|NOFRAME,$0-4 - MOVW buf+0(FP), R1 - MOVW R29, gobuf_sp(R1) - MOVW R31, gobuf_pc(R1) - MOVW g, gobuf_g(R1) - MOVW R0, gobuf_lr(R1) - MOVW R0, gobuf_ret(R1) - // Assert ctxt is zero. See func save. - MOVW gobuf_ctxt(R1), R1 - BEQ R1, 2(PC) - JAL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB),NOSPLIT,$8-4 diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index dc34c0e4c8..763a92adf1 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -128,23 +128,6 @@ TEXT runtime·reginit(SB),NOSPLIT|NOFRAME,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8 - MOVD buf+0(FP), R3 - MOVD R1, gobuf_sp(R3) - MOVD LR, R31 - MOVD R31, gobuf_pc(R3) - MOVD g, gobuf_g(R3) - MOVD R0, gobuf_lr(R3) - MOVD R0, gobuf_ret(R3) - // Assert ctxt is zero. See func save. - MOVD gobuf_ctxt(R3), R3 - CMP R0, R3 - BEQ 2(PC) - BL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $16-8 diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index 01b42dc3de..cf460d1586 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -297,21 +297,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 JALR RA, T1 JMP runtime·badmcall2(SB) -// func gosave(buf *gobuf) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8 - MOV buf+0(FP), T1 - MOV X2, gobuf_sp(T1) - MOV RA, gobuf_pc(T1) - MOV g, gobuf_g(T1) - MOV ZERO, gobuf_lr(T1) - MOV ZERO, gobuf_ret(T1) - // Assert ctxt is zero. See func save. - MOV gobuf_ctxt(T1), T1 - BEQ T1, ZERO, 2(PC) - CALL runtime·badctxt(SB) - RET - // Save state of caller into g->sched. Smashes X31. TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 MOV X1, (g_sched+gobuf_pc)(g) diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index 7baef37324..1cd5eca06f 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -174,21 +174,6 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 * go-routine */ -// void gosave(Gobuf*) -// save state in Gobuf; setjmp -TEXT runtime·gosave(SB), NOSPLIT, $-8-8 - MOVD buf+0(FP), R3 - MOVD R15, gobuf_sp(R3) - MOVD LR, gobuf_pc(R3) - MOVD g, gobuf_g(R3) - MOVD $0, gobuf_lr(R3) - MOVD $0, gobuf_ret(R3) - // Assert ctxt is zero. See func save. - MOVD gobuf_ctxt(R3), R3 - CMPBEQ R3, $0, 2(PC) - BL runtime·badctxt(SB) - RET - // void gogo(Gobuf*) // restore state from Gobuf; longjmp TEXT runtime·gogo(SB), NOSPLIT, $16-8 diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 2ee2c74dfe..36bbc8991a 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -167,7 +167,6 @@ func noescape(p unsafe.Pointer) unsafe.Pointer { // pointer-declared arguments. func cgocallback(fn, frame, ctxt uintptr) func gogo(buf *gobuf) -func gosave(buf *gobuf) //go:noescape func jmpdefer(fv *funcval, argp uintptr) -- cgit v1.3-5-g9baa From 1901853098bbe25a1bbedc0ee53c6658d754151e Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Sun, 7 Feb 2021 17:31:12 +0100 Subject: runtime/metrics: fix panic in readingAllMetric example medianBucket can return if the total is greater than thresh. However, if a histogram has no counts, total and thresh will both be zero and cause panic. Adding an equal sign to prevent the potential panic. Fixes #44148 Change-Id: Ifb8a781990f490d142ae7c035b4e01d6a07ae04d Reviewed-on: https://go-review.googlesource.com/c/go/+/290171 Trust: Ian Lance Taylor Reviewed-by: Michael Knyszek Run-TryBot: Michael Knyszek TryBot-Result: Go Bot --- src/runtime/metrics/example_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics/example_test.go b/src/runtime/metrics/example_test.go index cade0c38bf..624d9d8a6b 100644 --- a/src/runtime/metrics/example_test.go +++ b/src/runtime/metrics/example_test.go @@ -88,7 +88,7 @@ func medianBucket(h *metrics.Float64Histogram) float64 { total = 0 for i, count := range h.Counts { total += count - if total > thresh { + if total >= thresh { return h.Buckets[i] } } -- cgit v1.3-5-g9baa From 5d7dc53888c3c91ef4122d584a064bc24b6f7540 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Tue, 2 Feb 2021 18:20:16 -0500 Subject: [dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64 This is a proof-of-concept change for using the g register on AMD64. getg is now lowered to R14 in the new ABI. The g register is not yet used in all places where it can be used (e.g. stack bounds check, runtime assembly code). Change-Id: I10123ddf38e31782cf58bafcdff170aee0ff0d1b Reviewed-on: https://go-review.googlesource.com/c/go/+/289196 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Than McIntosh Reviewed-by: David Chase --- src/cmd/compile/internal/amd64/ssa.go | 63 +- src/cmd/compile/internal/ssa/config.go | 3 +- src/cmd/compile/internal/ssa/gen/AMD64.rules | 2 +- src/cmd/compile/internal/ssa/gen/AMD64Ops.go | 42 +- src/cmd/compile/internal/ssa/gen/rulegen.go | 1 + src/cmd/compile/internal/ssa/opGen.go | 2014 +++++++++++++------------- src/cmd/compile/internal/ssa/rewriteAMD64.go | 20 +- src/runtime/asm_amd64.s | 35 +- src/runtime/race_amd64.s | 7 +- src/runtime/sys_linux_amd64.s | 1 + 10 files changed, 1113 insertions(+), 1075 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/compile/internal/amd64/ssa.go b/src/cmd/compile/internal/amd64/ssa.go index d9c97183fd..4938e4b0e3 100644 --- a/src/cmd/compile/internal/amd64/ssa.go +++ b/src/cmd/compile/internal/amd64/ssa.go @@ -166,6 +166,34 @@ func duff(size int64) (int64, int64) { return off, adj } +func getgFromTLS(s *ssagen.State, r int16) { + // See the comments in cmd/internal/obj/x86/obj6.go + // near CanUse1InsnTLS for a detailed explanation of these instructions. + if x86.CanUse1InsnTLS(base.Ctxt) { + // MOVQ (TLS), r + p := s.Prog(x86.AMOVQ) + p.From.Type = obj.TYPE_MEM + p.From.Reg = x86.REG_TLS + p.To.Type = obj.TYPE_REG + p.To.Reg = r + } else { + // MOVQ TLS, r + // MOVQ (r)(TLS*1), r + p := s.Prog(x86.AMOVQ) + p.From.Type = obj.TYPE_REG + p.From.Reg = x86.REG_TLS + p.To.Type = obj.TYPE_REG + p.To.Reg = r + q := s.Prog(x86.AMOVQ) + q.From.Type = obj.TYPE_MEM + q.From.Reg = r + q.From.Index = x86.REG_TLS + q.From.Scale = 1 + q.To.Type = obj.TYPE_REG + q.To.Reg = r + } +} + func ssaGenValue(s *ssagen.State, v *ssa.Value) { switch v.Op { case ssa.OpAMD64VFMADD231SD: @@ -989,41 +1017,24 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) { // Closure pointer is DX. ssagen.CheckLoweredGetClosurePtr(v) case ssa.OpAMD64LoweredGetG: - r := v.Reg() - // See the comments in cmd/internal/obj/x86/obj6.go - // near CanUse1InsnTLS for a detailed explanation of these instructions. - if x86.CanUse1InsnTLS(base.Ctxt) { - // MOVQ (TLS), r - p := s.Prog(x86.AMOVQ) - p.From.Type = obj.TYPE_MEM - p.From.Reg = x86.REG_TLS - p.To.Type = obj.TYPE_REG - p.To.Reg = r - } else { - // MOVQ TLS, r - // MOVQ (r)(TLS*1), r - p := s.Prog(x86.AMOVQ) - p.From.Type = obj.TYPE_REG - p.From.Reg = x86.REG_TLS - p.To.Type = obj.TYPE_REG - p.To.Reg = r - q := s.Prog(x86.AMOVQ) - q.From.Type = obj.TYPE_MEM - q.From.Reg = r - q.From.Index = x86.REG_TLS - q.From.Scale = 1 - q.To.Type = obj.TYPE_REG - q.To.Reg = r + if base.Flag.ABIWrap { + v.Fatalf("LoweredGetG should not appear in new ABI") } + r := v.Reg() + getgFromTLS(s, r) case ssa.OpAMD64CALLstatic: if s.ABI == obj.ABI0 && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABIInternal { // zeroing X15 when entering ABIInternal from ABI0 opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + // set G register from TLS + getgFromTLS(s, x86.REG_R14) } s.Call(v) if s.ABI == obj.ABIInternal && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABI0 { // zeroing X15 when entering ABIInternal from ABI0 opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + // set G register from TLS + getgFromTLS(s, x86.REG_R14) } case ssa.OpAMD64CALLclosure, ssa.OpAMD64CALLinter: s.Call(v) @@ -1325,6 +1336,8 @@ func ssaGenBlock(s *ssagen.State, b, next *ssa.Block) { if s.ABI == obj.ABI0 && b.Aux.(*obj.LSym).ABI() == obj.ABIInternal { // zeroing X15 when entering ABIInternal from ABI0 opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15) + // set G register from TLS + getgFromTLS(s, x86.REG_R14) } p := s.Prog(obj.ARET) p.To.Type = obj.TYPE_MEM diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go index 32cfd7e61e..c29bc8fae6 100644 --- a/src/cmd/compile/internal/ssa/config.go +++ b/src/cmd/compile/internal/ssa/config.go @@ -5,6 +5,7 @@ package ssa import ( + "cmd/compile/internal/base" "cmd/compile/internal/ir" "cmd/compile/internal/types" "cmd/internal/obj" @@ -197,7 +198,7 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config c.specialRegMask = specialRegMaskAMD64 c.FPReg = framepointerRegAMD64 c.LinkReg = linkRegAMD64 - c.hasGReg = false + c.hasGReg = base.Flag.ABIWrap case "386": c.PtrSize = 4 c.RegSize = 4 diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules index 706336289e..3c75bcfa05 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64.rules +++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules @@ -459,7 +459,7 @@ (IsInBounds idx len) => (SETB (CMPQ idx len)) (IsSliceInBounds idx len) => (SETBE (CMPQ idx len)) (NilCheck ...) => (LoweredNilCheck ...) -(GetG ...) => (LoweredGetG ...) +(GetG mem) && !base.Flag.ABIWrap => (LoweredGetG mem) // only lower in old ABI. in new ABI we have a G register. (GetClosurePtr ...) => (LoweredGetClosurePtr ...) (GetCallerPC ...) => (LoweredGetCallerPC ...) (GetCallerSP ...) => (LoweredGetCallerSP ...) diff --git a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go index 0a411bbdca..043162e544 100644 --- a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go +++ b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go @@ -44,7 +44,7 @@ var regNamesAMD64 = []string{ "R11", "R12", "R13", - "R14", + "g", // a.k.a. R14 "R15", "X0", "X1", @@ -96,12 +96,14 @@ func init() { cx = buildReg("CX") dx = buildReg("DX") bx = buildReg("BX") - gp = buildReg("AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15") + gp = buildReg("AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15") + g = buildReg("g") fp = buildReg("X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14") x15 = buildReg("X15") gpsp = gp | buildReg("SP") gpspsb = gpsp | buildReg("SB") - callerSave = gp | fp + gpspsbg = gpspsb | g + callerSave = gp | fp | g // runtime.setg (and anything calling it) may clobber g ) // Common slices of register masks var ( @@ -114,10 +116,10 @@ func init() { gp01 = regInfo{inputs: nil, outputs: gponly} gp11 = regInfo{inputs: []regMask{gp}, outputs: gponly} gp11sp = regInfo{inputs: []regMask{gpsp}, outputs: gponly} - gp11sb = regInfo{inputs: []regMask{gpspsb}, outputs: gponly} + gp11sb = regInfo{inputs: []regMask{gpspsbg}, outputs: gponly} gp21 = regInfo{inputs: []regMask{gp, gp}, outputs: gponly} gp21sp = regInfo{inputs: []regMask{gpsp, gp}, outputs: gponly} - gp21sb = regInfo{inputs: []regMask{gpspsb, gpsp}, outputs: gponly} + gp21sb = regInfo{inputs: []regMask{gpspsbg, gpsp}, outputs: gponly} gp21shift = regInfo{inputs: []regMask{gp, cx}, outputs: []regMask{gp}} gp11div = regInfo{inputs: []regMask{ax, gpsp &^ dx}, outputs: []regMask{ax, dx}} gp21hmul = regInfo{inputs: []regMask{ax, gpsp}, outputs: []regMask{dx}, clobbers: ax} @@ -126,9 +128,9 @@ func init() { gp2flags = regInfo{inputs: []regMask{gpsp, gpsp}} gp1flags = regInfo{inputs: []regMask{gpsp}} - gp0flagsLoad = regInfo{inputs: []regMask{gpspsb, 0}} - gp1flagsLoad = regInfo{inputs: []regMask{gpspsb, gpsp, 0}} - gp2flagsLoad = regInfo{inputs: []regMask{gpspsb, gpsp, gpsp, 0}} + gp0flagsLoad = regInfo{inputs: []regMask{gpspsbg, 0}} + gp1flagsLoad = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}} + gp2flagsLoad = regInfo{inputs: []regMask{gpspsbg, gpsp, gpsp, 0}} flagsgp = regInfo{inputs: nil, outputs: gponly} gp11flags = regInfo{inputs: []regMask{gp}, outputs: []regMask{gp, 0}} @@ -137,24 +139,24 @@ func init() { readflags = regInfo{inputs: nil, outputs: gponly} flagsgpax = regInfo{inputs: nil, clobbers: ax, outputs: []regMask{gp &^ ax}} - gpload = regInfo{inputs: []regMask{gpspsb, 0}, outputs: gponly} - gp21load = regInfo{inputs: []regMask{gp, gpspsb, 0}, outputs: gponly} - gploadidx = regInfo{inputs: []regMask{gpspsb, gpsp, 0}, outputs: gponly} - gp21loadidx = regInfo{inputs: []regMask{gp, gpspsb, gpsp, 0}, outputs: gponly} + gpload = regInfo{inputs: []regMask{gpspsbg, 0}, outputs: gponly} + gp21load = regInfo{inputs: []regMask{gp, gpspsbg, 0}, outputs: gponly} + gploadidx = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}, outputs: gponly} + gp21loadidx = regInfo{inputs: []regMask{gp, gpspsbg, gpsp, 0}, outputs: gponly} gp21pax = regInfo{inputs: []regMask{gp &^ ax, gp}, outputs: []regMask{gp &^ ax}, clobbers: ax} - gpstore = regInfo{inputs: []regMask{gpspsb, gpsp, 0}} - gpstoreconst = regInfo{inputs: []regMask{gpspsb, 0}} - gpstoreidx = regInfo{inputs: []regMask{gpspsb, gpsp, gpsp, 0}} - gpstoreconstidx = regInfo{inputs: []regMask{gpspsb, gpsp, 0}} - gpstorexchg = regInfo{inputs: []regMask{gp, gpspsb, 0}, outputs: []regMask{gp}} + gpstore = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}} + gpstoreconst = regInfo{inputs: []regMask{gpspsbg, 0}} + gpstoreidx = regInfo{inputs: []regMask{gpspsbg, gpsp, gpsp, 0}} + gpstoreconstidx = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}} + gpstorexchg = regInfo{inputs: []regMask{gp, gpspsbg, 0}, outputs: []regMask{gp}} cmpxchg = regInfo{inputs: []regMask{gp, ax, gp, 0}, outputs: []regMask{gp, 0}, clobbers: ax} fp01 = regInfo{inputs: nil, outputs: fponly} fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: fponly} fp31 = regInfo{inputs: []regMask{fp, fp, fp}, outputs: fponly} - fp21load = regInfo{inputs: []regMask{fp, gpspsb, 0}, outputs: fponly} - fp21loadidx = regInfo{inputs: []regMask{fp, gpspsb, gpspsb, 0}, outputs: fponly} + fp21load = regInfo{inputs: []regMask{fp, gpspsbg, 0}, outputs: fponly} + fp21loadidx = regInfo{inputs: []regMask{fp, gpspsbg, gpspsb, 0}, outputs: fponly} fpgp = regInfo{inputs: fponly, outputs: gponly} gpfp = regInfo{inputs: gponly, outputs: fponly} fp11 = regInfo{inputs: fponly, outputs: fponly} @@ -830,7 +832,7 @@ func init() { {name: "LoweredNilCheck", argLength: 2, reg: regInfo{inputs: []regMask{gpsp}}, clobberFlags: true, nilCheck: true, faultOnNilArg0: true}, // LoweredWB invokes runtime.gcWriteBarrier. arg0=destptr, arg1=srcptr, arg2=mem, aux=runtime.gcWriteBarrier // It saves all GP registers if necessary, but may clobber others. - {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("DI"), buildReg("AX CX DX BX BP SI R8 R9")}, clobbers: callerSave &^ gp}, clobberFlags: true, aux: "Sym", symEffect: "None"}, + {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("DI"), buildReg("AX CX DX BX BP SI R8 R9")}, clobbers: callerSave &^ (gp | g)}, clobberFlags: true, aux: "Sym", symEffect: "None"}, {name: "LoweredHasCPUFeature", argLength: 0, reg: gp01, rematerializeable: true, typ: "UInt64", aux: "Sym", symEffect: "None"}, diff --git a/src/cmd/compile/internal/ssa/gen/rulegen.go b/src/cmd/compile/internal/ssa/gen/rulegen.go index aaf9101368..6388aab362 100644 --- a/src/cmd/compile/internal/ssa/gen/rulegen.go +++ b/src/cmd/compile/internal/ssa/gen/rulegen.go @@ -582,6 +582,7 @@ func fprint(w io.Writer, n Node) { "math", "cmd/internal/obj", "cmd/internal/objabi", + "cmd/compile/internal/base", "cmd/compile/internal/types", }, n.Arch.imports...) { fmt.Fprintf(w, "import %q\n", path) diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go index 9ad4c2f305..ccfed93475 100644 --- a/src/cmd/compile/internal/ssa/opGen.go +++ b/src/cmd/compile/internal/ssa/opGen.go @@ -6287,7 +6287,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSS, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6303,7 +6303,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVSD, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6343,8 +6343,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6360,8 +6360,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6377,8 +6377,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6394,8 +6394,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6412,7 +6412,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6426,7 +6426,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6439,9 +6439,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6454,9 +6454,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6469,9 +6469,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6484,9 +6484,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -6501,7 +6501,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6519,7 +6519,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6537,7 +6537,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6555,7 +6555,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6573,7 +6573,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6591,7 +6591,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6609,7 +6609,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6627,7 +6627,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6645,8 +6645,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6664,8 +6664,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6683,8 +6683,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6702,8 +6702,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6721,8 +6721,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6740,8 +6740,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6759,8 +6759,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6778,8 +6778,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6797,8 +6797,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6816,8 +6816,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6835,8 +6835,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6854,8 +6854,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6873,8 +6873,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6892,8 +6892,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6911,8 +6911,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6930,8 +6930,8 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB - {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -6946,11 +6946,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -6962,11 +6962,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDL, reg: regInfo{ inputs: []inputInfo{ - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -6978,10 +6978,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -6993,10 +6993,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7010,7 +7010,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7024,7 +7024,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7036,11 +7036,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7052,11 +7052,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7069,10 +7069,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7085,10 +7085,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7101,11 +7101,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AIMULQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7118,11 +7118,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AIMULL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7134,10 +7134,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AIMUL3Q, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7149,10 +7149,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AIMUL3L, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7165,7 +7165,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 4, // DX outputs: []outputInfo{ @@ -7183,7 +7183,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 4, // DX outputs: []outputInfo{ @@ -7200,7 +7200,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ @@ -7216,7 +7216,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ @@ -7232,7 +7232,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ @@ -7248,7 +7248,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ @@ -7264,11 +7264,11 @@ var opcodeTable = [...]opInfo{ clobberFlags: true, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7281,7 +7281,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7298,7 +7298,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7315,7 +7315,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7331,7 +7331,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7347,7 +7347,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7363,7 +7363,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7378,11 +7378,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ANEGL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7394,12 +7394,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7411,12 +7411,12 @@ var opcodeTable = [...]opInfo{ asm: x86.AADCQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7428,11 +7428,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7444,11 +7444,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADCQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7459,12 +7459,12 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7475,12 +7475,12 @@ var opcodeTable = [...]opInfo{ asm: x86.ASBBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7492,11 +7492,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7508,11 +7508,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASBBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7525,7 +7525,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {0, 1}, // AX - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 4}, // DX @@ -7542,7 +7542,7 @@ var opcodeTable = [...]opInfo{ inputs: []inputInfo{ {0, 4}, // DX {1, 1}, // AX - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 1}, // AX @@ -7559,11 +7559,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7576,11 +7576,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7593,10 +7593,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7609,10 +7609,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7626,7 +7626,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7640,7 +7640,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7653,11 +7653,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7670,11 +7670,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7687,10 +7687,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7703,10 +7703,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7720,7 +7720,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7734,7 +7734,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7747,11 +7747,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7764,11 +7764,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7781,10 +7781,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7797,10 +7797,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7814,7 +7814,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7828,7 +7828,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7838,8 +7838,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7849,8 +7849,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7860,8 +7860,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPW, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7871,8 +7871,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPB, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7883,7 +7883,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7894,7 +7894,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7905,7 +7905,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPW, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7916,7 +7916,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPB, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -7929,8 +7929,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7943,8 +7943,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7957,8 +7957,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPW, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7971,8 +7971,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPB, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7985,7 +7985,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -7998,7 +7998,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8011,7 +8011,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPW, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8024,7 +8024,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMPB, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8037,9 +8037,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8053,9 +8053,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8068,9 +8068,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8084,9 +8084,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8099,9 +8099,9 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8115,9 +8115,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8131,9 +8131,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8146,8 +8146,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8161,8 +8161,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8175,8 +8175,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8190,8 +8190,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8204,8 +8204,8 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8219,8 +8219,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8234,8 +8234,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8267,8 +8267,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8278,8 +8278,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8291,11 +8291,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8307,11 +8307,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8323,11 +8323,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8339,11 +8339,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8355,11 +8355,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8371,11 +8371,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8386,7 +8386,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8397,7 +8397,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8410,10 +8410,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8426,10 +8426,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8442,10 +8442,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8458,10 +8458,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8474,10 +8474,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8490,10 +8490,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8507,8 +8507,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8522,8 +8522,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8537,8 +8537,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8552,8 +8552,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8567,8 +8567,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8582,8 +8582,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8597,7 +8597,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8611,7 +8611,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTCL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8625,7 +8625,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8639,7 +8639,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTSL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8653,7 +8653,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8667,7 +8667,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ABTRL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -8678,8 +8678,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8690,8 +8690,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8702,8 +8702,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTW, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8714,8 +8714,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTB, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8726,7 +8726,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8737,7 +8737,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8748,7 +8748,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTW, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8759,7 +8759,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ATESTB, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8772,10 +8772,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8788,10 +8788,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8804,10 +8804,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHLQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8820,10 +8820,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHLL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8836,10 +8836,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8852,10 +8852,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8868,10 +8868,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8884,10 +8884,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8900,10 +8900,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHRQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8916,10 +8916,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHRL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8932,10 +8932,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHRW, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8948,10 +8948,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASHRB, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8964,10 +8964,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8980,10 +8980,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -8996,10 +8996,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9012,10 +9012,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9028,10 +9028,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASARQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9044,10 +9044,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASARL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9060,10 +9060,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASARW, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9076,10 +9076,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ASARB, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9092,10 +9092,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9108,10 +9108,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9124,10 +9124,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9140,10 +9140,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9156,10 +9156,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9172,10 +9172,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9188,10 +9188,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9204,10 +9204,10 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2}, // CX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9220,10 +9220,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AROLQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9236,10 +9236,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AROLL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9252,10 +9252,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AROLW, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9268,10 +9268,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AROLB, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9286,11 +9286,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9305,11 +9305,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9324,11 +9324,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9343,11 +9343,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9362,11 +9362,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9381,11 +9381,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9400,11 +9400,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9419,11 +9419,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9438,11 +9438,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9457,11 +9457,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9476,12 +9476,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9496,12 +9496,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9516,12 +9516,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9536,12 +9536,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9556,12 +9556,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9576,12 +9576,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9596,12 +9596,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9616,12 +9616,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9636,12 +9636,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9656,12 +9656,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9676,12 +9676,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9696,12 +9696,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9716,12 +9716,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9736,12 +9736,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9756,12 +9756,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9776,12 +9776,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9796,12 +9796,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9816,12 +9816,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9836,12 +9836,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9856,12 +9856,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9876,12 +9876,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9896,12 +9896,12 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9916,12 +9916,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9936,12 +9936,12 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9956,12 +9956,12 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -9975,8 +9975,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -9990,8 +9990,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10005,8 +10005,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10020,8 +10020,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AORQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10035,8 +10035,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10050,8 +10050,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AADDL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10065,8 +10065,8 @@ var opcodeTable = [...]opInfo{ asm: x86.ASUBL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10080,8 +10080,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10095,8 +10095,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10110,8 +10110,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AXORL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10125,9 +10125,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10141,9 +10141,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10157,9 +10157,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10173,9 +10173,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10189,9 +10189,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10205,9 +10205,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10221,9 +10221,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10237,9 +10237,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10253,9 +10253,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10269,9 +10269,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10285,9 +10285,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10301,9 +10301,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10317,9 +10317,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10333,9 +10333,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10349,9 +10349,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10365,9 +10365,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10381,9 +10381,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10397,9 +10397,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10413,9 +10413,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10429,9 +10429,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10445,9 +10445,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10461,9 +10461,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10477,9 +10477,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10493,9 +10493,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10509,9 +10509,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10525,8 +10525,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10540,8 +10540,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10555,8 +10555,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10570,8 +10570,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10585,8 +10585,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10600,8 +10600,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10615,8 +10615,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10630,8 +10630,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10645,8 +10645,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10660,8 +10660,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10675,8 +10675,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10690,8 +10690,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10705,8 +10705,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10720,8 +10720,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10735,8 +10735,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10750,8 +10750,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10765,8 +10765,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10780,8 +10780,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10795,8 +10795,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10810,8 +10810,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -10823,10 +10823,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ANEGQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10838,10 +10838,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ANEGL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10853,10 +10853,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ANOTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10868,10 +10868,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ANOTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10881,11 +10881,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSFQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10896,10 +10896,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSFL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10909,11 +10909,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSRQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10924,10 +10924,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSRL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10938,11 +10938,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQEQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10953,11 +10953,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10968,11 +10968,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQLT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10983,11 +10983,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQGT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -10998,11 +10998,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQLE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11013,11 +11013,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQGE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11028,11 +11028,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQLS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11043,11 +11043,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11058,11 +11058,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11073,11 +11073,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQCS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11088,11 +11088,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLEQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11103,11 +11103,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11118,11 +11118,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLLT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11133,11 +11133,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLGT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11148,11 +11148,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLLE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11163,11 +11163,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLGE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11178,11 +11178,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLLS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11193,11 +11193,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11208,11 +11208,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11223,11 +11223,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLCS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11238,11 +11238,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWEQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11253,11 +11253,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11268,11 +11268,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWLT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11283,11 +11283,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWGT, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11298,11 +11298,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWLE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11313,11 +11313,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWGE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11328,11 +11328,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWLS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11343,11 +11343,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11358,11 +11358,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11373,11 +11373,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWCS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11388,12 +11388,12 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11404,11 +11404,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11419,11 +11419,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11434,11 +11434,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVQCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11449,12 +11449,12 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11465,11 +11465,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11480,11 +11480,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11495,11 +11495,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVLCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11510,12 +11510,12 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11526,11 +11526,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWNE, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11541,11 +11541,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWHI, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11556,11 +11556,11 @@ var opcodeTable = [...]opInfo{ asm: x86.ACMOVWCC, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11572,10 +11572,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSWAPQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11587,10 +11587,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ABSWAPL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11601,10 +11601,10 @@ var opcodeTable = [...]opInfo{ asm: x86.APOPCNTQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11615,10 +11615,10 @@ var opcodeTable = [...]opInfo{ asm: x86.APOPCNTL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11671,7 +11671,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASBBQ, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11681,7 +11681,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASBBL, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11691,7 +11691,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETEQ, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11701,7 +11701,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETNE, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11711,7 +11711,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLT, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11721,7 +11721,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLE, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11731,7 +11731,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETGT, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11741,7 +11741,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETGE, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11751,7 +11751,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETCS, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11761,7 +11761,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLS, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11771,7 +11771,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETHI, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11781,7 +11781,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETCC, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11791,7 +11791,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETOS, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11804,7 +11804,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETEQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11817,7 +11817,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETNE, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11830,7 +11830,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLT, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11843,7 +11843,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLE, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11856,7 +11856,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETGT, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11869,7 +11869,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETGE, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11882,7 +11882,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETCS, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11895,7 +11895,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETLS, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11908,7 +11908,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETHI, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11921,7 +11921,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETCC, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -11933,7 +11933,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ clobbers: 1, // AX outputs: []outputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11945,7 +11945,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ clobbers: 1, // AX outputs: []outputInfo{ - {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11955,7 +11955,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETPC, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11965,7 +11965,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETPS, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11975,7 +11975,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETHI, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11985,7 +11985,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ASETCC, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -11995,10 +11995,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVBQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12008,10 +12008,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVBLZX, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12021,10 +12021,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVWQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12034,10 +12034,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVWLZX, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12047,10 +12047,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVLQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12060,10 +12060,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12075,7 +12075,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12087,7 +12087,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVQ, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12100,7 +12100,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12113,7 +12113,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12126,7 +12126,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12139,7 +12139,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12149,7 +12149,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSL2SS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12162,7 +12162,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSL2SD, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12175,7 +12175,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSQ2SS, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12188,7 +12188,7 @@ var opcodeTable = [...]opInfo{ asm: x86.ACVTSQ2SD, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12226,7 +12226,7 @@ var opcodeTable = [...]opInfo{ argLen: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12241,7 +12241,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12250,7 +12250,7 @@ var opcodeTable = [...]opInfo{ argLen: 1, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12265,7 +12265,7 @@ var opcodeTable = [...]opInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12294,10 +12294,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ALEAQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12310,10 +12310,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ALEAL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12326,10 +12326,10 @@ var opcodeTable = [...]opInfo{ asm: x86.ALEAW, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12343,11 +12343,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12361,11 +12361,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12379,11 +12379,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12396,11 +12396,11 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12413,11 +12413,11 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12430,11 +12430,11 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12447,11 +12447,11 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12464,11 +12464,11 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12481,11 +12481,11 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12498,11 +12498,11 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12515,11 +12515,11 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12532,11 +12532,11 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12549,10 +12549,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVBLZX, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12565,10 +12565,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVBQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12581,10 +12581,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVWLZX, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12597,10 +12597,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVWQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12613,10 +12613,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12629,10 +12629,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVLQSX, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12645,10 +12645,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12661,8 +12661,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVB, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12675,8 +12675,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVW, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12689,8 +12689,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12703,8 +12703,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVQ, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12717,7 +12717,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVUPS, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, outputs: []outputInfo{ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 @@ -12734,7 +12734,7 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -12747,7 +12747,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVUPS, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB }, }, }, @@ -12761,11 +12761,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12779,11 +12779,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12796,11 +12796,11 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12814,11 +12814,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12831,11 +12831,11 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12848,11 +12848,11 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12866,11 +12866,11 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12883,11 +12883,11 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -12901,9 +12901,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12917,9 +12917,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12932,9 +12932,9 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12948,9 +12948,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12963,9 +12963,9 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12978,9 +12978,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -12994,9 +12994,9 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13009,9 +13009,9 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13024,7 +13024,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVB, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13037,7 +13037,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVW, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13050,7 +13050,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13063,7 +13063,7 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13077,8 +13077,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13092,8 +13092,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13106,8 +13106,8 @@ var opcodeTable = [...]opInfo{ scale: 2, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13121,8 +13121,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13135,8 +13135,8 @@ var opcodeTable = [...]opInfo{ scale: 4, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13150,8 +13150,8 @@ var opcodeTable = [...]opInfo{ scale: 1, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13164,8 +13164,8 @@ var opcodeTable = [...]opInfo{ scale: 8, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13202,7 +13202,7 @@ var opcodeTable = [...]opInfo{ clobberFlags: true, call: true, reg: regInfo{ - clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13214,9 +13214,9 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 4}, // DX - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, - clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13227,9 +13227,9 @@ var opcodeTable = [...]opInfo{ call: true, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, - clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 + clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 }, }, { @@ -13272,7 +13272,7 @@ var opcodeTable = [...]opInfo{ argLen: 1, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13292,7 +13292,7 @@ var opcodeTable = [...]opInfo{ rematerializeable: true, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13302,7 +13302,7 @@ var opcodeTable = [...]opInfo{ rematerializeable: true, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13314,7 +13314,7 @@ var opcodeTable = [...]opInfo{ faultOnNilArg0: true, reg: regInfo{ inputs: []inputInfo{ - {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13340,7 +13340,7 @@ var opcodeTable = [...]opInfo{ symEffect: SymNone, reg: regInfo{ outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13414,10 +13414,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVB, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13430,10 +13430,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVL, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13446,10 +13446,10 @@ var opcodeTable = [...]opInfo{ asm: x86.AMOVQ, reg: regInfo{ inputs: []inputInfo{ - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13464,11 +13464,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXCHGB, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13483,11 +13483,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXCHGL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13502,11 +13502,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXCHGQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13522,11 +13522,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXADDL, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13542,11 +13542,11 @@ var opcodeTable = [...]opInfo{ asm: x86.AXADDQ, reg: regInfo{ inputs: []inputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, outputs: []outputInfo{ - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13572,13 +13572,13 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 1}, // AX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13594,13 +13594,13 @@ var opcodeTable = [...]opInfo{ reg: regInfo{ inputs: []inputInfo{ {1, 1}, // AX - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {2, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 + {2, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, clobbers: 1, // AX outputs: []outputInfo{ {1, 0}, - {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 + {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15 }, }, }, @@ -13615,8 +13615,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDB, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13631,8 +13631,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AANDL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13647,8 +13647,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AORB, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -13663,8 +13663,8 @@ var opcodeTable = [...]opInfo{ asm: x86.AORL, reg: regInfo{ inputs: []inputInfo{ - {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 - {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB + {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 + {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB }, }, }, @@ -36173,8 +36173,8 @@ var registersAMD64 = [...]Register{ {11, x86.REG_R11, 10, "R11"}, {12, x86.REG_R12, 11, "R12"}, {13, x86.REG_R13, 12, "R13"}, - {14, x86.REG_R14, 13, "R14"}, - {15, x86.REG_R15, 14, "R15"}, + {14, x86.REGG, -1, "g"}, + {15, x86.REG_R15, 13, "R15"}, {16, x86.REG_X0, -1, "X0"}, {17, x86.REG_X1, -1, "X1"}, {18, x86.REG_X2, -1, "X2"}, @@ -36193,7 +36193,7 @@ var registersAMD64 = [...]Register{ {31, x86.REG_X15, -1, "X15"}, {32, 0, -1, "SB"}, } -var gpRegMaskAMD64 = regMask(65519) +var gpRegMaskAMD64 = regMask(49135) var fpRegMaskAMD64 = regMask(2147418112) var specialRegMaskAMD64 = regMask(2147483648) var framepointerRegAMD64 = int8(5) diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go index 6087874fa9..03498c719c 100644 --- a/src/cmd/compile/internal/ssa/rewriteAMD64.go +++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go @@ -4,6 +4,7 @@ package ssa import "math" +import "cmd/compile/internal/base" import "cmd/compile/internal/types" func rewriteValueAMD64(v *Value) bool { @@ -767,8 +768,7 @@ func rewriteValueAMD64(v *Value) bool { v.Op = OpAMD64LoweredGetClosurePtr return true case OpGetG: - v.Op = OpAMD64LoweredGetG - return true + return rewriteValueAMD64_OpGetG(v) case OpHasCPUFeature: return rewriteValueAMD64_OpHasCPUFeature(v) case OpHmul32: @@ -30126,6 +30126,22 @@ func rewriteValueAMD64_OpFloor(v *Value) bool { return true } } +func rewriteValueAMD64_OpGetG(v *Value) bool { + v_0 := v.Args[0] + // match: (GetG mem) + // cond: !base.Flag.ABIWrap + // result: (LoweredGetG mem) + for { + mem := v_0 + if !(!base.Flag.ABIWrap) { + break + } + v.reset(OpAMD64LoweredGetG) + v.AddArg(mem) + return true + } + return false +} func rewriteValueAMD64_OpHasCPUFeature(v *Value) bool { b := v.Block typ := &b.Func.Config.Types diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index a9456dc9ff..9f15990b13 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -262,6 +262,7 @@ TEXT runtime·gogo(SB), NOSPLIT, $16-8 MOVQ 0(DX), CX // make sure g != nil get_tls(CX) MOVQ DX, g(CX) + MOVQ DX, R14 // set the g register MOVQ gobuf_sp(BX), SP // restore SP MOVQ gobuf_ret(BX), AX MOVQ gobuf_ctxt(BX), DX @@ -298,6 +299,7 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8 MOVQ $runtime·badmcall(SB), AX JMP AX MOVQ SI, g(CX) // g = m->g0 + MOVQ SI, R14 // set the g register MOVQ (g_sched+gobuf_sp)(SI), SP // sp = m->g0->sched.sp PUSHQ AX MOVQ DI, DX @@ -344,6 +346,7 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 // switch to g0 MOVQ DX, g(CX) + MOVQ DX, R14 // set the g register MOVQ (g_sched+gobuf_sp)(DX), BX // make it look like mstart called systemstack on g0, to stop traceback SUBQ $8, BX @@ -824,6 +827,7 @@ settls: TEXT setg_gcc<>(SB),NOSPLIT,$0 get_tls(AX) MOVQ DI, g(AX) + MOVQ DI, R14 // set the g register RET TEXT runtime·abort(SB),NOSPLIT,$0-0 @@ -1368,24 +1372,24 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 // It clobbers FLAGS. It does not clobber any general-purpose registers, // but may clobber others (e.g., SSE registers). // Defined as ABIInternal since it does not use the stack-based Go ABI. -TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$120 +TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$112 // Save the registers clobbered by the fast path. This is slightly // faster than having the caller spill these. - MOVQ R14, 104(SP) - MOVQ R13, 112(SP) + MOVQ R12, 96(SP) + MOVQ R13, 104(SP) // TODO: Consider passing g.m.p in as an argument so they can be shared // across a sequence of write barriers. get_tls(R13) MOVQ g(R13), R13 MOVQ g_m(R13), R13 MOVQ m_p(R13), R13 - MOVQ (p_wbBuf+wbBuf_next)(R13), R14 + MOVQ (p_wbBuf+wbBuf_next)(R13), R12 // Increment wbBuf.next position. - LEAQ 16(R14), R14 - MOVQ R14, (p_wbBuf+wbBuf_next)(R13) - CMPQ R14, (p_wbBuf+wbBuf_end)(R13) + LEAQ 16(R12), R12 + MOVQ R12, (p_wbBuf+wbBuf_next)(R13) + CMPQ R12, (p_wbBuf+wbBuf_end)(R13) // Record the write. - MOVQ AX, -16(R14) // Record value + MOVQ AX, -16(R12) // Record value // Note: This turns bad pointer writes into bad // pointer reads, which could be confusing. We could avoid // reading from obviously bad pointers, which would @@ -1393,12 +1397,12 @@ TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$120 // patch this up in the signal handler, or use XCHG to // combine the read and the write. MOVQ (DI), R13 - MOVQ R13, -8(R14) // Record *slot + MOVQ R13, -8(R12) // Record *slot // Is the buffer full? (flags set in CMPQ above) JEQ flush ret: - MOVQ 104(SP), R14 - MOVQ 112(SP), R13 + MOVQ 96(SP), R12 + MOVQ 104(SP), R13 // Do the write. MOVQ AX, (DI) RET @@ -1428,10 +1432,10 @@ flush: MOVQ R9, 64(SP) MOVQ R10, 72(SP) MOVQ R11, 80(SP) - MOVQ R12, 88(SP) + // R12 already saved // R13 already saved - // R14 already saved - MOVQ R15, 96(SP) + // R14 is g + MOVQ R15, 88(SP) // This takes arguments DI and AX CALL runtime·wbBufFlush(SB) @@ -1447,8 +1451,7 @@ flush: MOVQ 64(SP), R9 MOVQ 72(SP), R10 MOVQ 80(SP), R11 - MOVQ 88(SP), R12 - MOVQ 96(SP), R15 + MOVQ 88(SP), R15 JMP ret // gcWriteBarrierCX is gcWriteBarrier, but with args in DI and CX. diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s index fd41b5690a..7f97025c1a 100644 --- a/src/runtime/race_amd64.s +++ b/src/runtime/race_amd64.s @@ -452,12 +452,13 @@ rest: PUSHQ R15 // Set g = g0. get_tls(R12) - MOVQ g(R12), R13 - MOVQ g_m(R13), R14 - MOVQ m_g0(R14), R15 + MOVQ g(R12), R14 + MOVQ g_m(R14), R13 + MOVQ m_g0(R13), R15 CMPQ R13, R15 JEQ noswitch // branch if already on g0 MOVQ R15, g(R12) // g = m->g0 + MOVQ R15, R14 // set g register PUSHQ RARG1 // func arg PUSHQ RARG0 // func arg CALL runtime·racecallback(SB) diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 37cb8dad03..b0a201fc6f 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -632,6 +632,7 @@ nog1: get_tls(CX) MOVQ R13, g_m(R9) MOVQ R9, g(CX) + MOVQ R9, R14 // set g register CALL runtime·stackcheck(SB) nog2: -- cgit v1.3-5-g9baa From 22f9e1ccbc9db9a1d9ecbadca972264e5ad2f169 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Thu, 4 Feb 2021 11:41:34 -0500 Subject: [dev.regabi] runtime: initialize special registers before sigpanic In case that we are panicking in ABI0 context or external code, special registers are not initialized. Initialized them in injected code before calling sigpanic. TODO: Windows, Plan 9. Change-Id: I0919b80e7cc55463f3dd94f1f63cba305717270a Reviewed-on: https://go-review.googlesource.com/c/go/+/289710 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Jeremy Faller Reviewed-by: Michael Knyszek --- src/runtime/asm.s | 5 +++++ src/runtime/asm_amd64.s | 12 ++++++++++++ src/runtime/signal_amd64.go | 7 +++++-- src/runtime/stubs.go | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm.s b/src/runtime/asm.s index 27d8df9e06..72c744925d 100644 --- a/src/runtime/asm.s +++ b/src/runtime/asm.s @@ -11,3 +11,8 @@ DATA runtime·no_pointers_stackmap+0x00(SB)/4, $2 DATA runtime·no_pointers_stackmap+0x04(SB)/4, $0 GLOBL runtime·no_pointers_stackmap(SB),RODATA, $8 + +#ifndef GOARCH_amd64 +TEXT ·sigpanic0(SB),NOSPLIT,$0-0 + JMP ·sigpanic(SB) +#endif diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 9f15990b13..83c08a52f7 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -1364,6 +1364,18 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 POPQ R15 RET +// Initialize special registers then jump to sigpanic. +// This function is injected from the signal handler for panicking +// signals. It is quite painful to set X15 in the signal context, +// so we do it here. +TEXT ·sigpanic0(SB),NOSPLIT,$0-0 +#ifdef GOEXPERIMENT_REGABI + get_tls(R14) + MOVQ g(R14), R14 + XORPS X15, X15 +#endif + JMP ·sigpanic(SB) + // gcWriteBarrier performs a heap pointer write and informs the GC. // // gcWriteBarrier does NOT follow the Go ABI. It takes two arguments: diff --git a/src/runtime/signal_amd64.go b/src/runtime/signal_amd64.go index 6ab1f758c2..3eeb5e044f 100644 --- a/src/runtime/signal_amd64.go +++ b/src/runtime/signal_amd64.go @@ -65,11 +65,14 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) { pc := uintptr(c.rip()) sp := uintptr(c.rsp()) + // In case we are panicking from external code, we need to initialize + // Go special registers. We inject sigpanic0 (instead of sigpanic), + // which takes care of that. if shouldPushSigpanic(gp, pc, *(*uintptr)(unsafe.Pointer(sp))) { - c.pushCall(funcPC(sigpanic), pc) + c.pushCall(funcPC(sigpanic0), pc) } else { // Not safe to push the call. Just clobber the frame. - c.set_rip(uint64(funcPC(sigpanic))) + c.set_rip(uint64(funcPC(sigpanic0))) } } diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 36bbc8991a..3d1e0c0bb4 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -356,3 +356,7 @@ func duffcopy() // Called from linker-generated .initarray; declared for go vet; do NOT call from Go. func addmoduledata() + +// Injected by the signal handler for panicking signals. On many platforms it just +// jumps to sigpanic. +func sigpanic0() -- cgit v1.3-5-g9baa From 7b0dfb177f3ae81641af898bb5479256fb21fd5d Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Thu, 4 Feb 2021 12:40:04 -0500 Subject: [dev.regabi] runtime: use g register in some assembly functions on AMD64 Now that we have a g register, just use it. Note: functions that can be called from ABI0 context (e.g. morestack) is unchanged. Functions that switch g is also unchanged, because we need to set the new g in both the register and TLS. TODO: other OSes. Change-Id: I692a82a7caa8417ff620a59676a6275f56747b94 Reviewed-on: https://go-review.googlesource.com/c/go/+/289718 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: Michael Knyszek --- src/runtime/asm_amd64.s | 22 ++++++++++++++-------- src/runtime/race_amd64.s | 12 ++++++++++++ src/runtime/sys_linux_amd64.s | 16 ++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 83c08a52f7..93280eee4a 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -585,18 +585,20 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16 MOVQ 0(DX), BX JMP BX // but first run the deferred function -// Save state of caller into g->sched. Smashes R8, R9. +// Save state of caller into g->sched. Smashes R9. TEXT gosave<>(SB),NOSPLIT,$0 - get_tls(R8) - MOVQ g(R8), R8 +#ifndef GOEXPERIMENT_REGABI + get_tls(R14) + MOVQ g(R14), R14 +#endif MOVQ 0(SP), R9 - MOVQ R9, (g_sched+gobuf_pc)(R8) + MOVQ R9, (g_sched+gobuf_pc)(R14) LEAQ 8(SP), R9 - MOVQ R9, (g_sched+gobuf_sp)(R8) - MOVQ $0, (g_sched+gobuf_ret)(R8) - MOVQ BP, (g_sched+gobuf_bp)(R8) + MOVQ R9, (g_sched+gobuf_sp)(R14) + MOVQ $0, (g_sched+gobuf_ret)(R14) + MOVQ BP, (g_sched+gobuf_bp)(R14) // Assert ctxt is zero. See func save. - MOVQ (g_sched+gobuf_ctxt)(R8), R9 + MOVQ (g_sched+gobuf_ctxt)(R14), R9 TESTQ R9, R9 JZ 2(PC) CALL runtime·badctxt(SB) @@ -1391,9 +1393,13 @@ TEXT runtime·gcWriteBarrier(SB),NOSPLIT,$112 MOVQ R13, 104(SP) // TODO: Consider passing g.m.p in as an argument so they can be shared // across a sequence of write barriers. +#ifdef GOEXPERIMENT_REGABI + MOVQ g_m(R14), R13 +#else get_tls(R13) MOVQ g(R13), R13 MOVQ g_m(R13), R13 +#endif MOVQ m_p(R13), R13 MOVQ (p_wbBuf+wbBuf_next)(R13), R12 // Increment wbBuf.next position. diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s index 7f97025c1a..c3b7bbfbfe 100644 --- a/src/runtime/race_amd64.s +++ b/src/runtime/race_amd64.s @@ -146,8 +146,10 @@ TEXT runtime·racewriterangepc1(SB), NOSPLIT, $0-24 // If addr (RARG1) is out of range, do nothing. // Otherwise, setup goroutine context and invoke racecall. Other arguments already set. TEXT racecalladdr<>(SB), NOSPLIT, $0-0 +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_racectx(R14), RARG0 // goroutine context // Check that addr is within [arenastart, arenaend) or within [racedatastart, racedataend). CMPQ RARG1, runtime·racearenastart(SB) @@ -183,8 +185,10 @@ TEXT runtime·racefuncenter(SB), NOSPLIT, $0-8 // R11 = caller's return address TEXT racefuncenter<>(SB), NOSPLIT, $0-0 MOVQ DX, R15 // save function entry context (for closures) +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_racectx(R14), RARG0 // goroutine context MOVQ R11, RARG1 // void __tsan_func_enter(ThreadState *thr, void *pc); @@ -197,8 +201,10 @@ TEXT racefuncenter<>(SB), NOSPLIT, $0-0 // func runtime·racefuncexit() // Called from instrumented code. TEXT runtime·racefuncexit(SB), NOSPLIT, $0-0 +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_racectx(R14), RARG0 // goroutine context // void __tsan_func_exit(ThreadState *thr); MOVQ $__tsan_func_exit(SB), AX @@ -357,8 +363,10 @@ racecallatomic_data: JAE racecallatomic_ignore racecallatomic_ok: // Addr is within the good range, call the atomic function. +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_racectx(R14), RARG0 // goroutine context MOVQ 8(SP), RARG1 // caller pc MOVQ (SP), RARG2 // pc @@ -370,8 +378,10 @@ racecallatomic_ignore: // An attempt to synchronize on the address would cause crash. MOVQ AX, R15 // remember the original function MOVQ $__tsan_go_ignore_sync_begin(SB), AX +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_racectx(R14), RARG0 // goroutine context CALL racecall<>(SB) MOVQ R15, AX // restore the original function @@ -399,8 +409,10 @@ TEXT runtime·racecall(SB), NOSPLIT, $0-0 // Switches SP to g0 stack and calls (AX). Arguments already set. TEXT racecall<>(SB), NOSPLIT, $0-0 +#ifndef GOEXPERIMENT_REGABI get_tls(R12) MOVQ g(R12), R14 +#endif MOVQ g_m(R14), R13 // Switch to g0 stack. MOVQ SP, R12 // callee-saved, preserved across the CALL diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index b0a201fc6f..d48573c2c5 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -215,9 +215,13 @@ TEXT runtime·walltime1(SB),NOSPLIT,$16-12 MOVQ SP, R12 // Save old SP; R12 unchanged by C code. +#ifdef GOEXPERIMENT_REGABI + MOVQ g_m(R14), BX // BX unchanged by C code. +#else get_tls(CX) MOVQ g(CX), AX MOVQ g_m(AX), BX // BX unchanged by C code. +#endif // Set vdsoPC and vdsoSP for SIGPROF traceback. // Save the old values on stack and restore them on exit, @@ -232,7 +236,11 @@ TEXT runtime·walltime1(SB),NOSPLIT,$16-12 MOVQ CX, m_vdsoPC(BX) MOVQ DX, m_vdsoSP(BX) +#ifdef GOEXPERIMENT_REGABI + CMPQ R14, m_curg(BX) // Only switch if on curg. +#else CMPQ AX, m_curg(BX) // Only switch if on curg. +#endif JNE noswitch MOVQ m_g0(BX), DX @@ -275,9 +283,13 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16-8 MOVQ SP, R12 // Save old SP; R12 unchanged by C code. +#ifdef GOEXPERIMENT_REGABI + MOVQ g_m(R14), BX // BX unchanged by C code. +#else get_tls(CX) MOVQ g(CX), AX MOVQ g_m(AX), BX // BX unchanged by C code. +#endif // Set vdsoPC and vdsoSP for SIGPROF traceback. // Save the old values on stack and restore them on exit, @@ -292,7 +304,11 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16-8 MOVQ CX, m_vdsoPC(BX) MOVQ DX, m_vdsoSP(BX) +#ifdef GOEXPERIMENT_REGABI + CMPQ R14, m_curg(BX) // Only switch if on curg. +#else CMPQ AX, m_curg(BX) // Only switch if on curg. +#endif JNE noswitch MOVQ m_g0(BX), DX -- cgit v1.3-5-g9baa From c9d6f45fec19a9cb66ddd89d61bfa982f5bf4afe Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 7 Feb 2021 15:25:39 -0800 Subject: runtime/metrics: fix a couple of documentation typpos Fixes #44150 Change-Id: Ibe5bfba01491dd8c2f0696fab40a1673230d76e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/290349 Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Dmitri Shuralyov Reviewed-by: Michael Knyszek --- src/runtime/metrics/doc.go | 7 ++++--- src/runtime/metrics/sample.go | 6 +++--- src/runtime/metrics/value.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go index 021a0bddca..5da050f973 100644 --- a/src/runtime/metrics/doc.go +++ b/src/runtime/metrics/doc.go @@ -16,13 +16,14 @@ Interface Metrics are designated by a string key, rather than, for example, a field name in a struct. The full list of supported metrics is always available in the slice of Descriptions returned by All. Each Description also includes useful information -about the metric, such as how to display it (e.g. gauge vs. counter) and how difficult -or disruptive it is to obtain it (e.g. do you need to stop the world?). +about the metric, such as how to display it (for example, gauge vs. counter) +and how difficult or disruptive it is to obtain it (for example, do you need to +stop the world?). Thus, users of this API are encouraged to sample supported metrics defined by the slice returned by All to remain compatible across Go versions. Of course, situations arise where reading specific metrics is critical. For these cases, users are -encouranged to use build tags, and although metrics may be deprecated and removed, +encouraged to use build tags, and although metrics may be deprecated and removed, users should consider this to be an exceptional and rare event, coinciding with a very large change in a particular Go implementation. diff --git a/src/runtime/metrics/sample.go b/src/runtime/metrics/sample.go index 35534dd70d..b3933e266e 100644 --- a/src/runtime/metrics/sample.go +++ b/src/runtime/metrics/sample.go @@ -32,9 +32,9 @@ func runtime_readMetrics(unsafe.Pointer, int, int) // // Note that re-use has some caveats. Notably, Values should not be read or // manipulated while a Read with that value is outstanding; that is a data race. -// This property includes pointer-typed Values (e.g. Float64Histogram) whose -// underlying storage will be reused by Read when possible. To safely use such -// values in a concurrent setting, all data must be deep-copied. +// This property includes pointer-typed Values (for example, Float64Histogram) +// whose underlying storage will be reused by Read when possible. To safely use +// such values in a concurrent setting, all data must be deep-copied. // // It is safe to execute multiple Read calls concurrently, but their arguments // must share no underlying memory. When in doubt, create a new []Sample from diff --git a/src/runtime/metrics/value.go b/src/runtime/metrics/value.go index 61e8a192a3..ed9a33d87c 100644 --- a/src/runtime/metrics/value.go +++ b/src/runtime/metrics/value.go @@ -33,7 +33,7 @@ type Value struct { pointer unsafe.Pointer // contains non-scalar values. } -// Kind returns the a tag representing the kind of value this is. +// Kind returns the tag representing the kind of value this is. func (v Value) Kind() ValueKind { return v.kind } -- cgit v1.3-5-g9baa From e0215315f51c62f6d2c5ea5ed7008b7e7963dd5d Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Thu, 22 Oct 2020 16:29:04 +0000 Subject: [dev.regabi] reflect: support for register ABI on amd64 for reflect.(Value).Call This change adds support for the new register ABI on amd64 to reflect.(Value).Call. If internal/abi's register counts are non-zero, reflect will try to set up arguments in registers on the Call path. Note that because the register ABI becomes ABI0 with zero registers available, this should keep working as it did before. This change does not add any tests for the register ABI case because there's no way to do so at the moment. For #40724. Change-Id: I8aa089a5aa5a31b72e56b3d9388dd3f82203985b Reviewed-on: https://go-review.googlesource.com/c/go/+/272568 Trust: Michael Knyszek Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Cherry Zhang Reviewed-by: Than McIntosh --- src/go/build/deps_test.go | 6 +- src/internal/abi/abi.go | 45 ++++- src/reflect/abi.go | 403 +++++++++++++++++++++++++++++++++++++++++ src/reflect/export_test.go | 12 +- src/reflect/makefunc.go | 10 +- src/reflect/type.go | 61 ++----- src/reflect/value.go | 249 +++++++++++++++++++------ src/runtime/asm_386.s | 23 +-- src/runtime/asm_amd64.s | 100 ++++++++-- src/runtime/asm_arm.s | 24 +-- src/runtime/asm_arm64.s | 23 +-- src/runtime/asm_mips64x.s | 23 +-- src/runtime/asm_mipsx.s | 23 +-- src/runtime/asm_ppc64x.s | 23 +-- src/runtime/asm_riscv64.s | 27 +-- src/runtime/asm_s390x.s | 23 +-- src/runtime/asm_wasm.s | 23 +-- src/runtime/mbarrier.go | 10 +- src/runtime/mfinal.go | 7 +- src/runtime/panic.go | 13 +- src/runtime/stubs.go | 56 ++++-- src/runtime/syscall_windows.go | 7 +- 22 files changed, 950 insertions(+), 241 deletions(-) create mode 100644 src/reflect/abi.go (limited to 'src/runtime') diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go index 3fea5ecf0d..e5c849e8f5 100644 --- a/src/go/build/deps_test.go +++ b/src/go/build/deps_test.go @@ -71,11 +71,15 @@ var depsRules = ` # No dependencies allowed for any of these packages. NONE < container/list, container/ring, - internal/abi, internal/cfg, internal/cpu, + internal/cfg, internal/cpu, internal/goversion, internal/nettrace, unicode/utf8, unicode/utf16, unicode, unsafe; + # These packages depend only on unsafe. + unsafe + < internal/abi; + # RUNTIME is the core runtime group of packages, all of them very light-weight. internal/abi, internal/cpu, unsafe < internal/bytealg diff --git a/src/internal/abi/abi.go b/src/internal/abi/abi.go index 07ea51df8f..6700facc04 100644 --- a/src/internal/abi/abi.go +++ b/src/internal/abi/abi.go @@ -4,9 +4,50 @@ package abi +import "unsafe" + // RegArgs is a struct that has space for each argument // and return value register on the current architecture. +// +// Assembly code knows the layout of the first two fields +// of RegArgs. +// +// RegArgs also contains additional space to hold pointers +// when it may not be safe to keep them only in the integer +// register space otherwise. type RegArgs struct { - Ints [IntArgRegs]uintptr - Floats [FloatArgRegs]uint64 + Ints [IntArgRegs]uintptr // untyped integer registers + Floats [FloatArgRegs]uint64 // untyped float registers + + // Fields above this point are known to assembly. + + // Ptrs is a space that duplicates Ints but with pointer type, + // used to make pointers passed or returned in registers + // visible to the GC by making the type unsafe.Pointer. + Ptrs [IntArgRegs]unsafe.Pointer + + // ReturnIsPtr is a bitmap that indicates which registers + // contain or will contain pointers on the return path from + // a reflectcall. The i'th bit indicates whether the i'th + // register contains or will contain a valid Go pointer. + ReturnIsPtr IntArgRegBitmap +} + +// IntArgRegBitmap is a bitmap large enough to hold one bit per +// integer argument/return register. +type IntArgRegBitmap [(IntArgRegs + 7) / 8]uint8 + +// Set sets the i'th bit of the bitmap to 1. +func (b *IntArgRegBitmap) Set(i int) { + b[i/8] |= uint8(1) << (i % 8) +} + +// Get returns whether the i'th bit of the bitmap is set. +// +// nosplit because it's called in extremely sensitive contexts, like +// on the reflectcall return path. +// +//go:nosplit +func (b *IntArgRegBitmap) Get(i int) bool { + return b[i/8]&(uint8(1)<<(i%8)) != 0 } diff --git a/src/reflect/abi.go b/src/reflect/abi.go new file mode 100644 index 0000000000..88af212717 --- /dev/null +++ b/src/reflect/abi.go @@ -0,0 +1,403 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package reflect + +import ( + "internal/abi" + "unsafe" +) + +// abiStep represents an ABI "instruction." Each instruction +// describes one part of how to translate between a Go value +// in memory and a call frame. +type abiStep struct { + kind abiStepKind + + // offset and size together describe a part of a Go value + // in memory. + offset uintptr + size uintptr // size in bytes of the part + + // These fields describe the ABI side of the translation. + stkOff uintptr // stack offset, used if kind == abiStepStack + ireg int // integer register index, used if kind == abiStepIntReg or kind == abiStepPointer + freg int // FP register index, used if kind == abiStepFloatReg +} + +// abiStepKind is the "op-code" for an abiStep instruction. +type abiStepKind int + +const ( + abiStepBad abiStepKind = iota + abiStepStack // copy to/from stack + abiStepIntReg // copy to/from integer register + abiStepPointer // copy pointer to/from integer register + abiStepFloatReg // copy to/from FP register +) + +// abiSeq represents a sequence of ABI instructions for copying +// from a series of reflect.Values to a call frame (for call arguments) +// or vice-versa (for call results). +// +// An abiSeq should be populated by calling its addArg method. +type abiSeq struct { + // steps is the set of instructions. + // + // The instructions are grouped together by whole arguments, + // with the starting index for the instructions + // of the i'th Go value available in valueStart. + // + // For instance, if this abiSeq represents 3 arguments + // passed to a function, then the 2nd argument's steps + // begin at steps[valueStart[1]]. + // + // Because reflect accepts Go arguments in distinct + // Values and each Value is stored separately, each abiStep + // that begins a new argument will have its offset + // field == 0. + steps []abiStep + valueStart []int + + stackBytes uintptr // stack space used + iregs, fregs int // registers used +} + +func (a *abiSeq) dump() { + for i, p := range a.steps { + println("part", i, p.kind, p.offset, p.size, p.stkOff, p.ireg, p.freg) + } + print("values ") + for _, i := range a.valueStart { + print(i, " ") + } + println() + println("stack", a.stackBytes) + println("iregs", a.iregs) + println("fregs", a.fregs) +} + +// stepsForValue returns the ABI instructions for translating +// the i'th Go argument or return value represented by this +// abiSeq to the Go ABI. +func (a *abiSeq) stepsForValue(i int) []abiStep { + s := a.valueStart[i] + var e int + if i == len(a.valueStart)-1 { + e = len(a.steps) + } else { + e = a.valueStart[i+1] + } + return a.steps[s:e] +} + +// addArg extends the abiSeq with a new Go value of type t. +// +// If the value was stack-assigned, returns the single +// abiStep describing that translation, and nil otherwise. +func (a *abiSeq) addArg(t *rtype) *abiStep { + pStart := len(a.steps) + a.valueStart = append(a.valueStart, pStart) + if !a.regAssign(t, 0) { + a.steps = a.steps[:pStart] + a.stackAssign(t.size, uintptr(t.align)) + return &a.steps[len(a.steps)-1] + } + return nil +} + +// addRcvr extends the abiSeq with a new method call +// receiver according to the interface calling convention. +// +// If the receiver was stack-assigned, returns the single +// abiStep describing that translation, and nil otherwise. +// Returns true if the receiver is a pointer. +func (a *abiSeq) addRcvr(rcvr *rtype) (*abiStep, bool) { + // The receiver is always one word. + a.valueStart = append(a.valueStart, len(a.steps)) + var ok, ptr bool + if ifaceIndir(rcvr) || rcvr.pointers() { + ok = a.assignIntN(0, ptrSize, 1, 0b1) + ptr = true + } else { + // TODO(mknyszek): Is this case even possible? + // The interface data work never contains a non-pointer + // value. This case was copied over from older code + // in the reflect package which only conditionally added + // a pointer bit to the reflect.(Value).Call stack frame's + // GC bitmap. + ok = a.assignIntN(0, ptrSize, 1, 0b0) + ptr = false + } + if !ok { + a.stackAssign(ptrSize, ptrSize) + return &a.steps[len(a.steps)-1], ptr + } + return nil, ptr +} + +// regAssign attempts to reserve argument registers for a value of +// type t, stored at some offset. +// +// It returns whether or not the assignment succeeded, but +// leaves any changes it made to a.steps behind, so the caller +// must undo that work by adjusting a.steps if it fails. +// +// This method along with the assign* methods represent the +// complete register-assignment algorithm for the Go ABI. +func (a *abiSeq) regAssign(t *rtype, offset uintptr) bool { + switch t.Kind() { + case UnsafePointer, Ptr, Chan, Map, Func: + return a.assignIntN(offset, t.size, 1, 0b1) + case Bool, Int, Uint, Int8, Uint8, Int16, Uint16, Int32, Uint32, Uintptr: + return a.assignIntN(offset, t.size, 1, 0b0) + case Int64, Uint64: + switch ptrSize { + case 4: + return a.assignIntN(offset, 4, 2, 0b0) + case 8: + return a.assignIntN(offset, 8, 1, 0b0) + } + case Float32, Float64: + return a.assignFloatN(offset, t.size, 1) + case Complex64: + return a.assignFloatN(offset, 4, 2) + case Complex128: + return a.assignFloatN(offset, 8, 2) + case String: + return a.assignIntN(offset, ptrSize, 2, 0b01) + case Interface: + return a.assignIntN(offset, ptrSize, 2, 0b10) + case Slice: + return a.assignIntN(offset, ptrSize, 3, 0b001) + case Array: + tt := (*arrayType)(unsafe.Pointer(t)) + switch tt.len { + case 0: + // There's nothing to assign, so don't modify + // a.steps but succeed so the caller doesn't + // try to stack-assign this value. + return true + case 1: + return a.regAssign(tt.elem, offset) + default: + return false + } + case Struct: + if t.size == 0 { + // There's nothing to assign, so don't modify + // a.steps but succeed so the caller doesn't + // try to stack-assign this value. + return true + } + st := (*structType)(unsafe.Pointer(t)) + for i := range st.fields { + f := &st.fields[i] + if f.typ.Size() == 0 { + // Ignore zero-sized fields. + continue + } + if !a.regAssign(f.typ, offset+f.offset()) { + return false + } + } + return true + default: + print("t.Kind == ", t.Kind(), "\n") + panic("unknown type kind") + } + panic("unhandled register assignment path") +} + +// assignIntN assigns n values to registers, each "size" bytes large, +// from the data at [offset, offset+n*size) in memory. Each value at +// [offset+i*size, offset+(i+1)*size) for i < n is assigned to the +// next n integer registers. +// +// Bit i in ptrMap indicates whether the i'th value is a pointer. +// n must be <= 8. +// +// Returns whether assignment succeeded. +func (a *abiSeq) assignIntN(offset, size uintptr, n int, ptrMap uint8) bool { + if n > 8 || n < 0 { + panic("invalid n") + } + if ptrMap != 0 && size != ptrSize { + panic("non-empty pointer map passed for non-pointer-size values") + } + if a.iregs+n > abi.IntArgRegs { + return false + } + for i := 0; i < n; i++ { + kind := abiStepIntReg + if ptrMap&(uint8(1)< abi.FloatArgRegs || abi.EffectiveFloatRegSize < size { + return false + } + for i := 0; i < n; i++ { + a.steps = append(a.steps, abiStep{ + kind: abiStepFloatReg, + offset: offset + uintptr(i)*size, + size: size, + freg: a.fregs, + }) + a.fregs++ + } + return true +} + +// stackAssign reserves space for one value that is "size" bytes +// large with alignment "alignment" to the stack. +// +// Should not be called directly; use addArg instead. +func (a *abiSeq) stackAssign(size, alignment uintptr) { + a.stackBytes = align(a.stackBytes, alignment) + a.steps = append(a.steps, abiStep{ + kind: abiStepStack, + offset: 0, // Only used for whole arguments, so the memory offset is 0. + size: size, + stkOff: a.stackBytes, + }) + a.stackBytes += size +} + +// abiDesc describes the ABI for a function or method. +type abiDesc struct { + // call and ret represent the translation steps for + // the call and return paths of a Go function. + call, ret abiSeq + + // These fields describe the stack space allocated + // for the call. stackCallArgsSize is the amount of space + // reserved for arguments but not return values. retOffset + // is the offset at which return values begin, and + // spill is the size in bytes of additional space reserved + // to spill argument registers into in case of preemption in + // reflectcall's stack frame. + stackCallArgsSize, retOffset, spill uintptr + + // stackPtrs is a bitmap that indicates whether + // each word in the ABI stack space (stack-assigned + // args + return values) is a pointer. Used + // as the heap pointer bitmap for stack space + // passed to reflectcall. + stackPtrs *bitVector + + // outRegPtrs is a bitmap whose i'th bit indicates + // whether the i'th integer result register contains + // a pointer. Used by reflectcall to make result + // pointers visible to the GC. + outRegPtrs abi.IntArgRegBitmap +} + +func (a *abiDesc) dump() { + println("ABI") + println("call") + a.call.dump() + println("ret") + a.ret.dump() + println("stackCallArgsSize", a.stackCallArgsSize) + println("retOffset", a.retOffset) + println("spill", a.spill) +} + +func newAbiDesc(t *funcType, rcvr *rtype) abiDesc { + // We need to add space for this argument to + // the frame so that it can spill args into it. + // + // The size of this space is just the sum of the sizes + // of each register-allocated type. + // + // TODO(mknyszek): Remove this when we no longer have + // caller reserved spill space. + spillInt := uintptr(0) + spillFloat := uintptr(0) + + // Compute gc program & stack bitmap for stack arguments + stackPtrs := new(bitVector) + + // Compute abiSeq for input parameters. + var in abiSeq + if rcvr != nil { + stkStep, isPtr := in.addRcvr(rcvr) + if stkStep != nil { + if isPtr { + stackPtrs.append(1) + } else { + stackPtrs.append(0) + } + } else { + spillInt += ptrSize + } + } + for _, arg := range t.in() { + i, f := in.iregs, in.fregs + stkStep := in.addArg(arg) + if stkStep != nil { + addTypeBits(stackPtrs, stkStep.stkOff, arg) + } else { + i, f = in.iregs-i, in.fregs-f + spillInt += uintptr(i) * ptrSize + spillFloat += uintptr(f) * abi.EffectiveFloatRegSize + } + } + spill := align(spillInt+spillFloat, ptrSize) + + // From the input parameters alone, we now know + // the stackCallArgsSize and retOffset. + stackCallArgsSize := in.stackBytes + retOffset := align(in.stackBytes, ptrSize) + + // Compute the stack frame pointer bitmap and register + // pointer bitmap for return values. + outRegPtrs := abi.IntArgRegBitmap{} + + // Compute abiSeq for output parameters. + var out abiSeq + // Stack-assigned return values do not share + // space with arguments like they do with registers, + // so we need to inject a stack offset here. + // Fake it by artifically extending stackBytes by + // the return offset. + out.stackBytes = retOffset + for i, res := range t.out() { + stkStep := out.addArg(res) + if stkStep != nil { + addTypeBits(stackPtrs, stkStep.stkOff, res) + } else { + for _, st := range out.stepsForValue(i) { + if st.kind == abiStepPointer { + outRegPtrs.Set(st.ireg) + } + } + } + } + // Undo the faking from earlier so that stackBytes + // is accurate. + out.stackBytes -= retOffset + return abiDesc{in, out, stackCallArgsSize, retOffset, spill, stackPtrs, outRegPtrs} +} diff --git a/src/reflect/export_test.go b/src/reflect/export_test.go index de426b58a8..ddcfca9dee 100644 --- a/src/reflect/export_test.go +++ b/src/reflect/export_test.go @@ -23,15 +23,17 @@ const PtrSize = ptrSize func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr, stack []byte, gc []byte, ptrs bool) { var ft *rtype - var s *bitVector + var abi abiDesc if rcvr != nil { - ft, argSize, retOffset, s, _ = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), rcvr.(*rtype)) + ft, _, abi = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), rcvr.(*rtype)) } else { - ft, argSize, retOffset, s, _ = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), nil) + ft, _, abi = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), nil) } + argSize = abi.stackCallArgsSize + retOffset = abi.retOffset frametype = ft - for i := uint32(0); i < s.n; i++ { - stack = append(stack, s.data[i/8]>>(i%8)&1) + for i := uint32(0); i < abi.stackPtrs.n; i++ { + stack = append(stack, abi.stackPtrs.data[i/8]>>(i%8)&1) } if ft.kind&kindGCProg != 0 { panic("can't handle gc programs") diff --git a/src/reflect/makefunc.go b/src/reflect/makefunc.go index 67dc4859b9..e17d4ea758 100644 --- a/src/reflect/makefunc.go +++ b/src/reflect/makefunc.go @@ -60,9 +60,9 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value { code := **(**uintptr)(unsafe.Pointer(&dummy)) // makeFuncImpl contains a stack map for use by the runtime - _, argLen, _, stack, _ := funcLayout(ftyp, nil) + _, _, abi := funcLayout(ftyp, nil) - impl := &makeFuncImpl{code: code, stack: stack, argLen: argLen, ftyp: ftyp, fn: fn} + impl := &makeFuncImpl{code: code, stack: abi.stackPtrs, argLen: abi.stackCallArgsSize, ftyp: ftyp, fn: fn} return Value{t, unsafe.Pointer(impl), flag(Func)} } @@ -112,12 +112,12 @@ func makeMethodValue(op string, v Value) Value { code := **(**uintptr)(unsafe.Pointer(&dummy)) // methodValue contains a stack map for use by the runtime - _, argLen, _, stack, _ := funcLayout(ftyp, nil) + _, _, abi := funcLayout(ftyp, nil) fv := &methodValue{ fn: code, - stack: stack, - argLen: argLen, + stack: abi.stackPtrs, + argLen: abi.stackCallArgsSize, method: int(v.flag) >> flagMethodShift, rcvr: rcvr, } diff --git a/src/reflect/type.go b/src/reflect/type.go index d323828c74..d52816628f 100644 --- a/src/reflect/type.go +++ b/src/reflect/type.go @@ -2984,21 +2984,20 @@ type layoutKey struct { type layoutType struct { t *rtype - argSize uintptr // size of arguments - retOffset uintptr // offset of return values. - stack *bitVector framePool *sync.Pool + abi abiDesc } var layoutCache sync.Map // map[layoutKey]layoutType // funcLayout computes a struct type representing the layout of the -// function arguments and return values for the function type t. +// stack-assigned function arguments and return values for the function +// type t. // If rcvr != nil, rcvr specifies the type of the receiver. // The returned type exists only for GC, so we only fill out GC relevant info. // Currently, that's just size and the GC program. We also fill in // the name for possible debugging use. -func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset uintptr, stk *bitVector, framePool *sync.Pool) { +func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, framePool *sync.Pool, abi abiDesc) { if t.Kind() != Func { panic("reflect: funcLayout of non-func type " + t.String()) } @@ -3008,46 +3007,24 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset k := layoutKey{t, rcvr} if lti, ok := layoutCache.Load(k); ok { lt := lti.(layoutType) - return lt.t, lt.argSize, lt.retOffset, lt.stack, lt.framePool + return lt.t, lt.framePool, lt.abi } - // compute gc program & stack bitmap for arguments - ptrmap := new(bitVector) - var offset uintptr - if rcvr != nil { - // Reflect uses the "interface" calling convention for - // methods, where receivers take one word of argument - // space no matter how big they actually are. - if ifaceIndir(rcvr) || rcvr.pointers() { - ptrmap.append(1) - } else { - ptrmap.append(0) - } - offset += ptrSize - } - for _, arg := range t.in() { - offset += -offset & uintptr(arg.align-1) - addTypeBits(ptrmap, offset, arg) - offset += arg.size - } - argSize = offset - offset += -offset & (ptrSize - 1) - retOffset = offset - for _, res := range t.out() { - offset += -offset & uintptr(res.align-1) - addTypeBits(ptrmap, offset, res) - offset += res.size - } - offset += -offset & (ptrSize - 1) + // Compute the ABI layout. + abi = newAbiDesc(t, rcvr) // build dummy rtype holding gc program x := &rtype{ - align: ptrSize, - size: offset, - ptrdata: uintptr(ptrmap.n) * ptrSize, + align: ptrSize, + // Don't add spill space here; it's only necessary in + // reflectcall's frame, not in the allocated frame. + // TODO(mknyszek): Remove this comment when register + // spill space in the frame is no longer required. + size: align(abi.retOffset+abi.ret.stackBytes, ptrSize), + ptrdata: uintptr(abi.stackPtrs.n) * ptrSize, } - if ptrmap.n > 0 { - x.gcdata = &ptrmap.data[0] + if abi.stackPtrs.n > 0 { + x.gcdata = &abi.stackPtrs.data[0] } var s string @@ -3064,13 +3041,11 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset }} lti, _ := layoutCache.LoadOrStore(k, layoutType{ t: x, - argSize: argSize, - retOffset: retOffset, - stack: ptrmap, framePool: framePool, + abi: abi, }) lt := lti.(layoutType) - return lt.t, lt.argSize, lt.retOffset, lt.stack, lt.framePool + return lt.t, lt.framePool, lt.abi } // ifaceIndir reports whether t is stored indirectly in an interface value. diff --git a/src/reflect/value.go b/src/reflect/value.go index 1f185b52e4..eae1b9bf29 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -5,6 +5,7 @@ package reflect import ( + "internal/abi" "internal/unsafeheader" "math" "runtime" @@ -352,6 +353,8 @@ func (v Value) CallSlice(in []Value) []Value { var callGC bool // for testing; see TestCallMethodJump +const debugReflectCall = false + func (v Value) call(op string, in []Value) []Value { // Get function pointer, type. t := (*funcType)(unsafe.Pointer(v.typ)) @@ -430,50 +433,112 @@ func (v Value) call(op string, in []Value) []Value { } nout := t.NumOut() + // Register argument space. + var regArgs abi.RegArgs + // Compute frame type. - frametype, _, retOffset, _, framePool := funcLayout(t, rcvrtype) + frametype, framePool, abi := funcLayout(t, rcvrtype) - // Allocate a chunk of memory for frame. - var args unsafe.Pointer - if nout == 0 { - args = framePool.Get().(unsafe.Pointer) - } else { - // Can't use pool if the function has return values. - // We will leak pointer to args in ret, so its lifetime is not scoped. - args = unsafe_New(frametype) + // Allocate a chunk of memory for frame if needed. + var stackArgs unsafe.Pointer + if frametype.size != 0 { + if nout == 0 { + stackArgs = framePool.Get().(unsafe.Pointer) + } else { + // Can't use pool if the function has return values. + // We will leak pointer to args in ret, so its lifetime is not scoped. + stackArgs = unsafe_New(frametype) + } + } + frameSize := frametype.size + + if debugReflectCall { + println("reflect.call", t.String()) + abi.dump() } - off := uintptr(0) // Copy inputs into args. + + // Handle receiver. + inStart := 0 if rcvrtype != nil { - storeRcvr(rcvr, args) - off = ptrSize + // Guaranteed to only be one word in size, + // so it will only take up exactly 1 abiStep (either + // in a register or on the stack). + switch st := abi.call.steps[0]; st.kind { + case abiStepStack: + storeRcvr(rcvr, stackArgs) + case abiStepIntReg, abiStepPointer: + // Even pointers can go into the uintptr slot because + // they'll be kept alive by the Values referenced by + // this frame. Reflection forces these to be heap-allocated, + // so we don't need to worry about stack copying. + storeRcvr(rcvr, unsafe.Pointer(®Args.Ints[st.ireg])) + case abiStepFloatReg: + storeRcvr(rcvr, unsafe.Pointer(®Args.Floats[st.freg])) + default: + panic("unknown ABI parameter kind") + } + inStart = 1 } + + // Handle arguments. for i, v := range in { v.mustBeExported() targ := t.In(i).(*rtype) - a := uintptr(targ.align) - off = (off + a - 1) &^ (a - 1) - n := targ.size - if n == 0 { - // Not safe to compute args+off pointing at 0 bytes, - // because that might point beyond the end of the frame, - // but we still need to call assignTo to check assignability. - v.assignTo("reflect.Value.Call", targ, nil) - continue - } - addr := add(args, off, "n > 0") - v = v.assignTo("reflect.Value.Call", targ, addr) - if v.flag&flagIndir != 0 { - typedmemmove(targ, addr, v.ptr) - } else { - *(*unsafe.Pointer)(addr) = v.ptr + // TODO(mknyszek): Figure out if it's possible to get some + // scratch space for this assignment check. Previously, it + // was possible to use space in the argument frame. + v = v.assignTo("reflect.Value.Call", targ, nil) + stepsLoop: + for _, st := range abi.call.stepsForValue(i + inStart) { + switch st.kind { + case abiStepStack: + // Copy values to the "stack." + addr := add(stackArgs, st.stkOff, "precomputed stack arg offset") + if v.flag&flagIndir != 0 { + typedmemmove(targ, addr, v.ptr) + } else { + *(*unsafe.Pointer)(addr) = v.ptr + } + // There's only one step for a stack-allocated value. + break stepsLoop + case abiStepIntReg, abiStepPointer: + // Copy values to "integer registers." + if v.flag&flagIndir != 0 { + offset := add(v.ptr, st.offset, "precomputed value offset") + memmove(unsafe.Pointer(®Args.Ints[st.ireg]), offset, st.size) + } else { + if st.kind == abiStepPointer { + // Duplicate this pointer in the pointer area of the + // register space. Otherwise, there's the potential for + // this to be the last reference to v.ptr. + regArgs.Ptrs[st.ireg] = v.ptr + } + regArgs.Ints[st.ireg] = uintptr(v.ptr) + } + case abiStepFloatReg: + // Copy values to "float registers." + if v.flag&flagIndir == 0 { + panic("attempted to copy pointer to FP register") + } + offset := add(v.ptr, st.offset, "precomputed value offset") + memmove(unsafe.Pointer(®Args.Floats[st.freg]), offset, st.size) + default: + panic("unknown ABI part kind") + } } - off += n } + // TODO(mknyszek): Remove this when we no longer have + // caller reserved spill space. + frameSize = align(frameSize, ptrSize) + frameSize += abi.spill + + // Mark pointers in registers for the return path. + regArgs.ReturnIsPtr = abi.outRegPtrs // Call. - call(frametype, fn, args, uint32(frametype.size), uint32(retOffset)) + call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abi.retOffset), uint32(frameSize), ®Args) // For testing; see TestCallMethodJump. if callGC { @@ -482,34 +547,82 @@ func (v Value) call(op string, in []Value) []Value { var ret []Value if nout == 0 { - typedmemclr(frametype, args) - framePool.Put(args) + if stackArgs != nil { + typedmemclr(frametype, stackArgs) + framePool.Put(stackArgs) + } } else { - // Zero the now unused input area of args, - // because the Values returned by this function contain pointers to the args object, - // and will thus keep the args object alive indefinitely. - typedmemclrpartial(frametype, args, 0, retOffset) + if stackArgs != nil { + // Zero the now unused input area of args, + // because the Values returned by this function contain pointers to the args object, + // and will thus keep the args object alive indefinitely. + typedmemclrpartial(frametype, stackArgs, 0, abi.retOffset) + } // Wrap Values around return values in args. ret = make([]Value, nout) - off = retOffset for i := 0; i < nout; i++ { tv := t.Out(i) - a := uintptr(tv.Align()) - off = (off + a - 1) &^ (a - 1) - if tv.Size() != 0 { + if tv.Size() == 0 { + // For zero-sized return value, args+off may point to the next object. + // In this case, return the zero value instead. + ret[i] = Zero(tv) + continue + } + steps := abi.ret.stepsForValue(i) + if st := steps[0]; st.kind == abiStepStack { + // This value is on the stack. If part of a value is stack + // allocated, the entire value is according to the ABI. So + // just make an indirection into the allocated frame. fl := flagIndir | flag(tv.Kind()) - ret[i] = Value{tv.common(), add(args, off, "tv.Size() != 0"), fl} + ret[i] = Value{tv.common(), add(stackArgs, st.stkOff, "tv.Size() != 0"), fl} // Note: this does introduce false sharing between results - // if any result is live, they are all live. // (And the space for the args is live as well, but as we've // cleared that space it isn't as big a deal.) - } else { - // For zero-sized return value, args+off may point to the next object. - // In this case, return the zero value instead. - ret[i] = Zero(tv) + continue + } + + // Handle pointers passed in registers. + if !ifaceIndir(tv.common()) { + // Pointer-valued data gets put directly + // into v.ptr. + if steps[0].kind != abiStepPointer { + print("kind=", steps[0].kind, ", type=", tv.String(), "\n") + panic("mismatch between ABI description and types") + } + ret[i] = Value{tv.common(), regArgs.Ptrs[steps[0].ireg], flag(t.Kind())} + continue + } + + // All that's left is values passed in registers that we need to + // create space for and copy values back into. + // + // TODO(mknyszek): We make a new allocation for each register-allocated + // value, but previously we could always point into the heap-allocated + // stack frame. This is a regression that could be fixed by adding + // additional space to the allocated stack frame and storing the + // register-allocated return values into the allocated stack frame and + // referring there in the resulting Value. + s := unsafe_New(tv.common()) + for _, st := range steps { + switch st.kind { + case abiStepIntReg: + offset := add(s, st.offset, "precomputed value offset") + memmove(offset, unsafe.Pointer(®Args.Ints[st.ireg]), st.size) + case abiStepPointer: + s := add(s, st.offset, "precomputed value offset") + *((*unsafe.Pointer)(s)) = regArgs.Ptrs[st.ireg] + case abiStepFloatReg: + offset := add(s, st.offset, "precomputed value offset") + memmove(offset, unsafe.Pointer(®Args.Floats[st.freg]), st.size) + case abiStepStack: + panic("register-based return value has stack component") + default: + panic("unknown ABI part kind") + } } - off += tv.Size() + ret[i] = Value{tv.common(), s, flagIndir | flag(tv.Kind())} } } @@ -709,7 +822,8 @@ func align(x, n uintptr) uintptr { func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) { rcvr := ctxt.rcvr rcvrtype, t, fn := methodReceiver("call", rcvr, ctxt.method) - frametype, argSize, retOffset, _, framePool := funcLayout(t, rcvrtype) + frametype, framePool, abid := funcLayout(t, rcvrtype) + argSize, retOffset := abid.stackCallArgsSize, abid.retOffset // Make a new frame that is one word bigger so we can store the receiver. // This space is used for both arguments and return values. @@ -727,10 +841,19 @@ func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) { typedmemmovepartial(frametype, add(scratch, argOffset, "argSize > argOffset"), frame, argOffset, argSize-argOffset) } + frameSize := frametype.size + // TODO(mknyszek): Remove this when we no longer have + // caller reserved spill space. + frameSize = align(frameSize, ptrSize) + frameSize += abid.spill + // Call. // Call copies the arguments from scratch to the stack, calls fn, // and then copies the results back into scratch. - call(frametype, fn, scratch, uint32(frametype.size), uint32(retOffset)) + // + // TODO(mknyszek): Have this actually support the register-based ABI. + var regs abi.RegArgs + call(frametype, fn, scratch, uint32(frametype.size), uint32(retOffset), uint32(frameSize), ®s) // Copy return values. // Ignore any changes to args and just copy return values. @@ -2802,14 +2925,32 @@ func mapiternext(it unsafe.Pointer) //go:noescape func maplen(m unsafe.Pointer) int -// call calls fn with a copy of the n argument bytes pointed at by arg. -// After fn returns, reflectcall copies n-retoffset result bytes -// back into arg+retoffset before returning. If copying result bytes back, -// the caller must pass the argument frame type as argtype, so that -// call can execute appropriate write barriers during the copy. +// call calls fn with "stackArgsSize" bytes of stack arguments laid out +// at stackArgs and register arguments laid out in regArgs. frameSize is +// the total amount of stack space that will be reserved by call, so this +// should include enough space to spill register arguments to the stack in +// case of preemption. +// +// After fn returns, call copies stackArgsSize-stackRetOffset result bytes +// back into stackArgs+stackRetOffset before returning, for any return +// values passed on the stack. Register-based return values will be found +// in the same regArgs structure. +// +// regArgs must also be prepared with an appropriate ReturnIsPtr bitmap +// indicating which registers will contain pointer-valued return values. The +// purpose of this bitmap is to keep pointers visible to the GC between +// returning from reflectcall and actually using them. // +// If copying result bytes back from the stack, the caller must pass the +// argument frame type as stackArgsType, so that call can execute appropriate +// write barriers during the copy. +// +// Arguments passed through to call do not escape. The type is used only in a +// very limited callee of call, the stackArgs are copied, and regArgs is only +// used in the call frame. +//go:noescape //go:linkname call runtime.reflectcall -func call(argtype *rtype, fn, arg unsafe.Pointer, n uint32, retoffset uint32) +func call(stackArgsType *rtype, f, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs) func ifaceE2I(t *rtype, src interface{}, dst unsafe.Pointer) diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 429f3fef82..471451df28 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -458,7 +458,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 JMP runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -470,8 +470,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 JMP AX // Note: can't just "JMP NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT, $0-20 - MOVL argsize+12(FP), CX +TEXT ·reflectcall(SB), NOSPLIT, $0-28 + MOVL frameSize+20(FP), CX DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -503,11 +503,11 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-20 JMP AX #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-28; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVL argptr+8(FP), SI; \ - MOVL argsize+12(FP), CX; \ + MOVL stackArgs+8(FP), SI; \ + MOVL stackArgsSize+12(FP), CX; \ MOVL SP, DI; \ REP;MOVSB; \ /* call function */ \ @@ -516,10 +516,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ PCDATA $PCDATA_StackMapIndex, $0; \ CALL AX; \ /* copy return values back */ \ - MOVL argtype+0(FP), DX; \ - MOVL argptr+8(FP), DI; \ - MOVL argsize+12(FP), CX; \ - MOVL retoffset+16(FP), BX; \ + MOVL stackArgsType+0(FP), DX; \ + MOVL stackArgs+8(FP), DI; \ + MOVL stackArgsSize+12(FP), CX; \ + MOVL stackRetOffset+16(FP), BX; \ MOVL SP, SI; \ ADDL BX, DI; \ ADDL BX, SI; \ @@ -531,11 +531,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $16-0 +TEXT callRet<>(SB), NOSPLIT, $20-0 MOVL DX, 0(SP) MOVL DI, 4(SP) MOVL SI, 8(SP) MOVL CX, 12(SP) + MOVL $0, 16(SP) CALL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 93280eee4a..5e1ed9b2ad 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -445,8 +445,74 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0 MOVL $0, DX JMP runtime·morestack(SB) +#ifdef GOEXPERIMENT_REGABI +// spillArgs stores return values from registers to a *internal/abi.RegArgs in R12. +TEXT spillArgs<>(SB),NOSPLIT,$0-0 + MOVQ AX, 0(R12) + MOVQ BX, 8(R12) + MOVQ CX, 16(R12) + MOVQ DI, 24(R12) + MOVQ SI, 32(R12) + MOVQ R8, 40(R12) + MOVQ R9, 48(R12) + MOVQ R10, 56(R12) + MOVQ R11, 64(R12) + MOVQ X0, 72(R12) + MOVQ X1, 80(R12) + MOVQ X2, 88(R12) + MOVQ X3, 96(R12) + MOVQ X4, 104(R12) + MOVQ X5, 112(R12) + MOVQ X6, 120(R12) + MOVQ X7, 128(R12) + MOVQ X8, 136(R12) + MOVQ X9, 144(R12) + MOVQ X10, 152(R12) + MOVQ X11, 160(R12) + MOVQ X12, 168(R12) + MOVQ X13, 176(R12) + MOVQ X14, 184(R12) + RET + +// unspillArgs loads args into registers from a *internal/abi.RegArgs in R12. +TEXT unspillArgs<>(SB),NOSPLIT,$0-0 + MOVQ 0(R12), AX + MOVQ 8(R12), BX + MOVQ 16(R12), CX + MOVQ 24(R12), DI + MOVQ 32(R12), SI + MOVQ 40(R12), R8 + MOVQ 48(R12), R9 + MOVQ 56(R12), R10 + MOVQ 64(R12), R11 + MOVQ 72(R12), X0 + MOVQ 80(R12), X1 + MOVQ 88(R12), X2 + MOVQ 96(R12), X3 + MOVQ 104(R12), X4 + MOVQ 112(R12), X5 + MOVQ 120(R12), X6 + MOVQ 128(R12), X7 + MOVQ 136(R12), X8 + MOVQ 144(R12), X9 + MOVQ 152(R12), X10 + MOVQ 160(R12), X11 + MOVQ 168(R12), X12 + MOVQ 176(R12), X13 + MOVQ 184(R12), X14 + RET +#else +// spillArgs stores return values from registers to a pointer in R12. +TEXT spillArgs<>(SB),NOSPLIT,$0-0 + RET + +// unspillArgs loads args into registers from a pointer in R12. +TEXT unspillArgs<>(SB),NOSPLIT,$0-0 + RET +#endif + // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -458,8 +524,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0 JMP AX // Note: can't just "JMP NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT, $0-32 - MOVLQZX argsize+24(FP), CX +TEXT ·reflectcall(SB), NOSPLIT, $0-48 + MOVLQZX frameSize+32(FP), CX DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -491,23 +557,28 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-32 JMP AX #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVQ argptr+16(FP), SI; \ - MOVLQZX argsize+24(FP), CX; \ + MOVQ stackArgs+16(FP), SI; \ + MOVLQZX stackArgsSize+24(FP), CX; \ MOVQ SP, DI; \ REP;MOVSB; \ + /* set up argument registers */ \ + MOVQ regArgs+40(FP), R12; \ + CALL unspillArgs<>(SB); \ /* call function */ \ MOVQ f+8(FP), DX; \ PCDATA $PCDATA_StackMapIndex, $0; \ - MOVQ (DX), AX; \ - CALL AX; \ - /* copy return values back */ \ - MOVQ argtype+0(FP), DX; \ - MOVQ argptr+16(FP), DI; \ - MOVLQZX argsize+24(FP), CX; \ - MOVLQZX retoffset+28(FP), BX; \ + MOVQ (DX), R12; \ + CALL R12; \ + /* copy register return values back */ \ + MOVQ regArgs+40(FP), R12; \ + CALL spillArgs<>(SB); \ + MOVLQZX stackArgsSize+24(FP), CX; \ + MOVLQZX stackRetOffset+28(FP), BX; \ + MOVQ stackArgs+16(FP), DI; \ + MOVQ stackArgsType+0(FP), DX; \ MOVQ SP, SI; \ ADDQ BX, DI; \ ADDQ BX, SI; \ @@ -519,12 +590,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 NO_LOCAL_POINTERS MOVQ DX, 0(SP) MOVQ DI, 8(SP) MOVQ SI, 16(SP) MOVQ CX, 24(SP) + MOVQ R12, 32(SP) CALL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 8eec84d3f2..23619b1408 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -404,7 +404,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 B runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -415,8 +415,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 MOVW $NAME(SB), R1; \ B (R1) -TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20 - MOVW argsize+12(FP), R0 +TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-28 + MOVW frameSize+20(FP), R0 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -448,11 +448,11 @@ TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20 B (R1) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-28; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVW argptr+8(FP), R0; \ - MOVW argsize+12(FP), R2; \ + MOVW stackArgs+8(FP), R0; \ + MOVW stackArgsSize+12(FP), R2; \ ADD $4, R13, R1; \ CMP $0, R2; \ B.EQ 5(PC); \ @@ -466,10 +466,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ PCDATA $PCDATA_StackMapIndex, $0; \ BL (R0); \ /* copy return values back */ \ - MOVW argtype+0(FP), R4; \ - MOVW argptr+8(FP), R0; \ - MOVW argsize+12(FP), R2; \ - MOVW retoffset+16(FP), R3; \ + MOVW stackArgsType+0(FP), R4; \ + MOVW stackArgs+8(FP), R0; \ + MOVW stackArgsSize+12(FP), R2; \ + MOVW stackArgsRetOffset+16(FP), R3; \ ADD $4, R13, R1; \ ADD R3, R1; \ ADD R3, R0; \ @@ -481,11 +481,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $16-0 +TEXT callRet<>(SB), NOSPLIT, $20-0 MOVW R4, 4(R13) MOVW R0, 8(R13) MOVW R1, 12(R13) MOVW R2, 16(R13) + MOVW $0, R7 + MOVW R7, 20(R13) BL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 8e4a1f74f9..0ab92be1e4 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -312,7 +312,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 B runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -325,8 +325,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 B (R27) // Note: can't just "B NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 - MOVWU argsize+24(FP), R16 +TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48 + MOVWU frameSize+32(FP), R16 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -358,11 +358,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 B (R0) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVD arg+16(FP), R3; \ - MOVWU argsize+24(FP), R4; \ + MOVD stackArgs+16(FP), R3; \ + MOVWU stackArgsSize+24(FP), R4; \ ADD $8, RSP, R5; \ BIC $0xf, R4, R6; \ CBZ R6, 6(PC); \ @@ -388,10 +388,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ PCDATA $PCDATA_StackMapIndex, $0; \ BL (R0); \ /* copy return values back */ \ - MOVD argtype+0(FP), R7; \ - MOVD arg+16(FP), R3; \ - MOVWU n+24(FP), R4; \ - MOVWU retoffset+28(FP), R6; \ + MOVD stackArgsType+0(FP), R7; \ + MOVD stackArgs+16(FP), R3; \ + MOVWU stackArgsSize+24(FP), R4; \ + MOVWU stackRetOffset+28(FP), R6; \ ADD $8, RSP, R5; \ ADD R6, R5; \ ADD R6, R3; \ @@ -403,11 +403,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $40-0 +TEXT callRet<>(SB), NOSPLIT, $48-0 MOVD R7, 8(RSP) MOVD R3, 16(RSP) MOVD R5, 24(RSP) MOVD R4, 32(RSP) + MOVD $0, 40(RSP) BL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 054a89dc37..694950663a 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -264,7 +264,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 JMP runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -277,8 +277,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 JMP (R4) // Note: can't just "BR NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 - MOVWU argsize+24(FP), R1 +TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48 + MOVWU frameSize+32(FP), R1 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -310,11 +310,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 JMP (R4) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVV arg+16(FP), R1; \ - MOVWU argsize+24(FP), R2; \ + MOVV stackArgs+16(FP), R1; \ + MOVWU stackArgsSize+24(FP), R2; \ MOVV R29, R3; \ ADDV $8, R3; \ ADDV R3, R2; \ @@ -330,10 +330,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ PCDATA $PCDATA_StackMapIndex, $0; \ JAL (R4); \ /* copy return values back */ \ - MOVV argtype+0(FP), R5; \ - MOVV arg+16(FP), R1; \ - MOVWU n+24(FP), R2; \ - MOVWU retoffset+28(FP), R4; \ + MOVV stackArgsType+0(FP), R5; \ + MOVV stackArgs+16(FP), R1; \ + MOVWU stackArgsSize+24(FP), R2; \ + MOVWU stackRetOffset+28(FP), R4; \ ADDV $8, R29, R3; \ ADDV R4, R3; \ ADDV R4, R1; \ @@ -345,11 +345,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 MOVV R5, 8(R29) MOVV R1, 16(R29) MOVV R3, 24(R29) MOVV R2, 32(R29) + MOVV $0, 40(R29) JAL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index f57437d590..8e5753d255 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -265,7 +265,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 JMP runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. @@ -276,8 +276,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0 MOVW $NAME(SB), R4; \ JMP (R4) -TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20 - MOVW argsize+12(FP), R1 +TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-28 + MOVW frameSize+20(FP), R1 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) @@ -310,11 +310,11 @@ TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20 JMP (R4) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \ +TEXT NAME(SB),WRAPPER,$MAXSIZE-28; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVW arg+8(FP), R1; \ - MOVW argsize+12(FP), R2; \ + MOVW stackArgs+8(FP), R1; \ + MOVW stackArgsSize+12(FP), R2; \ MOVW R29, R3; \ ADDU $4, R3; \ ADDU R3, R2; \ @@ -330,10 +330,10 @@ TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \ PCDATA $PCDATA_StackMapIndex, $0; \ JAL (R4); \ /* copy return values back */ \ - MOVW argtype+0(FP), R5; \ - MOVW arg+8(FP), R1; \ - MOVW n+12(FP), R2; \ - MOVW retoffset+16(FP), R4; \ + MOVW stackArgsType+0(FP), R5; \ + MOVW stackArgs+8(FP), R1; \ + MOVW stackArgsSize+12(FP), R2; \ + MOVW stackRetOffset+16(FP), R4; \ ADDU $4, R29, R3; \ ADDU R4, R3; \ ADDU R4, R1; \ @@ -345,11 +345,12 @@ TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $16-0 +TEXT callRet<>(SB), NOSPLIT, $20-0 MOVW R5, 4(R29) MOVW R1, 8(R29) MOVW R3, 12(R29) MOVW R2, 16(R29) + MOVW $0, 20(R29) JAL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 763a92adf1..834023cce1 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -339,7 +339,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 BR runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -353,8 +353,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 BR (CTR) // Note: can't just "BR NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 - MOVWZ argsize+24(FP), R3 +TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48 + MOVWZ frameSize+32(FP), R3 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -387,11 +387,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 BR (CTR) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVD arg+16(FP), R3; \ - MOVWZ argsize+24(FP), R4; \ + MOVD stackArgs+16(FP), R3; \ + MOVWZ stackArgsSize+24(FP), R4; \ MOVD R1, R5; \ CMP R4, $8; \ BLT tailsetup; \ @@ -439,10 +439,10 @@ callfn: \ MOVD 24(R1), R2; \ #endif \ /* copy return values back */ \ - MOVD argtype+0(FP), R7; \ - MOVD arg+16(FP), R3; \ - MOVWZ n+24(FP), R4; \ - MOVWZ retoffset+28(FP), R6; \ + MOVD stackArgsType+0(FP), R7; \ + MOVD stackArgs+16(FP), R3; \ + MOVWZ stackArgsSize+24(FP), R4; \ + MOVWZ stackRetOffset+28(FP), R6; \ ADD $FIXED_FRAME, R1, R5; \ ADD R6, R5; \ ADD R6, R3; \ @@ -454,11 +454,12 @@ callfn: \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 MOVD R7, FIXED_FRAME+0(R1) MOVD R3, FIXED_FRAME+8(R1) MOVD R5, FIXED_FRAME+16(R1) MOVD R4, FIXED_FRAME+24(R1) + MOVD $0, FIXED_FRAME+32(R1) BL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index cf460d1586..31e324d677 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -359,7 +359,7 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 RET // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -371,13 +371,13 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 JALR ZERO, T2 // Note: can't just "BR NAME(SB)" - bad inlining results. -// func call(argtype *rtype, fn, arg unsafe.Pointer, n uint32, retoffset uint32) +// func call(stackArgsType *rtype, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). TEXT reflect·call(SB), NOSPLIT, $0-0 JMP ·reflectcall(SB) -// func reflectcall(argtype *_type, fn, arg unsafe.Pointer, argsize uint32, retoffset uint32) -TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 - MOVWU argsize+24(FP), T0 +// func call(stackArgsType *_type, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). +TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48 + MOVWU frameSize+32(FP), T0 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -409,11 +409,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32 JALR ZERO, T2 #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOV arg+16(FP), A1; \ - MOVWU argsize+24(FP), A2; \ + MOV stackArgs+16(FP), A1; \ + MOVWU stackArgsSize+24(FP), A2; \ MOV X2, A3; \ ADD $8, A3; \ ADD A3, A2; \ @@ -429,10 +429,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ PCDATA $PCDATA_StackMapIndex, $0; \ JALR RA, A4; \ /* copy return values back */ \ - MOV argtype+0(FP), A5; \ - MOV arg+16(FP), A1; \ - MOVWU n+24(FP), A2; \ - MOVWU retoffset+28(FP), A4; \ + MOV stackArgsType+0(FP), A5; \ + MOV stackArgs+16(FP), A1; \ + MOVWU stackArgsSize+24(FP), A2; \ + MOVWU stackRetOffset+28(FP), A4; \ ADD $8, X2, A3; \ ADD A4, A3; \ ADD A4, A1; \ @@ -444,11 +444,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 MOV A5, 8(X2) MOV A1, 16(X2) MOV A3, 24(X2) MOV A2, 32(X2) + MOV $0, 40(X2) CALL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index 1cd5eca06f..fbd185c353 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -353,7 +353,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 BR runtime·morestack(SB) // reflectcall: call a function with the given argument list -// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32). +// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs). // we don't have variable-sized frames, so we use a small number // of constant-sized-frame functions to encode a few bits of size in the pc. // Caution: ugly multiline assembly macros in your future! @@ -366,8 +366,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0 BR (R5) // Note: can't just "BR NAME(SB)" - bad inlining results. -TEXT ·reflectcall(SB), NOSPLIT, $-8-32 - MOVWZ argsize+24(FP), R3 +TEXT ·reflectcall(SB), NOSPLIT, $-8-48 + MOVWZ frameSize+32(FP), R3 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) DISPATCH(runtime·call64, 64) @@ -399,11 +399,11 @@ TEXT ·reflectcall(SB), NOSPLIT, $-8-32 BR (R5) #define CALLFN(NAME,MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ /* copy arguments to stack */ \ - MOVD arg+16(FP), R4; \ - MOVWZ argsize+24(FP), R5; \ + MOVD stackArgs+16(FP), R4; \ + MOVWZ stackArgsSize+24(FP), R5; \ MOVD $stack-MAXSIZE(SP), R6; \ loopArgs: /* copy 256 bytes at a time */ \ CMP R5, $256; \ @@ -424,11 +424,11 @@ callFunction: \ PCDATA $PCDATA_StackMapIndex, $0; \ BL (R8); \ /* copy return values back */ \ - MOVD argtype+0(FP), R7; \ - MOVD arg+16(FP), R6; \ - MOVWZ n+24(FP), R5; \ + MOVD stackArgsType+0(FP), R7; \ + MOVD stackArgs+16(FP), R6; \ + MOVWZ stackArgsSize+24(FP), R5; \ MOVD $stack-MAXSIZE(SP), R4; \ - MOVWZ retoffset+28(FP), R1; \ + MOVWZ stackRetOffset+28(FP), R1; \ ADD R1, R4; \ ADD R1, R6; \ SUB R1, R5; \ @@ -439,11 +439,12 @@ callFunction: \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 MOVD R7, 8(R15) MOVD R6, 16(R15) MOVD R4, 24(R15) MOVD R5, 32(R15) + MOVD $0, 40(R15) BL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s index fcb780f1dc..cf3d961b74 100644 --- a/src/runtime/asm_wasm.s +++ b/src/runtime/asm_wasm.s @@ -296,14 +296,14 @@ TEXT ·asmcgocall(SB), NOSPLIT, $0-0 JMP NAME(SB); \ End -TEXT ·reflectcall(SB), NOSPLIT, $0-32 +TEXT ·reflectcall(SB), NOSPLIT, $0-48 I64Load fn+8(FP) I64Eqz If CALLNORESUME runtime·sigpanic(SB) End - MOVW argsize+24(FP), R0 + MOVW frameSize+32(FP), R0 DISPATCH(runtime·call16, 16) DISPATCH(runtime·call32, 32) @@ -335,18 +335,18 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-32 JMP runtime·badreflectcall(SB) #define CALLFN(NAME, MAXSIZE) \ -TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ +TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \ NO_LOCAL_POINTERS; \ - MOVW argsize+24(FP), R0; \ + MOVW stackArgsSize+24(FP), R0; \ \ Get R0; \ I64Eqz; \ Not; \ If; \ Get SP; \ - I64Load argptr+16(FP); \ + I64Load stackArgs+16(FP); \ I32WrapI64; \ - I64Load argsize+24(FP); \ + I64Load stackArgsSize+24(FP); \ I64Const $3; \ I64ShrU; \ I32WrapI64; \ @@ -359,12 +359,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ I64Load $0; \ CALL; \ \ - I64Load32U retoffset+28(FP); \ + I64Load32U stackRetOffset+28(FP); \ Set R0; \ \ - MOVD argtype+0(FP), RET0; \ + MOVD stackArgsType+0(FP), RET0; \ \ - I64Load argptr+16(FP); \ + I64Load stackArgs+16(FP); \ Get R0; \ I64Add; \ Set RET1; \ @@ -375,7 +375,7 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ I64Add; \ Set RET2; \ \ - I64Load32U argsize+24(FP); \ + I64Load32U stackArgsSize+24(FP); \ Get R0; \ I64Sub; \ Set RET3; \ @@ -387,12 +387,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \ // separate function so it can allocate stack space for the arguments // to reflectcallmove. It does not follow the Go ABI; it expects its // arguments in registers. -TEXT callRet<>(SB), NOSPLIT, $32-0 +TEXT callRet<>(SB), NOSPLIT, $40-0 NO_LOCAL_POINTERS MOVD RET0, 0(SP) MOVD RET1, 8(SP) MOVD RET2, 16(SP) MOVD RET3, 24(SP) + MOVD $0, 32(SP) CALL runtime·reflectcallmove(SB) RET diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go index 2b5affce52..4994347bde 100644 --- a/src/runtime/mbarrier.go +++ b/src/runtime/mbarrier.go @@ -14,6 +14,7 @@ package runtime import ( + "internal/abi" "runtime/internal/sys" "unsafe" ) @@ -223,11 +224,18 @@ func reflect_typedmemmovepartial(typ *_type, dst, src unsafe.Pointer, off, size // stack map of reflectcall is wrong. // //go:nosplit -func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr) { +func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr, regs *abi.RegArgs) { if writeBarrier.needed && typ != nil && typ.ptrdata != 0 && size >= sys.PtrSize { bulkBarrierPreWrite(uintptr(dst), uintptr(src), size) } memmove(dst, src, size) + + // Move pointers returned in registers to a place where the GC can see them. + for i := range regs.Ints { + if regs.ReturnIsPtr.Get(i) { + regs.Ptrs[i] = unsafe.Pointer(regs.Ints[i]) + } + } } //go:nosplit diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go index f4dbd77252..7d0313be12 100644 --- a/src/runtime/mfinal.go +++ b/src/runtime/mfinal.go @@ -7,6 +7,7 @@ package runtime import ( + "internal/abi" "runtime/internal/atomic" "runtime/internal/sys" "unsafe" @@ -219,7 +220,11 @@ func runfinq() { throw("bad kind in runfinq") } fingRunning = true - reflectcall(nil, unsafe.Pointer(f.fn), frame, uint32(framesz), uint32(framesz)) + // Pass a dummy RegArgs for now. + // + // TODO(mknyszek): Pass arguments in registers. + var regs abi.RegArgs + reflectcall(nil, unsafe.Pointer(f.fn), frame, uint32(framesz), uint32(framesz), uint32(framesz), ®s) fingRunning = false // Drop finalizer queue heap references diff --git a/src/runtime/panic.go b/src/runtime/panic.go index 5b2ccdd874..e320eaa596 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -5,6 +5,7 @@ package runtime import ( + "internal/abi" "runtime/internal/atomic" "runtime/internal/sys" "unsafe" @@ -874,7 +875,13 @@ func reflectcallSave(p *_panic, fn, arg unsafe.Pointer, argsize uint32) { p.pc = getcallerpc() p.sp = unsafe.Pointer(getcallersp()) } - reflectcall(nil, fn, arg, argsize, argsize) + // Pass a dummy RegArgs for now since no function actually implements + // the register-based ABI. + // + // TODO(mknyszek): Implement this properly, setting up arguments in + // registers as necessary in the caller. + var regs abi.RegArgs + reflectcall(nil, fn, arg, argsize, argsize, argsize, ®s) if p != nil { p.pc = 0 p.sp = unsafe.Pointer(nil) @@ -968,7 +975,9 @@ func gopanic(e interface{}) { } } else { p.argp = unsafe.Pointer(getargp(0)) - reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz)) + + var regs abi.RegArgs + reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz), uint32(d.siz), ®s) } p.argp = nil diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 3d1e0c0bb4..c0cc95ec65 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -4,7 +4,10 @@ package runtime -import "unsafe" +import ( + "internal/abi" + "unsafe" +) // Should be a built-in for unsafe.Pointer? //go:nosplit @@ -174,19 +177,50 @@ func asminit() func setg(gg *g) func breakpoint() -// reflectcall calls fn with a copy of the n argument bytes pointed at by arg. -// After fn returns, reflectcall copies n-retoffset result bytes -// back into arg+retoffset before returning. If copying result bytes back, -// the caller should pass the argument frame type as argtype, so that -// call can execute appropriate write barriers during the copy. +// reflectcall calls fn with arguments described by stackArgs, stackArgsSize, +// frameSize, and regArgs. // -// Package reflect always passes a frame type. In package runtime, -// Windows callbacks are the only use of this that copies results -// back, and those cannot have pointers in their results, so runtime -// passes nil for the frame type. +// Arguments passed on the stack and space for return values passed on the stack +// must be laid out at the space pointed to by stackArgs (with total length +// stackArgsSize) according to the ABI. +// +// stackRetOffset must be some value <= stackArgsSize that indicates the +// offset within stackArgs where the return value space begins. +// +// frameSize is the total size of the argument frame at stackArgs and must +// therefore be >= stackArgsSize. It must include additional space for spilling +// register arguments for stack growth and preemption. +// +// TODO(mknyszek): Once we don't need the additional spill space, remove frameSize, +// since frameSize will be redundant with stackArgsSize. +// +// Arguments passed in registers must be laid out in regArgs according to the ABI. +// regArgs will hold any return values passed in registers after the call. +// +// reflectcall copies stack arguments from stackArgs to the goroutine stack, and +// then copies back stackArgsSize-stackRetOffset bytes back to the return space +// in stackArgs once fn has completed. It also "unspills" argument registers from +// regArgs before calling fn, and spills them back into regArgs immediately +// following the call to fn. If there are results being returned on the stack, +// the caller should pass the argument frame type as stackArgsType so that +// reflectcall can execute appropriate write barriers during the copy. +// +// reflectcall expects regArgs.ReturnIsPtr to be populated indicating which +// registers on the return path will contain Go pointers. It will then store +// these pointers in regArgs.Ptrs such that they are visible to the GC. +// +// Package reflect passes a frame type. In package runtime, there is only +// one call that copies results back, in callbackWrap in syscall_windows.go, and it +// does NOT pass a frame type, meaning there are no write barriers invoked. See that +// call site for justification. // // Package reflect accesses this symbol through a linkname. -func reflectcall(argtype *_type, fn, arg unsafe.Pointer, argsize uint32, retoffset uint32) +// +// Arguments passed through to reflectcall do not escape. The type is used +// only in a very limited callee of reflectcall, the stackArgs are copied, and +// regArgs is only used in the reflectcall frame. +//go:noescape +func reflectcall(stackArgsType *_type, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs) func procyield(cycles uint32) diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index 7835b492f7..add40bb0b3 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -5,6 +5,7 @@ package runtime import ( + "internal/abi" "runtime/internal/sys" "unsafe" ) @@ -242,7 +243,11 @@ func callbackWrap(a *callbackArgs) { // Even though this is copying back results, we can pass a nil // type because those results must not require write barriers. - reflectcall(nil, unsafe.Pointer(c.fn), noescape(goArgs), uint32(c.retOffset)+sys.PtrSize, uint32(c.retOffset)) + // + // Pass a dummy RegArgs for now. + // TODO(mknyszek): Pass arguments in registers. + var regs abi.RegArgs + reflectcall(nil, unsafe.Pointer(c.fn), noescape(goArgs), uint32(c.retOffset)+sys.PtrSize, uint32(c.retOffset), uint32(c.retOffset)+sys.PtrSize, ®s) // Extract the result. a.result = *(*uintptr)(unsafe.Pointer(&frame[c.retOffset])) -- cgit v1.3-5-g9baa From 1004a7cb31ae31d2ca0b54b507b996c12403d54c Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Mon, 15 Feb 2021 23:12:15 -0500 Subject: runtime/metrics: update documentation to current interface The package documentation referenced sample metadata that was removed in CL 282632. Update this documentation to be less specific about what metadata is available. Additionally, the documentation on the Sample type referred to Descriptions instead of All as the source of metrics names. Fixes #44280. Change-Id: I24fc63a744bf498cb4cd5bda56c1599f6dd75929 Reviewed-on: https://go-review.googlesource.com/c/go/+/292309 Reviewed-by: Michael Knyszek Trust: Michael Knyszek Trust: Dmitri Shuralyov Run-TryBot: Michael Knyszek TryBot-Result: Go Bot --- src/runtime/metrics/doc.go | 4 +--- src/runtime/metrics/sample.go | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go index 5da050f973..7f790afc12 100644 --- a/src/runtime/metrics/doc.go +++ b/src/runtime/metrics/doc.go @@ -16,9 +16,7 @@ Interface Metrics are designated by a string key, rather than, for example, a field name in a struct. The full list of supported metrics is always available in the slice of Descriptions returned by All. Each Description also includes useful information -about the metric, such as how to display it (for example, gauge vs. counter) -and how difficult or disruptive it is to obtain it (for example, do you need to -stop the world?). +about the metric. Thus, users of this API are encouraged to sample supported metrics defined by the slice returned by All to remain compatible across Go versions. Of course, situations diff --git a/src/runtime/metrics/sample.go b/src/runtime/metrics/sample.go index b3933e266e..4cf8cdf799 100644 --- a/src/runtime/metrics/sample.go +++ b/src/runtime/metrics/sample.go @@ -14,7 +14,7 @@ type Sample struct { // Name is the name of the metric sampled. // // It must correspond to a name in one of the metric descriptions - // returned by Descriptions. + // returned by All. Name string // Value is the value of the metric sample. -- cgit v1.3-5-g9baa From c2358a1ae77d7bd09fb8b728d25641b5757a7a58 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Tue, 16 Feb 2021 20:15:13 +0000 Subject: [dev.regabi] runtime: stub out spillArgs and unspillArgs Currently these two functions assume that constants in internal/abi are set correctly, but we actually just made them zero if GOEXPERIMENT_REGABI is set. This means reflectcall is broken. Fix it by stubbing out these routines even if GOEXPERIMENT_REGABI is set. Change-Id: I4c8df6d6af28562c5bb7b85f48c03d37daa9ee0d Reviewed-on: https://go-review.googlesource.com/c/go/+/292650 Reviewed-by: Cherry Zhang TryBot-Result: Go Bot Trust: Michael Knyszek Run-TryBot: Michael Knyszek --- src/runtime/asm_amd64.s | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 5e1ed9b2ad..05422c9699 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -445,7 +445,10 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0 MOVL $0, DX JMP runtime·morestack(SB) -#ifdef GOEXPERIMENT_REGABI +// REFLECTCALL_USE_REGABI is not defined. It must be defined in conjunction with the +// register constants in the internal/abi package. + +#ifdef REFLECTCALL_USE_REGABI // spillArgs stores return values from registers to a *internal/abi.RegArgs in R12. TEXT spillArgs<>(SB),NOSPLIT,$0-0 MOVQ AX, 0(R12) -- cgit v1.3-5-g9baa From 07ef3135253321176704bce6e629a07ac02bf1c6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 17 Feb 2021 12:03:13 -0800 Subject: runtime/cgo: add cast in C code to avoid C compiler warning Fixes #44340 Change-Id: Id80dd1f44a988b653933732afcc8e49a826affc4 Reviewed-on: https://go-review.googlesource.com/c/go/+/293209 Reviewed-by: Andrew G. Morgan Reviewed-by: Bryan C. Mills Trust: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- src/runtime/cgo/linux_syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/cgo/linux_syscall.c b/src/runtime/cgo/linux_syscall.c index 56f3d67d8b..59761c8b40 100644 --- a/src/runtime/cgo/linux_syscall.c +++ b/src/runtime/cgo/linux_syscall.c @@ -32,7 +32,7 @@ typedef struct { #define SET_RETVAL(fn) \ uintptr_t ret = (uintptr_t) fn ; \ - if (ret == -1) { \ + if (ret == (uintptr_t) -1) { \ x->retval = (uintptr_t) errno; \ } else \ x->retval = ret -- cgit v1.3-5-g9baa From f0be3cc5476bd726707985a6382ae6a2d6fa8968 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Wed, 17 Feb 2021 20:34:34 +1100 Subject: runtime: unbreak linux/riscv64 following regabi merge Unbreak the linux/riscv64 port by storing the zero value register to memory, rather than the current code that is moving a zero intermediate to the stack pointer register (ideally this should be caught by the assembler). This was broken in CL#272568. On riscv64 a zero immediate value cannot be moved directly to memory, rather a register needs to be loaded with zero and then stored. Alternatively, the the zero value register (aka X0) can be used directly. Change-Id: Id57121541d50c9993cec5c2270b638b184ab9bc1 Reviewed-on: https://go-review.googlesource.com/c/go/+/292894 Trust: Joel Sing Reviewed-by: Michael Knyszek Reviewed-by: Cherry Zhang Run-TryBot: Michael Knyszek TryBot-Result: Go Bot --- src/runtime/asm_riscv64.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index 31e324d677..3d0349471a 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -449,7 +449,7 @@ TEXT callRet<>(SB), NOSPLIT, $40-0 MOV A1, 16(X2) MOV A3, 24(X2) MOV A2, 32(X2) - MOV $0, 40(X2) + MOV ZERO, 40(X2) CALL runtime·reflectcallmove(SB) RET -- cgit v1.3-5-g9baa From 0d94f989d12a52ddc3869dbaa02255873f7a8196 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 30 Jan 2021 07:07:42 -0500 Subject: runtime: clean up system calls during cgo callback init During a cgocallback, the runtime calls needm to get an m. The calls made during needm cannot themselves assume that there is an m or a g (which is attached to the m). In the old days of making direct system calls, the only thing you had to do for such functions was mark them //go:nosplit, to avoid the use of g in the stack split prologue. But now, on operating systems that make system calls through shared libraries and use code that saves state in the g or m before doing so, it's not safe to assume g exists. In fact, it is not even safe to call getg(), because it might fault deferencing the TLS storage to find the g pointer (that storage may not be initialized yet, at least on Windows, and perhaps on other systems in the future). The specific routines that are problematic are usleep and osyield, which are called during lock contention in lockextra, called from needm. All this is rather subtle and hidden, so in addition to fixing the problem on Windows, this CL makes the fact of not running on a g much clearer by introducing variants usleep_no_g and osyield_no_g whose names should make clear that there is no g. And then we can remove the various sketchy getg() == nil checks in the existing routines. As part of this cleanup, this CL also deletes onosstack on Windows. onosstack is from back when the runtime was implemented in C. It predates systemstack but does essentially the same thing. Instead of having two different copies of this code, we can use systemstack consistently. This way we need not port onosstack to each architecture. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I3352de1fd0a3c26267c6e209063e6e86abd26187 Reviewed-on: https://go-review.googlesource.com/c/go/+/288793 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/runtime/asm_386.s | 16 ++++++++ src/runtime/asm_amd64.s | 17 ++++++++ src/runtime/asm_arm.s | 15 +++++++ src/runtime/asm_arm64.s | 13 +++++- src/runtime/asm_mips64x.s | 9 ++++ src/runtime/os2_aix.go | 42 ++++++++----------- src/runtime/os3_solaris.go | 20 +++++---- src/runtime/os_darwin.go | 5 +++ src/runtime/os_dragonfly.go | 5 +++ src/runtime/os_freebsd.go | 5 +++ src/runtime/os_js.go | 10 +++++ src/runtime/os_linux.go | 5 +++ src/runtime/os_netbsd.go | 5 +++ src/runtime/os_openbsd_syscall1.go | 5 +++ src/runtime/os_openbsd_syscall2.go | 5 +++ src/runtime/os_plan9.go | 10 +++++ src/runtime/os_windows.go | 38 ++++++++++------- src/runtime/proc.go | 6 +-- src/runtime/stubs2.go | 5 +++ src/runtime/stubs_386.go | 3 ++ src/runtime/stubs_amd64.go | 5 +++ src/runtime/stubs_arm.go | 5 +++ src/runtime/stubs_arm64.go | 5 +++ src/runtime/stubs_mips64x.go | 5 +++ src/runtime/sys_darwin.go | 6 +++ src/runtime/sys_openbsd1.go | 5 +++ src/runtime/sys_openbsd2.go | 6 +++ src/runtime/sys_windows_386.s | 79 +++++------------------------------ src/runtime/sys_windows_amd64.s | 71 ++++---------------------------- src/runtime/sys_windows_arm.s | 84 ++++---------------------------------- 30 files changed, 254 insertions(+), 256 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 471451df28..3030101f03 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -621,6 +621,22 @@ TEXT gosave<>(SB),NOSPLIT,$0 POPL AX RET +// func asmcgocall_no_g(fn, arg unsafe.Pointer) +// Call fn(arg) aligned appropriately for the gcc ABI. +// Called on a system stack, and there may be no g yet (during needm). +TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-8 + MOVL fn+0(FP), AX + MOVL arg+4(FP), BX + MOVL SP, DX + SUBL $32, SP + ANDL $~15, SP // alignment, perhaps unnecessary + MOVL DX, 8(SP) // save old SP + MOVL BX, 0(SP) // first argument in x86-32 ABI + CALL AX + MOVL 8(SP), DX + MOVL DX, SP + RET + // func asmcgocall(fn, arg unsafe.Pointer) int32 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 05422c9699..9362ce1213 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -679,6 +679,23 @@ TEXT gosave<>(SB),NOSPLIT,$0 CALL runtime·badctxt(SB) RET +// func asmcgocall_no_g(fn, arg unsafe.Pointer) +// Call fn(arg) aligned appropriately for the gcc ABI. +// Called on a system stack, and there may be no g yet (during needm). +TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16 + MOVQ fn+0(FP), AX + MOVQ arg+8(FP), BX + MOVQ SP, DX + SUBQ $32, SP + ANDQ $~15, SP // alignment + MOVQ DX, 8(SP) + MOVQ BX, DI // DI = first argument in AMD64 ABI + MOVQ BX, CX // CX = first argument in Win64 + CALL AX + MOVQ 8(SP), DX + MOVQ DX, SP + RET + // func asmcgocall(fn, arg unsafe.Pointer) int32 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 23619b1408..109030aada 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -552,6 +552,21 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 CALL runtime·badctxt(SB) RET +// func asmcgocall_no_g(fn, arg unsafe.Pointer) +// Call fn(arg) aligned appropriately for the gcc ABI. +// Called on a system stack, and there may be no g yet (during needm). +TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-8 + MOVW fn+0(FP), R1 + MOVW arg+4(FP), R0 + MOVW R13, R2 + SUB $32, R13 + BIC $0x7, R13 // alignment for gcc ABI + MOVW R2, 8(R13) + BL (R1) + MOVW 8(R13), R2 + MOVW R2, R13 + RET + // func asmcgocall(fn, arg unsafe.Pointer) int32 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 0ab92be1e4..79efd4cb17 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -873,6 +873,17 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 CALL runtime·badctxt(SB) RET +// func asmcgocall_no_g(fn, arg unsafe.Pointer) +// Call fn(arg) aligned appropriately for the gcc ABI. +// Called on a system stack, and there may be no g yet (during needm). +TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16 + MOVD fn+0(FP), R1 + MOVD arg+8(FP), R0 + SUB $16, RSP // skip over saved frame pointer below RSP + BL (R1) + ADD $16, RSP // skip over saved frame pointer below RSP + RET + // func asmcgocall(fn, arg unsafe.Pointer) int32 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. @@ -951,7 +962,7 @@ nosave: BL (R1) // Restore stack pointer. MOVD 8(RSP), R2 - MOVD R2, RSP + MOVD R2, RSP MOVD R0, ret+16(FP) RET diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 694950663a..6e1d25cd90 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -413,6 +413,15 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 JAL runtime·badctxt(SB) RET +// func asmcgocall_no_g(fn, arg unsafe.Pointer) +// Call fn(arg) aligned appropriately for the gcc ABI. +// Called on a system stack, and there may be no g yet (during needm). +TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16 + MOVV fn+0(FP), R25 + MOVV arg+8(FP), R4 + JAL (R25) + RET + // func asmcgocall(fn, arg unsafe.Pointer) int32 // Call fn(arg) on the scheduler stack, // aligned appropriately for the gcc ABI. diff --git a/src/runtime/os2_aix.go b/src/runtime/os2_aix.go index abd1010be9..4d77f0de6d 100644 --- a/src/runtime/os2_aix.go +++ b/src/runtime/os2_aix.go @@ -527,20 +527,17 @@ func internal_cpu_getsystemcfg(label uint) uint { func usleep1(us uint32) //go:nosplit -func usleep(us uint32) { - _g_ := getg() +func usleep_no_g(us uint32) { + usleep1(us) +} - // Check the validity of m because we might be called in cgo callback - // path early enough where there isn't a g or a m available yet. - if _g_ != nil && _g_.m != nil { - r, err := syscall1(&libc_usleep, uintptr(us)) - if int32(r) == -1 { - println("syscall usleep failed: ", hex(err)) - throw("syscall usleep") - } - return +//go:nosplit +func usleep(us uint32) { + r, err := syscall1(&libc_usleep, uintptr(us)) + if int32(r) == -1 { + println("syscall usleep failed: ", hex(err)) + throw("syscall usleep") } - usleep1(us) } //go:nosplit @@ -611,20 +608,17 @@ func raiseproc(sig uint32) { func osyield1() //go:nosplit -func osyield() { - _g_ := getg() +func osyield_no_g() { + osyield1() +} - // Check the validity of m because it might be called during a cgo - // callback early enough where m isn't available yet. - if _g_ != nil && _g_.m != nil { - r, err := syscall0(&libc_sched_yield) - if int32(r) == -1 { - println("syscall osyield failed: ", hex(err)) - throw("syscall osyield") - } - return +//go:nosplit +func osyield() { + r, err := syscall0(&libc_sched_yield) + if int32(r) == -1 { + println("syscall osyield failed: ", hex(err)) + throw("syscall osyield") } - osyield1() } //go:nosplit diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go index 6ba11afd93..4b65139eb8 100644 --- a/src/runtime/os3_solaris.go +++ b/src/runtime/os3_solaris.go @@ -521,6 +521,11 @@ func sysconf(name int32) int64 { func usleep1(usec uint32) +//go:nosplit +func usleep_no_g(µs uint32) { + usleep1(µs) +} + //go:nosplit func usleep(µs uint32) { usleep1(µs) @@ -569,18 +574,15 @@ func setNonblock(fd int32) { func osyield1() //go:nosplit -func osyield() { - _g_ := getg() - - // Check the validity of m because we might be called in cgo callback - // path early enough where there isn't a m available yet. - if _g_ != nil && _g_.m != nil { - sysvicall0(&libc_sched_yield) - return - } +func osyield_no_g() { osyield1() } +//go:nosplit +func osyield() { + sysvicall0(&libc_sched_yield) +} + //go:linkname executablePath os.executablePath var executablePath string diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go index 9ca17c20df..470698d0a3 100644 --- a/src/runtime/os_darwin.go +++ b/src/runtime/os_darwin.go @@ -330,6 +330,11 @@ func unminit() { func mdestroy(mp *m) { } +//go:nosplit +func osyield_no_g() { + usleep_no_g(1) +} + //go:nosplit func osyield() { usleep(1) diff --git a/src/runtime/os_dragonfly.go b/src/runtime/os_dragonfly.go index 383df54bd4..b786c8ab5f 100644 --- a/src/runtime/os_dragonfly.go +++ b/src/runtime/os_dragonfly.go @@ -51,6 +51,11 @@ func sys_umtx_wakeup(addr *uint32, val int32) int32 func osyield() +//go:nosplit +func osyield_no_g() { + osyield() +} + func kqueue() int32 //go:noescape diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go index 09065ccb68..09dd50ce59 100644 --- a/src/runtime/os_freebsd.go +++ b/src/runtime/os_freebsd.go @@ -36,6 +36,11 @@ func sys_umtx_op(addr *uint32, mode int32, val uint32, uaddr1 uintptr, ut *umtx_ func osyield() +//go:nosplit +func osyield_no_g() { + osyield() +} + func kqueue() int32 //go:noescape diff --git a/src/runtime/os_js.go b/src/runtime/os_js.go index 24261e88a2..5b2c53795a 100644 --- a/src/runtime/os_js.go +++ b/src/runtime/os_js.go @@ -30,12 +30,22 @@ func wasmWrite(fd uintptr, p unsafe.Pointer, n int32) func usleep(usec uint32) +//go:nosplit +func usleep_no_g(usec uint32) { + usleep(usec) +} + func exitThread(wait *uint32) type mOS struct{} func osyield() +//go:nosplit +func osyield_no_g() { + osyield() +} + const _SIGSEGV = 0xb func sigpanic() { diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index 058c7daf9c..21d3ae653e 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -410,6 +410,11 @@ func raiseproc(sig uint32) func sched_getaffinity(pid, len uintptr, buf *byte) int32 func osyield() +//go:nosplit +func osyield_no_g() { + osyield() +} + func pipe() (r, w int32, errno int32) func pipe2(flags int32) (r, w int32, errno int32) func setNonblock(fd int32) diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go index 2b742a3711..0328fa57ae 100644 --- a/src/runtime/os_netbsd.go +++ b/src/runtime/os_netbsd.go @@ -67,6 +67,11 @@ func lwp_self() int32 func osyield() +//go:nosplit +func osyield_no_g() { + osyield() +} + func kqueue() int32 //go:noescape diff --git a/src/runtime/os_openbsd_syscall1.go b/src/runtime/os_openbsd_syscall1.go index b0bef4c504..f37da04194 100644 --- a/src/runtime/os_openbsd_syscall1.go +++ b/src/runtime/os_openbsd_syscall1.go @@ -13,3 +13,8 @@ func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort func thrwakeup(ident uintptr, n int32) int32 func osyield() + +//go:nosplit +func osyield_no_g() { + osyield() +} diff --git a/src/runtime/os_openbsd_syscall2.go b/src/runtime/os_openbsd_syscall2.go index ab940510af..81cfb085aa 100644 --- a/src/runtime/os_openbsd_syscall2.go +++ b/src/runtime/os_openbsd_syscall2.go @@ -32,6 +32,11 @@ func closefd(fd int32) int32 func exit(code int32) func usleep(usec uint32) +//go:nosplit +func usleep_no_g(usec uint32) { + usleep(usec) +} + // write calls the write system call. // It returns a non-negative number of bytes written or a negative errno value. //go:noescape diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go index 2a84a73716..77665f461a 100644 --- a/src/runtime/os_plan9.go +++ b/src/runtime/os_plan9.go @@ -339,6 +339,11 @@ func osyield() { sleep(0) } +//go:nosplit +func osyield_no_g() { + osyield() +} + //go:nosplit func usleep(µs uint32) { ms := int32(µs / 1000) @@ -348,6 +353,11 @@ func usleep(µs uint32) { sleep(ms) } +//go:nosplit +func usleep_no_g(usec uint32) { + usleep(usec) +} + //go:nosplit func nanotime1() int64 { var scratch int64 diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index e6b22e3167..1bf3309dfd 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -461,15 +461,12 @@ func initHighResTimer() { h := createHighResTimer() if h != 0 { haveHighResTimer = true - usleep2Addr = unsafe.Pointer(funcPC(usleep2HighRes)) stdcall1(_CloseHandle, h) } } func osinit() { asmstdcallAddr = unsafe.Pointer(funcPC(asmstdcall)) - usleep2Addr = unsafe.Pointer(funcPC(usleep2)) - switchtothreadAddr = unsafe.Pointer(funcPC(switchtothread)) setBadSignalMsg() @@ -1061,26 +1058,39 @@ func stdcall7(fn stdFunction, a0, a1, a2, a3, a4, a5, a6 uintptr) uintptr { return stdcall(fn) } -// In sys_windows_386.s and sys_windows_amd64.s. -func onosstack(fn unsafe.Pointer, arg uint32) - -// These are not callable functions. They should only be called via onosstack. -func usleep2(usec uint32) -func usleep2HighRes(usec uint32) +// These must run on the system stack only. +func usleep2(dt int32) +func usleep2HighRes(dt int32) func switchtothread() -var usleep2Addr unsafe.Pointer -var switchtothreadAddr unsafe.Pointer +//go:nosplit +func osyield_no_g() { + switchtothread() +} //go:nosplit func osyield() { - onosstack(switchtothreadAddr, 0) + systemstack(switchtothread) +} + +//go:nosplit +func usleep_no_g(us uint32) { + dt := -10 * int32(us) // relative sleep (negative), 100ns units + usleep2(dt) } //go:nosplit func usleep(us uint32) { - // Have 1us units; want 100ns units. - onosstack(usleep2Addr, 10*us) + systemstack(func() { + dt := -10 * int32(us) // relative sleep (negative), 100ns units + // If the high-res timer is available and its handle has been allocated for this m, use it. + // Otherwise fall back to the low-res one, which doesn't need a handle. + if haveHighResTimer && getg().m.highResTimer != 0 { + usleep2HighRes(dt) + } else { + usleep2(dt) + } + }) } func ctrlhandler1(_type uint32) uint32 { diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 73a789c189..4092dd55cb 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -2012,7 +2012,7 @@ func lockextra(nilokay bool) *m { for { old := atomic.Loaduintptr(&extram) if old == locked { - osyield() + osyield_no_g() continue } if old == 0 && !nilokay { @@ -2023,13 +2023,13 @@ func lockextra(nilokay bool) *m { atomic.Xadd(&extraMWaiters, 1) incr = true } - usleep(1) + usleep_no_g(1) continue } if atomic.Casuintptr(&extram, old, locked) { return (*m)(unsafe.Pointer(old)) } - osyield() + osyield_no_g() continue } } diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go index 85088b3ab9..96096d236b 100644 --- a/src/runtime/stubs2.go +++ b/src/runtime/stubs2.go @@ -23,6 +23,11 @@ func closefd(fd int32) int32 func exit(code int32) func usleep(usec uint32) +//go:nosplit +func usleep_no_g(usec uint32) { + usleep(usec) +} + // write calls the write system call. // It returns a non-negative number of bytes written or a negative errno value. //go:noescape diff --git a/src/runtime/stubs_386.go b/src/runtime/stubs_386.go index 5108294d83..300f167fff 100644 --- a/src/runtime/stubs_386.go +++ b/src/runtime/stubs_386.go @@ -15,3 +15,6 @@ func stackcheck() // Called from assembly only; declared for go vet. func setldt(slot uintptr, base unsafe.Pointer, size uintptr) func emptyfunc() + +//go:noescape +func asmcgocall_no_g(fn, arg unsafe.Pointer) diff --git a/src/runtime/stubs_amd64.go b/src/runtime/stubs_amd64.go index 8c14bc2271..bf98493e9d 100644 --- a/src/runtime/stubs_amd64.go +++ b/src/runtime/stubs_amd64.go @@ -4,6 +4,8 @@ package runtime +import "unsafe" + // Called from compiled code; declared for vet; do NOT call from Go. func gcWriteBarrierCX() func gcWriteBarrierDX() @@ -35,3 +37,6 @@ func retpolineR12() func retpolineR13() func retpolineR14() func retpolineR15() + +//go:noescape +func asmcgocall_no_g(fn, arg unsafe.Pointer) diff --git a/src/runtime/stubs_arm.go b/src/runtime/stubs_arm.go index c13bf16de2..52c32937ae 100644 --- a/src/runtime/stubs_arm.go +++ b/src/runtime/stubs_arm.go @@ -4,6 +4,8 @@ package runtime +import "unsafe" + // Called from compiler-generated code; declared for go vet. func udiv() func _div() @@ -18,3 +20,6 @@ func save_g() func emptyfunc() func _initcgo() func read_tls_fallback() + +//go:noescape +func asmcgocall_no_g(fn, arg unsafe.Pointer) diff --git a/src/runtime/stubs_arm64.go b/src/runtime/stubs_arm64.go index 44c566e602..6e6e7df6b8 100644 --- a/src/runtime/stubs_arm64.go +++ b/src/runtime/stubs_arm64.go @@ -4,6 +4,11 @@ package runtime +import "unsafe" + // Called from assembly only; declared for go vet. func load_g() func save_g() + +//go:noescape +func asmcgocall_no_g(fn, arg unsafe.Pointer) diff --git a/src/runtime/stubs_mips64x.go b/src/runtime/stubs_mips64x.go index 4e62c1ce90..652e7a9e34 100644 --- a/src/runtime/stubs_mips64x.go +++ b/src/runtime/stubs_mips64x.go @@ -6,6 +6,11 @@ package runtime +import "unsafe" + // Called from assembly only; declared for go vet. func load_g() func save_g() + +//go:noescape +func asmcgocall_no_g(fn, arg unsafe.Pointer) diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go index 4a3f2fc453..dacce2ee1a 100644 --- a/src/runtime/sys_darwin.go +++ b/src/runtime/sys_darwin.go @@ -227,6 +227,12 @@ func usleep(usec uint32) { } func usleep_trampoline() +//go:nosplit +//go:cgo_unsafe_args +func usleep_no_g(usec uint32) { + asmcgocall_no_g(unsafe.Pointer(funcPC(usleep_trampoline)), unsafe.Pointer(&usec)) +} + //go:nosplit //go:cgo_unsafe_args func write1(fd uintptr, p unsafe.Pointer, n int32) int32 { diff --git a/src/runtime/sys_openbsd1.go b/src/runtime/sys_openbsd1.go index e2886218db..44c7871ceb 100644 --- a/src/runtime/sys_openbsd1.go +++ b/src/runtime/sys_openbsd1.go @@ -27,6 +27,11 @@ func osyield() { } func sched_yield_trampoline() +//go:nosplit +func osyield_no_g() { + asmcgocall_no_g(unsafe.Pointer(funcPC(sched_yield_trampoline)), unsafe.Pointer(nil)) +} + //go:cgo_import_dynamic libc_thrsleep __thrsleep "libc.so" //go:cgo_import_dynamic libc_thrwakeup __thrwakeup "libc.so" //go:cgo_import_dynamic libc_sched_yield sched_yield "libc.so" diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go index 474e7145e7..33032596c3 100644 --- a/src/runtime/sys_openbsd2.go +++ b/src/runtime/sys_openbsd2.go @@ -128,6 +128,12 @@ func usleep(usec uint32) { } func usleep_trampoline() +//go:nosplit +//go:cgo_unsafe_args +func usleep_no_g(usec uint32) { + asmcgocall_no_g(unsafe.Pointer(funcPC(usleep_trampoline)), unsafe.Pointer(&usec)) +} + //go:nosplit //go:cgo_unsafe_args func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 { diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index ef8a3dd3c2..b3972ac78d 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -347,60 +347,11 @@ TEXT runtime·setldt(SB),NOSPLIT,$0 MOVL CX, 0x14(FS) RET -// onosstack calls fn on OS stack. -// func onosstack(fn unsafe.Pointer, arg uint32) -TEXT runtime·onosstack(SB),NOSPLIT,$0 - MOVL fn+0(FP), AX // to hide from 8l - MOVL arg+4(FP), BX - - // Execute call on m->g0 stack, in case we are not actually - // calling a system call wrapper, like when running under WINE. - get_tls(CX) - CMPL CX, $0 - JNE 3(PC) - // Not a Go-managed thread. Do not switch stack. - CALL AX - RET - - MOVL g(CX), BP - MOVL g_m(BP), BP - - // leave pc/sp for cpu profiler - MOVL (SP), SI - MOVL SI, m_libcallpc(BP) - MOVL g(CX), SI - MOVL SI, m_libcallg(BP) - // sp must be the last, because once async cpu profiler finds - // all three values to be non-zero, it will use them - LEAL fn+0(FP), SI - MOVL SI, m_libcallsp(BP) - - MOVL m_g0(BP), SI - CMPL g(CX), SI - JNE switch - // executing on m->g0 already - CALL AX - JMP ret - -switch: - // Switch to m->g0 stack and back. - MOVL (g_sched+gobuf_sp)(SI), SI - MOVL SP, -4(SI) - LEAL -4(SI), SP - CALL AX - MOVL 0(SP), SP - -ret: - get_tls(CX) - MOVL g(CX), BP - MOVL g_m(BP), BP - MOVL $0, m_libcallsp(BP) - RET - -// Runs on OS stack. duration (in 100ns units) is in BX. -TEXT runtime·usleep2(SB),NOSPLIT,$20 - // Want negative 100ns units. - NEGL BX +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g may be nil. +TEXT runtime·usleep2(SB),NOSPLIT,$20-4 + MOVL dt+0(FP), BX MOVL $-1, hi-4(SP) MOVL BX, lo-8(SP) LEAL lo-8(SP), BX @@ -413,17 +364,15 @@ TEXT runtime·usleep2(SB),NOSPLIT,$20 MOVL BP, SP RET -// Runs on OS stack. duration (in 100ns units) is in BX. -TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36 - get_tls(CX) - CMPL CX, $0 - JE gisnotset - - // Want negative 100ns units. - NEGL BX +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g is valid. +TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36-4 + MOVL dt+0(FP), BX MOVL $-1, hi-4(SP) MOVL BX, lo-8(SP) + get_tls(CX) MOVL g(CX), CX MOVL g_m(CX), CX MOVL (m_mOS+mOS_highResTimer)(CX), CX @@ -452,12 +401,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36 RET -gisnotset: - // TLS is not configured. Call usleep2 instead. - MOVL $runtime·usleep2(SB), AX - CALL AX - RET - // Runs on OS stack. TEXT runtime·switchtothread(SB),NOSPLIT,$0 MOVL SP, BP diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index d1690cad58..2bd7b74848 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -388,61 +388,16 @@ TEXT runtime·settls(SB),NOSPLIT,$0 MOVQ DI, 0x28(GS) RET -// func onosstack(fn unsafe.Pointer, arg uint32) -TEXT runtime·onosstack(SB),NOSPLIT,$0 - MOVQ fn+0(FP), AX // to hide from 6l - MOVL arg+8(FP), BX - - // Execute call on m->g0 stack, in case we are not actually - // calling a system call wrapper, like when running under WINE. - get_tls(R15) - CMPQ R15, $0 - JNE 3(PC) - // Not a Go-managed thread. Do not switch stack. - CALL AX - RET - - MOVQ g(R15), R13 - MOVQ g_m(R13), R13 - - // leave pc/sp for cpu profiler - MOVQ (SP), R12 - MOVQ R12, m_libcallpc(R13) - MOVQ g(R15), R12 - MOVQ R12, m_libcallg(R13) - // sp must be the last, because once async cpu profiler finds - // all three values to be non-zero, it will use them - LEAQ fn+0(FP), R12 - MOVQ R12, m_libcallsp(R13) - - MOVQ m_g0(R13), R14 - CMPQ g(R15), R14 - JNE switch - // executing on m->g0 already - CALL AX - JMP ret - -switch: - // Switch to m->g0 stack and back. - MOVQ (g_sched+gobuf_sp)(R14), R14 - MOVQ SP, -8(R14) - LEAQ -8(R14), SP - CALL AX - MOVQ 0(SP), SP - -ret: - MOVQ $0, m_libcallsp(R13) - RET - -// Runs on OS stack. duration (in 100ns units) is in BX. +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g may be nil. // The function leaves room for 4 syscall parameters // (as per windows amd64 calling convention). -TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48 +TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48-4 + MOVLQSX dt+0(FP), BX MOVQ SP, AX ANDQ $~15, SP // alignment as per Windows requirement MOVQ AX, 40(SP) - // Want negative 100ns units. - NEGQ BX LEAQ 32(SP), R8 // ptime MOVQ BX, (R8) MOVQ $-1, CX // handle @@ -452,11 +407,11 @@ TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48 MOVQ 40(SP), SP RET -// Runs on OS stack. duration (in 100ns units) is in BX. -TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72 +// Runs on OS stack. duration (in -100ns units) is in dt+0(FP). +// g is valid. +TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72-4 + MOVLQSX dt+0(FP), BX get_tls(CX) - CMPQ CX, $0 - JE gisnotset MOVQ SP, AX ANDQ $~15, SP // alignment as per Windows requirement @@ -466,8 +421,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72 MOVQ g_m(CX), CX MOVQ (m_mOS+mOS_highResTimer)(CX), CX // hTimer MOVQ CX, 48(SP) // save hTimer for later - // Want negative 100ns units. - NEGQ BX LEAQ 56(SP), DX // lpDueTime MOVQ BX, (DX) MOVQ $0, R8 // lPeriod @@ -487,12 +440,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72 MOVQ 64(SP), SP RET -gisnotset: - // TLS is not configured. Call usleep2 instead. - MOVQ $runtime·usleep2(SB), AX - CALL AX - RET - // Runs on OS stack. TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 MOVQ SP, AX diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index fe267080cc..1d928a4f7d 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -377,79 +377,11 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0 MOVW $0, R0 MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} -// onosstack calls fn on OS stack. -// adapted from asm_arm.s : systemstack -// func onosstack(fn unsafe.Pointer, arg uint32) -TEXT runtime·onosstack(SB),NOSPLIT,$0 - MOVW fn+0(FP), R5 // R5 = fn - MOVW arg+4(FP), R6 // R6 = arg - - // This function can be called when there is no g, - // for example, when we are handling a callback on a non-go thread. - // In this case we're already on the system stack. - CMP $0, g - BEQ noswitch - - MOVW g_m(g), R1 // R1 = m - - MOVW m_gsignal(R1), R2 // R2 = gsignal - CMP g, R2 - B.EQ noswitch - - MOVW m_g0(R1), R2 // R2 = g0 - CMP g, R2 - B.EQ noswitch - - MOVW m_curg(R1), R3 - CMP g, R3 - B.EQ switch - - // Bad: g is not gsignal, not g0, not curg. What is it? - // Hide call from linker nosplit analysis. - MOVW $runtime·badsystemstack(SB), R0 - BL (R0) - B runtime·abort(SB) - -switch: - // save our state in g->sched. Pretend to - // be systemstack_switch if the G stack is scanned. - MOVW $runtime·systemstack_switch(SB), R3 - ADD $4, R3, R3 // get past push {lr} - MOVW R3, (g_sched+gobuf_pc)(g) - MOVW R13, (g_sched+gobuf_sp)(g) - MOVW LR, (g_sched+gobuf_lr)(g) - MOVW g, (g_sched+gobuf_g)(g) - - // switch to g0 - MOVW R2, g - MOVW (g_sched+gobuf_sp)(R2), R3 - // make it look like mstart called systemstack on g0, to stop traceback - SUB $4, R3, R3 - MOVW $runtime·mstart(SB), R4 - MOVW R4, 0(R3) - MOVW R3, R13 - - // call target function - MOVW R6, R0 // arg - BL (R5) - - // switch back to g - MOVW g_m(g), R1 - MOVW m_curg(R1), g - MOVW (g_sched+gobuf_sp)(g), R13 - MOVW $0, R3 - MOVW R3, (g_sched+gobuf_sp)(g) - RET - -noswitch: - // Using a tail call here cleans up tracebacks since we won't stop - // at an intermediate systemstack. - MOVW.P 4(R13), R14 // restore LR - MOVW R6, R0 // arg - B (R5) - -// Runs on OS stack. Duration (in 100ns units) is in R0. -TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0 +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g may be nil. +TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0-4 + MOVW dt+0(FP), R0 MOVM.DB.W [R4, R14], (R13) // push {r4, lr} MOVW R13, R4 // Save SP SUB $8, R13 // R13 = R13 - 8 @@ -465,9 +397,11 @@ TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0 MOVW R4, R13 // Restore SP MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} -// Runs on OS stack. Duration (in 100ns units) is in R0. +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g is valid. // TODO: neeeds to be implemented properly. -TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0 +TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0-4 B runtime·abort(SB) // Runs on OS stack. -- cgit v1.3-5-g9baa From 678568a5cfe1806c16bf478234d6dac283c3474d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 30 Jan 2021 16:18:51 -0500 Subject: runtime: delete windows setlasterror (unused) This is dead code and need not be ported to each architecture. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I2d0072b377f73e49d7158ea304670c26f5486c59 Reviewed-on: https://go-review.googlesource.com/c/go/+/288794 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Alex Brainman Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/runtime/os_windows.go | 1 - src/runtime/sys_windows_386.s | 5 ----- src/runtime/sys_windows_amd64.s | 6 ------ src/runtime/sys_windows_arm.s | 5 ----- 4 files changed, 17 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 1bf3309dfd..a2a124cd9d 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -379,7 +379,6 @@ const ( // in sys_windows_386.s and sys_windows_amd64.s: func externalthreadhandler() func getlasterror() uint32 -func setlasterror(err uint32) // When loading DLLs, we prefer to use LoadLibraryEx with // LOAD_LIBRARY_SEARCH_* flags, if available. LoadLibraryEx is not diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index b3972ac78d..c556e3a3c2 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -66,11 +66,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0 MOVL AX, ret+0(FP) RET -TEXT runtime·setlasterror(SB),NOSPLIT,$0 - MOVL err+0(FP), AX - MOVL AX, 0x34(FS) - RET - // Called by Windows as a Vectored Exception Handler (VEH). // First argument is pointer to struct containing // exception record and context pointers. diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 2bd7b74848..9cd14016b0 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -103,12 +103,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0 MOVL AX, ret+0(FP) RET -TEXT runtime·setlasterror(SB),NOSPLIT,$0 - MOVL err+0(FP), AX - MOVQ 0x30(GS), CX - MOVL AX, 0x68(CX) - RET - // Called by Windows as a Vectored Exception Handler (VEH). // First argument is pointer to struct containing // exception record and context pointers. diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 1d928a4f7d..d2bdc50e3b 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -103,11 +103,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0 MOVW R0, ret+0(FP) RET -TEXT runtime·setlasterror(SB),NOSPLIT|NOFRAME,$0 - MRC 15, 0, R1, C13, C0, 2 - MOVW R0, 0x34(R1) - RET - // Called by Windows as a Vectored Exception Handler (VEH). // First argument is pointer to struct containing // exception record and context pointers. -- cgit v1.3-5-g9baa From 8ac23a1f151a9b1842797652ed7761f397055b5b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 01:06:52 -0500 Subject: runtime: document, clean up internal/sys Document what the values in internal/sys mean. Remove various special cases for arm64 in the code using StackAlign. Delete Uintreg - it was for GOARCH=amd64p32, which was specific to GOOS=nacl and has been retired. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I40e8fa07b4e192298b6536b98a72a751951a4383 Reviewed-on: https://go-review.googlesource.com/c/go/+/288795 Trust: Russ Cox Reviewed-by: Cherry Zhang Reviewed-by: Ian Lance Taylor --- src/runtime/cgocall.go | 9 +------- src/runtime/export_test.go | 2 -- src/runtime/internal/sys/arch.go | 38 +++++++++++++++++++++++++++++++ src/runtime/internal/sys/arch_386.go | 13 ++++------- src/runtime/internal/sys/arch_amd64.go | 13 ++++------- src/runtime/internal/sys/arch_arm.go | 13 ++++------- src/runtime/internal/sys/arch_arm64.go | 13 ++++------- src/runtime/internal/sys/arch_mips.go | 13 ++++------- src/runtime/internal/sys/arch_mips64.go | 13 ++++------- src/runtime/internal/sys/arch_mips64le.go | 13 ++++------- src/runtime/internal/sys/arch_mipsle.go | 13 ++++------- src/runtime/internal/sys/arch_ppc64.go | 13 ++++------- src/runtime/internal/sys/arch_ppc64le.go | 13 ++++------- src/runtime/internal/sys/arch_riscv64.go | 15 ++++-------- src/runtime/internal/sys/arch_s390x.go | 13 ++++------- src/runtime/internal/sys/arch_wasm.go | 13 ++++------- src/runtime/internal/sys/stubs.go | 16 ------------- src/runtime/os3_plan9.go | 4 ---- src/runtime/proc.go | 12 +++++----- src/runtime/runtime2.go | 2 +- src/runtime/runtime_test.go | 4 ++-- src/runtime/signal_arm64.go | 2 +- src/runtime/stack.go | 4 ++-- src/runtime/sys_wasm.go | 4 ---- src/runtime/sys_x86.go | 4 ---- src/runtime/traceback.go | 20 +++++++--------- 26 files changed, 124 insertions(+), 168 deletions(-) delete mode 100644 src/runtime/internal/sys/stubs.go (limited to 'src/runtime') diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go index 20cacd6043..534a2c4295 100644 --- a/src/runtime/cgocall.go +++ b/src/runtime/cgocall.go @@ -306,14 +306,7 @@ func unwindm(restore *bool) { // unwind of g's stack (see comment at top of file). mp := acquirem() sched := &mp.g0.sched - switch GOARCH { - default: - throw("unwindm not implemented") - case "386", "amd64", "arm", "ppc64", "ppc64le", "mips64", "mips64le", "s390x", "mips", "mipsle", "riscv64": - sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + sys.MinFrameSize)) - case "arm64": - sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + 16)) - } + sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + alignUp(sys.MinFrameSize, sys.StackAlign))) // Do the accounting that cgocall will not have a chance to do // during an unwind. diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 22fef3134f..a48bb2636f 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -200,8 +200,6 @@ func GostringW(w []uint16) (s string) { return } -type Uintreg sys.Uintreg - var Open = open var Close = closefd var Read = read diff --git a/src/runtime/internal/sys/arch.go b/src/runtime/internal/sys/arch.go index 13c00cf639..69278bf2d5 100644 --- a/src/runtime/internal/sys/arch.go +++ b/src/runtime/internal/sys/arch.go @@ -18,3 +18,41 @@ const ( S390X WASM ) + +// PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant. +// It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit). +const PtrSize = 4 << (^uintptr(0) >> 63) + +// AIX requires a larger stack for syscalls. +const StackGuardMultiplier = StackGuardMultiplierDefault*(1-GoosAix) + 2*GoosAix + +// ArchFamily is the architecture family (AMD64, ARM, ...) +const ArchFamily ArchFamilyType = _ArchFamily + +// BigEndian reports whether the architecture is big-endian. +const BigEndian = GoarchArmbe|GoarchArm64be|GoarchMips|GoarchMips64|GoarchPpc|GoarchPpc64|GoarchS390|GoarchS390x|GoarchSparc|GoarchSparc64 == 1 + +// DefaultPhysPageSize is the default physical page size. +const DefaultPhysPageSize = _DefaultPhysPageSize + +// PCQuantum is the minimal unit for a program counter (1 on x86, 4 on most other systems). +// The various PC tables record PC deltas pre-divided by PCQuantum. +const PCQuantum = _PCQuantum + +// Int64Align is the required alignment for a 64-bit integer (4 on 32-bit systems, 8 on 64-bit). +const Int64Align = PtrSize + +// MinFrameSize is the size of the system-reserved words at the bottom +// of a frame (just above the architectural stack pointer). +// It is zero on x86 and PtrSize on most non-x86 (LR-based) systems. +// On PowerPC it is larger, to cover three more reserved words: +// the compiler word, the link editor word, and the TOC save word. +const MinFrameSize = _MinFrameSize + +// StackAlign is the required alignment of the SP register. +// The stack must be at least word aligned, but some architectures require more. +const StackAlign = _StackAlign + +// DefaultGoroot is set by the linker for use by package runtime. +// It doesn't really belong in this file or this package. +var DefaultGoroot string diff --git a/src/runtime/internal/sys/arch_386.go b/src/runtime/internal/sys/arch_386.go index b51f70a512..1ebce3435e 100644 --- a/src/runtime/internal/sys/arch_386.go +++ b/src/runtime/internal/sys/arch_386.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = I386 - BigEndian = false - DefaultPhysPageSize = 4096 - PCQuantum = 1 - Int64Align = 4 - MinFrameSize = 0 + _ArchFamily = I386 + _DefaultPhysPageSize = 4096 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize ) - -type Uintreg uint32 diff --git a/src/runtime/internal/sys/arch_amd64.go b/src/runtime/internal/sys/arch_amd64.go index 3d6776e71e..7f003d0f1d 100644 --- a/src/runtime/internal/sys/arch_amd64.go +++ b/src/runtime/internal/sys/arch_amd64.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = AMD64 - BigEndian = false - DefaultPhysPageSize = 4096 - PCQuantum = 1 - Int64Align = 8 - MinFrameSize = 0 + _ArchFamily = AMD64 + _DefaultPhysPageSize = 4096 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_arm.go b/src/runtime/internal/sys/arch_arm.go index 97960d6f83..ef2048bb71 100644 --- a/src/runtime/internal/sys/arch_arm.go +++ b/src/runtime/internal/sys/arch_arm.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = ARM - BigEndian = false - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 4 - MinFrameSize = 4 + _ArchFamily = ARM + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize ) - -type Uintreg uint32 diff --git a/src/runtime/internal/sys/arch_arm64.go b/src/runtime/internal/sys/arch_arm64.go index 911a9485e1..b9f2f7b1fe 100644 --- a/src/runtime/internal/sys/arch_arm64.go +++ b/src/runtime/internal/sys/arch_arm64.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = ARM64 - BigEndian = false - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 8 - MinFrameSize = 8 + _ArchFamily = ARM64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = 16 ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_mips.go b/src/runtime/internal/sys/arch_mips.go index 75cdb2e07f..4cb0eebea7 100644 --- a/src/runtime/internal/sys/arch_mips.go +++ b/src/runtime/internal/sys/arch_mips.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = MIPS - BigEndian = true - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 4 - MinFrameSize = 4 + _ArchFamily = MIPS + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize ) - -type Uintreg uint32 diff --git a/src/runtime/internal/sys/arch_mips64.go b/src/runtime/internal/sys/arch_mips64.go index 494291a802..57636ac4a4 100644 --- a/src/runtime/internal/sys/arch_mips64.go +++ b/src/runtime/internal/sys/arch_mips64.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = MIPS64 - BigEndian = true - DefaultPhysPageSize = 16384 - PCQuantum = 4 - Int64Align = 8 - MinFrameSize = 8 + _ArchFamily = MIPS64 + _DefaultPhysPageSize = 16384 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_mips64le.go b/src/runtime/internal/sys/arch_mips64le.go index d36d1202f6..57636ac4a4 100644 --- a/src/runtime/internal/sys/arch_mips64le.go +++ b/src/runtime/internal/sys/arch_mips64le.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = MIPS64 - BigEndian = false - DefaultPhysPageSize = 16384 - PCQuantum = 4 - Int64Align = 8 - MinFrameSize = 8 + _ArchFamily = MIPS64 + _DefaultPhysPageSize = 16384 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_mipsle.go b/src/runtime/internal/sys/arch_mipsle.go index 323bf82059..4240f5ce47 100644 --- a/src/runtime/internal/sys/arch_mipsle.go +++ b/src/runtime/internal/sys/arch_mipsle.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = MIPS - BigEndian = false - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 4 - MinFrameSize = 4 + _ArchFamily = MIPS + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 4 + _StackAlign = PtrSize ) - -type Uintreg uint32 diff --git a/src/runtime/internal/sys/arch_ppc64.go b/src/runtime/internal/sys/arch_ppc64.go index da1fe3d596..1869213ce2 100644 --- a/src/runtime/internal/sys/arch_ppc64.go +++ b/src/runtime/internal/sys/arch_ppc64.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = PPC64 - BigEndian = true - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 8 - MinFrameSize = 32 + _ArchFamily = PPC64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 32 + _StackAlign = 16 ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_ppc64le.go b/src/runtime/internal/sys/arch_ppc64le.go index 605979903a..1869213ce2 100644 --- a/src/runtime/internal/sys/arch_ppc64le.go +++ b/src/runtime/internal/sys/arch_ppc64le.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = PPC64 - BigEndian = false - DefaultPhysPageSize = 65536 - PCQuantum = 4 - Int64Align = 8 - MinFrameSize = 32 + _ArchFamily = PPC64 + _DefaultPhysPageSize = 65536 + _PCQuantum = 4 + _MinFrameSize = 32 + _StackAlign = 16 ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_riscv64.go b/src/runtime/internal/sys/arch_riscv64.go index 7cdcc8fcbd..360d236e32 100644 --- a/src/runtime/internal/sys/arch_riscv64.go +++ b/src/runtime/internal/sys/arch_riscv64.go @@ -5,14 +5,9 @@ package sys const ( - ArchFamily = RISCV64 - BigEndian = false - CacheLineSize = 64 - DefaultPhysPageSize = 4096 - PCQuantum = 4 - Int64Align = 8 - HugePageSize = 1 << 21 - MinFrameSize = 8 + _ArchFamily = RISCV64 + _DefaultPhysPageSize = 4096 + _PCQuantum = 4 + _MinFrameSize = 8 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_s390x.go b/src/runtime/internal/sys/arch_s390x.go index 12cb8a0fcb..e33e0b7f2b 100644 --- a/src/runtime/internal/sys/arch_s390x.go +++ b/src/runtime/internal/sys/arch_s390x.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = S390X - BigEndian = true - DefaultPhysPageSize = 4096 - PCQuantum = 2 - Int64Align = 8 - MinFrameSize = 8 + _ArchFamily = S390X + _DefaultPhysPageSize = 4096 + _PCQuantum = 2 + _MinFrameSize = 8 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/arch_wasm.go b/src/runtime/internal/sys/arch_wasm.go index eb825df626..ee919ff9e6 100644 --- a/src/runtime/internal/sys/arch_wasm.go +++ b/src/runtime/internal/sys/arch_wasm.go @@ -5,12 +5,9 @@ package sys const ( - ArchFamily = WASM - BigEndian = false - DefaultPhysPageSize = 65536 - PCQuantum = 1 - Int64Align = 8 - MinFrameSize = 0 + _ArchFamily = WASM + _DefaultPhysPageSize = 65536 + _PCQuantum = 1 + _MinFrameSize = 0 + _StackAlign = PtrSize ) - -type Uintreg uint64 diff --git a/src/runtime/internal/sys/stubs.go b/src/runtime/internal/sys/stubs.go deleted file mode 100644 index 10b0173f60..0000000000 --- a/src/runtime/internal/sys/stubs.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sys - -// Declarations for runtime services implemented in C or assembly. - -const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const -const RegSize = 4 << (^Uintreg(0) >> 63) // unsafe.Sizeof(uintreg(0)) but an ideal const -const SpAlign = 1*(1-GoarchArm64) + 16*GoarchArm64 // SP alignment: 1 normally, 16 for ARM64 - -var DefaultGoroot string // set at link time - -// AIX requires a larger stack for syscalls. -const StackGuardMultiplier = StackGuardMultiplierDefault*(1-GoosAix) + 2*GoosAix diff --git a/src/runtime/os3_plan9.go b/src/runtime/os3_plan9.go index 15ca3359d2..b6ee98cab6 100644 --- a/src/runtime/os3_plan9.go +++ b/src/runtime/os3_plan9.go @@ -92,10 +92,6 @@ func sighandler(_ureg *ureg, note *byte, gp *g) int { if usesLR { c.setlr(pc) } else { - if sys.RegSize > sys.PtrSize { - sp -= sys.PtrSize - *(*uintptr)(unsafe.Pointer(sp)) = 0 - } sp -= sys.PtrSize *(*uintptr)(unsafe.Pointer(sp)) = pc c.setsp(sp) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 4092dd55cb..1dbd01ed40 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1900,7 +1900,7 @@ func oneNewExtraM() { gp := malg(4096) gp.sched.pc = funcPC(goexit) + sys.PCQuantum gp.sched.sp = gp.stack.hi - gp.sched.sp -= 4 * sys.RegSize // extra space in case of reads slightly beyond frame + gp.sched.sp -= 4 * sys.PtrSize // extra space in case of reads slightly beyond frame gp.sched.lr = 0 gp.sched.g = guintptr(unsafe.Pointer(gp)) gp.syscallpc = gp.sched.pc @@ -4009,9 +4009,9 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp // We could allocate a larger initial stack if necessary. // Not worth it: this is almost always an error. - // 4*sizeof(uintreg): extra space added below - // sizeof(uintreg): caller's LR (arm) or return address (x86, in gostartcall). - if siz >= _StackMin-4*sys.RegSize-sys.RegSize { + // 4*PtrSize: extra space added below + // PtrSize: caller's LR (arm) or return address (x86, in gostartcall). + if siz >= _StackMin-4*sys.PtrSize-sys.PtrSize { throw("newproc: function arguments too large for new goroutine") } @@ -4030,8 +4030,8 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp throw("newproc1: new g is not Gdead") } - totalSize := 4*sys.RegSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame - totalSize += -totalSize & (sys.SpAlign - 1) // align to spAlign + totalSize := 4*sys.PtrSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame + totalSize += -totalSize & (sys.StackAlign - 1) // align to StackAlign sp := newg.stack.hi - totalSize spArg := sp if usesLR { diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index b7c7b4cff2..675c613b6e 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -327,7 +327,7 @@ type gobuf struct { pc uintptr g guintptr ctxt unsafe.Pointer - ret sys.Uintreg + ret uintptr lr uintptr bp uintptr // for framepointer-enabled architectures } diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go index e5d2d97d05..4572a25195 100644 --- a/src/runtime/runtime_test.go +++ b/src/runtime/runtime_test.go @@ -266,8 +266,8 @@ func TestTrailingZero(t *testing.T) { n int64 z struct{} } - if unsafe.Sizeof(T2{}) != 8+unsafe.Sizeof(Uintreg(0)) { - t.Errorf("sizeof(%#v)==%d, want %d", T2{}, unsafe.Sizeof(T2{}), 8+unsafe.Sizeof(Uintreg(0))) + if unsafe.Sizeof(T2{}) != 8+unsafe.Sizeof(uintptr(0)) { + t.Errorf("sizeof(%#v)==%d, want %d", T2{}, unsafe.Sizeof(T2{}), 8+unsafe.Sizeof(uintptr(0))) } type T3 struct { n byte diff --git a/src/runtime/signal_arm64.go b/src/runtime/signal_arm64.go index 3c20139c99..b559b93938 100644 --- a/src/runtime/signal_arm64.go +++ b/src/runtime/signal_arm64.go @@ -63,7 +63,7 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) { // functions are correctly handled. This smashes // the stack frame but we're not going back there // anyway. - sp := c.sp() - sys.SpAlign // needs only sizeof uint64, but must align the stack + sp := c.sp() - sys.StackAlign // needs only sizeof uint64, but must align the stack c.set_sp(sp) *(*uint64)(unsafe.Pointer(uintptr(sp))) = c.lr() diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 7b9dce5393..8c90e7b46f 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -651,7 +651,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool { // Adjust saved base pointer if there is one. // TODO what about arm64 frame pointer adjustment? - if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.RegSize { + if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.PtrSize { if stackDebug >= 3 { print(" saved bp\n") } @@ -1245,7 +1245,7 @@ func getStackMap(frame *stkframe, cache *pcvalueCache, debug bool) (locals, args var minsize uintptr switch sys.ArchFamily { case sys.ARM64: - minsize = sys.SpAlign + minsize = sys.StackAlign default: minsize = sys.MinFrameSize } diff --git a/src/runtime/sys_wasm.go b/src/runtime/sys_wasm.go index 9bf710ba0e..3ed621f92e 100644 --- a/src/runtime/sys_wasm.go +++ b/src/runtime/sys_wasm.go @@ -30,10 +30,6 @@ func wasmExit(code int32) // and then did an immediate gosave. func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { sp := buf.sp - if sys.RegSize > sys.PtrSize { - sp -= sys.PtrSize - *(*uintptr)(unsafe.Pointer(sp)) = 0 - } sp -= sys.PtrSize *(*uintptr)(unsafe.Pointer(sp)) = buf.pc buf.sp = sp diff --git a/src/runtime/sys_x86.go b/src/runtime/sys_x86.go index f917cb8bd7..5b7a666679 100644 --- a/src/runtime/sys_x86.go +++ b/src/runtime/sys_x86.go @@ -15,10 +15,6 @@ import ( // and then did an immediate gosave. func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { sp := buf.sp - if sys.RegSize > sys.PtrSize { - sp -= sys.PtrSize - *(*uintptr)(unsafe.Pointer(sp)) = 0 - } sp -= sys.PtrSize *(*uintptr)(unsafe.Pointer(sp)) = buf.pc buf.sp = sp diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 2601cd697f..127f54e42e 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -144,8 +144,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in frame.pc = *(*uintptr)(unsafe.Pointer(frame.sp)) frame.lr = 0 } else { - frame.pc = uintptr(*(*sys.Uintreg)(unsafe.Pointer(frame.sp))) - frame.sp += sys.RegSize + frame.pc = uintptr(*(*uintptr)(unsafe.Pointer(frame.sp))) + frame.sp += sys.PtrSize } } @@ -208,7 +208,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in frame.fp = frame.sp + uintptr(funcspdelta(f, frame.pc, &cache)) if !usesLR { // On x86, call instruction pushes return PC before entering new function. - frame.fp += sys.RegSize + frame.fp += sys.PtrSize } } var flr funcInfo @@ -235,8 +235,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in } } else { if frame.lr == 0 { - lrPtr = frame.fp - sys.RegSize - frame.lr = uintptr(*(*sys.Uintreg)(unsafe.Pointer(lrPtr))) + lrPtr = frame.fp - sys.PtrSize + frame.lr = uintptr(*(*uintptr)(unsafe.Pointer(lrPtr))) } } flr = findfunc(frame.lr) @@ -266,13 +266,13 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in frame.varp = frame.fp if !usesLR { // On x86, call instruction pushes return PC before entering new function. - frame.varp -= sys.RegSize + frame.varp -= sys.PtrSize } // For architectures with frame pointers, if there's // a frame, then there's a saved frame pointer here. if frame.varp > frame.sp && (GOARCH == "amd64" || GOARCH == "arm64") { - frame.varp -= sys.RegSize + frame.varp -= sys.PtrSize } // Derive size of arguments. @@ -490,11 +490,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in // before faking a call. if usesLR && injectedCall { x := *(*uintptr)(unsafe.Pointer(frame.sp)) - frame.sp += sys.MinFrameSize - if GOARCH == "arm64" { - // arm64 needs 16-byte aligned SP, always - frame.sp += sys.PtrSize - } + frame.sp += alignUp(sys.MinFrameSize, sys.StackAlign) f = findfunc(frame.pc) frame.fn = f if !f.valid() { -- cgit v1.3-5-g9baa From a78879ac67d62c4919492fcb5e05c8b21058217d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 10:47:38 -0500 Subject: runtime: move sys.DefaultGoroot to runtime.defaultGOROOT The default GOROOT has nothing to do with system details. Move it next to its one use in package runtime. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I1a601fad6335336b4616b834bb21bd8437ee1313 Reviewed-on: https://go-review.googlesource.com/c/go/+/288796 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/cmd/link/internal/ld/main.go | 2 +- src/runtime/extern.go | 4 +++- src/runtime/internal/sys/arch.go | 4 ---- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go index cbd811846b..68dee18598 100644 --- a/src/cmd/link/internal/ld/main.go +++ b/src/cmd/link/internal/ld/main.go @@ -116,7 +116,7 @@ func Main(arch *sys.Arch, theArch Arch) { } final := gorootFinal() - addstrdata1(ctxt, "runtime/internal/sys.DefaultGoroot="+final) + addstrdata1(ctxt, "runtime.defaultGOROOT="+final) addstrdata1(ctxt, "cmd/internal/objabi.defaultGOROOT="+final) // TODO(matloob): define these above and then check flag values here diff --git a/src/runtime/extern.go b/src/runtime/extern.go index dacdf4f383..bbe41dd0d4 100644 --- a/src/runtime/extern.go +++ b/src/runtime/extern.go @@ -229,6 +229,8 @@ func Callers(skip int, pc []uintptr) int { return callers(skip, pc) } +var defaultGOROOT string // set by cmd/link + // GOROOT returns the root of the Go tree. It uses the // GOROOT environment variable, if set at process start, // or else the root used during the Go build. @@ -237,7 +239,7 @@ func GOROOT() string { if s != "" { return s } - return sys.DefaultGoroot + return defaultGOROOT } // Version returns the Go tree's version string. diff --git a/src/runtime/internal/sys/arch.go b/src/runtime/internal/sys/arch.go index 69278bf2d5..3c99a2f7da 100644 --- a/src/runtime/internal/sys/arch.go +++ b/src/runtime/internal/sys/arch.go @@ -52,7 +52,3 @@ const MinFrameSize = _MinFrameSize // StackAlign is the required alignment of the SP register. // The stack must be at least word aligned, but some architectures require more. const StackAlign = _StackAlign - -// DefaultGoroot is set by the linker for use by package runtime. -// It doesn't really belong in this file or this package. -var DefaultGoroot string -- cgit v1.3-5-g9baa From c80da0a33a240469892a0b0713f09607efb28752 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:00:21 -0500 Subject: runtime: handle nil gp in cpuprof This can happen on Windows when recording profile samples for system threads. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I5a7ba32b1900a69f3b7acada9cb6cf8396d8a03f Reviewed-on: https://go-review.googlesource.com/c/go/+/288797 Trust: Russ Cox Reviewed-by: Cherry Zhang Reviewed-by: Ian Lance Taylor --- src/runtime/cpuprof.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index 9bfdfe7c74..e5d0193b9c 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -103,7 +103,16 @@ func (p *cpuProfile) add(gp *g, stk []uintptr) { // because otherwise its write barrier behavior may not // be correct. See the long comment there before // changing the argument here. - cpuprof.log.write(&gp.labels, nanotime(), hdr[:], stk) + // + // Note: it can happen on Windows, where we are calling + // p.add with a gp that is not the current g, that gp is nil, + // meaning we interrupted a system thread with no g. + // Avoid faulting in that case. + var tagPtr *unsafe.Pointer + if gp != nil { + tagPtr = &gp.labels + } + cpuprof.log.write(tagPtr, nanotime(), hdr[:], stk) } atomic.Store(&prof.signalLock, 0) -- cgit v1.3-5-g9baa From 229695a2833ead7bbee53071f52f34e2ce1c2802 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 09:32:55 -0500 Subject: runtime: clean up funcID assignment Large enum sets should be sorted by name when the values don't matter, as they don't here. Do that. Also replace the large switch with a map lookup. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: Ibe727b5d8866bf4c40c96020e1f4632bde7efd59 Reviewed-on: https://go-review.googlesource.com/c/go/+/288798 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld Reviewed-by: Ian Lance Taylor --- src/cmd/internal/objabi/funcid.go | 113 ++++++++++++++++---------------------- src/runtime/symtab.go | 26 ++++----- 2 files changed, 61 insertions(+), 78 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go index 1d098ee172..e921a82c0c 100644 --- a/src/cmd/internal/objabi/funcid.go +++ b/src/cmd/internal/objabi/funcid.go @@ -4,6 +4,8 @@ package objabi +import "strings" + // A FuncID identifies particular functions that need to be treated // specially by the runtime. // Note that in some situations involving plugins, there may be multiple @@ -13,88 +15,69 @@ type FuncID uint8 const ( FuncID_normal FuncID = iota // not a special function - FuncID_runtime_main + FuncID_asmcgocall + FuncID_asyncPreempt + FuncID_cgocallback + FuncID_debugCallV1 + FuncID_externalthreadhandler + FuncID_gcBgMarkWorker FuncID_goexit + FuncID_gogo + FuncID_gopanic + FuncID_handleAsyncEvent FuncID_jmpdefer FuncID_mcall FuncID_morestack FuncID_mstart + FuncID_panicwrap FuncID_rt0_go - FuncID_asmcgocall - FuncID_sigpanic FuncID_runfinq - FuncID_gcBgMarkWorker - FuncID_systemstack_switch + FuncID_runtime_main + FuncID_sigpanic FuncID_systemstack - FuncID_cgocallback - FuncID_gogo - FuncID_externalthreadhandler - FuncID_debugCallV1 - FuncID_gopanic - FuncID_panicwrap - FuncID_handleAsyncEvent - FuncID_asyncPreempt + FuncID_systemstack_switch FuncID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) ) +var funcIDs = map[string]FuncID{ + "asmcgocall": FuncID_asmcgocall, + "asyncPreempt": FuncID_asyncPreempt, + "cgocallback": FuncID_cgocallback, + "debugCallV1": FuncID_debugCallV1, + "externalthreadhandler": FuncID_externalthreadhandler, + "gcBgMarkWorker": FuncID_gcBgMarkWorker, + "go": FuncID_rt0_go, + "goexit": FuncID_goexit, + "gogo": FuncID_gogo, + "gopanic": FuncID_gopanic, + "handleAsyncEvent": FuncID_handleAsyncEvent, + "jmpdefer": FuncID_jmpdefer, + "main": FuncID_runtime_main, + "mcall": FuncID_mcall, + "morestack": FuncID_morestack, + "mstart": FuncID_mstart, + "panicwrap": FuncID_panicwrap, + "runfinq": FuncID_runfinq, + "sigpanic": FuncID_sigpanic, + "switch": FuncID_systemstack_switch, + "systemstack": FuncID_systemstack, + + // Don't show in call stack but otherwise not special. + "deferreturn": FuncID_wrapper, + "runOpenDeferFrame": FuncID_wrapper, + "reflectcallSave": FuncID_wrapper, +} + // Get the function ID for the named function in the named file. // The function should be package-qualified. func GetFuncID(name string, isWrapper bool) FuncID { if isWrapper { return FuncID_wrapper } - switch name { - case "runtime.main": - return FuncID_runtime_main - case "runtime.goexit": - return FuncID_goexit - case "runtime.jmpdefer": - return FuncID_jmpdefer - case "runtime.mcall": - return FuncID_mcall - case "runtime.morestack": - return FuncID_morestack - case "runtime.mstart": - return FuncID_mstart - case "runtime.rt0_go": - return FuncID_rt0_go - case "runtime.asmcgocall": - return FuncID_asmcgocall - case "runtime.sigpanic": - return FuncID_sigpanic - case "runtime.runfinq": - return FuncID_runfinq - case "runtime.gcBgMarkWorker": - return FuncID_gcBgMarkWorker - case "runtime.systemstack_switch": - return FuncID_systemstack_switch - case "runtime.systemstack": - return FuncID_systemstack - case "runtime.cgocallback": - return FuncID_cgocallback - case "runtime.gogo": - return FuncID_gogo - case "runtime.externalthreadhandler": - return FuncID_externalthreadhandler - case "runtime.debugCallV1": - return FuncID_debugCallV1 - case "runtime.gopanic": - return FuncID_gopanic - case "runtime.panicwrap": - return FuncID_panicwrap - case "runtime.handleAsyncEvent": - return FuncID_handleAsyncEvent - case "runtime.asyncPreempt": - return FuncID_asyncPreempt - case "runtime.deferreturn": - // Don't show in the call stack (used when invoking defer functions) - return FuncID_wrapper - case "runtime.runOpenDeferFrame": - // Don't show in the call stack (used when invoking defer functions) - return FuncID_wrapper - case "runtime.reflectcallSave": - // Don't show in the call stack (used when invoking defer functions) - return FuncID_wrapper + if strings.HasPrefix(name, "runtime.") { + if id, ok := funcIDs[name[len("runtime."):]]; ok { + return id + } } return FuncID_normal } diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index 7667f23f1d..fc93c00c2d 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -308,27 +308,27 @@ type funcID uint8 const ( funcID_normal funcID = iota // not a special function - funcID_runtime_main + funcID_asmcgocall + funcID_asyncPreempt + funcID_cgocallback + funcID_debugCallV1 + funcID_externalthreadhandler + funcID_gcBgMarkWorker funcID_goexit + funcID_gogo + funcID_gopanic + funcID_handleAsyncEvent funcID_jmpdefer funcID_mcall funcID_morestack funcID_mstart + funcID_panicwrap funcID_rt0_go - funcID_asmcgocall - funcID_sigpanic funcID_runfinq - funcID_gcBgMarkWorker - funcID_systemstack_switch + funcID_runtime_main + funcID_sigpanic funcID_systemstack - funcID_cgocallback - funcID_gogo - funcID_externalthreadhandler - funcID_debugCallV1 - funcID_gopanic - funcID_panicwrap - funcID_handleAsyncEvent - funcID_asyncPreempt + funcID_systemstack_switch funcID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) ) -- cgit v1.3-5-g9baa From 01f05d8ff1a88c4a63bdaaff5a095a92ce476f58 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 1 Feb 2021 22:58:28 -0500 Subject: runtime: unify asmcgocall and systemstack traceback setup Both asmcgocall and systemstack need to save the calling Go code's context for use by traceback, but they do it differently. Systemstack's appraoch is better, because it doesn't require a special case in traceback. So make them both use that. While we are here, the fake mstart caller in systemstack is no longer needed and can be removed. (traceback knows to stop in systemstack because of the writes to SP.) Also remove the fake mstarts in sys_windows_*.s. And while we are there, fix the control flow guard code in sys_windows_arm.s. The current code is using pointers to a stack frame that technically is gone once we hit the RET instruction. Clearly it's working OK, but better not to depend on data below SP being preserved, even for just a few instructions. Store the value we need in other registers instead. (This code is only used for pushing a sigpanic call, which does not actually return to the site of the fault and therefore doesn't need to preserve any of the registers.) This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: Id1e3ef5e54f7ad786e4b87043f2626eba7c3bbd9 Reviewed-on: https://go-review.googlesource.com/c/go/+/288799 Trust: Russ Cox Reviewed-by: Cherry Zhang --- misc/cgo/test/callback.go | 2 +- src/runtime/asm_386.s | 19 +++++++--------- src/runtime/asm_amd64.s | 22 ++++++++---------- src/runtime/asm_arm.s | 34 +++++++++++++--------------- src/runtime/asm_arm64.s | 31 +++++++++++-------------- src/runtime/asm_mips64x.s | 26 ++++++++++----------- src/runtime/asm_mipsx.s | 26 ++++++++++----------- src/runtime/asm_ppc64x.s | 28 ++++++++++------------- src/runtime/asm_riscv64.s | 26 ++++++++++----------- src/runtime/asm_s390x.s | 29 +++++++++++------------- src/runtime/sys_windows_386.s | 12 ++++------ src/runtime/sys_windows_amd64.s | 12 +++------- src/runtime/sys_windows_arm.s | 50 +++++++++++++++++++---------------------- 13 files changed, 137 insertions(+), 180 deletions(-) (limited to 'src/runtime') diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go index 814888e3ac..08dd9b39d8 100644 --- a/misc/cgo/test/callback.go +++ b/misc/cgo/test/callback.go @@ -182,7 +182,7 @@ func testCallbackCallers(t *testing.T) { "runtime.cgocallbackg1", "runtime.cgocallbackg", "runtime.cgocallback", - "runtime.asmcgocall", + "runtime.systemstack_switch", "runtime.cgocall", "test._Cfunc_callback", "test.nestedCall.func1", diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index 3030101f03..a59054226c 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -352,18 +352,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-4 // switch stacks // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVL $runtime·systemstack_switch(SB), (g_sched+gobuf_pc)(AX) - MOVL SP, (g_sched+gobuf_sp)(AX) - MOVL AX, (g_sched+gobuf_g)(AX) + CALL gosave_systemstack_switch<>(SB) // switch to g0 get_tls(CX) MOVL DX, g(CX) MOVL (g_sched+gobuf_sp)(DX), BX - // make it look like mstart called systemstack on g0, to stop traceback - SUBL $4, BX - MOVL $runtime·mstart(SB), DX - MOVL DX, 0(BX) MOVL BX, SP // call target function @@ -601,15 +595,18 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-8 MOVL 0(DX), BX JMP BX // but first run the deferred function -// Save state of caller into g->sched. -TEXT gosave<>(SB),NOSPLIT,$0 +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT,$0 PUSHL AX PUSHL BX get_tls(BX) MOVL g(BX), BX LEAL arg+0(FP), AX MOVL AX, (g_sched+gobuf_sp)(BX) - MOVL -4(AX), AX + MOVL $runtime·systemstack_switch(SB), AX MOVL AX, (g_sched+gobuf_pc)(BX) MOVL $0, (g_sched+gobuf_ret)(BX) // Assert ctxt is zero. See func save. @@ -661,7 +658,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12 JEQ noswitch CMPL DI, m_gsignal(BP) JEQ noswitch - CALL gosave<>(SB) + CALL gosave_systemstack_switch<>(SB) get_tls(CX) MOVL SI, g(CX) MOVL (g_sched+gobuf_sp)(SI), SP diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 9362ce1213..cd5ce3effb 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -338,20 +338,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 // switch stacks // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVQ $runtime·systemstack_switch(SB), SI - MOVQ SI, (g_sched+gobuf_pc)(AX) - MOVQ SP, (g_sched+gobuf_sp)(AX) - MOVQ AX, (g_sched+gobuf_g)(AX) - MOVQ BP, (g_sched+gobuf_bp)(AX) + CALL gosave_systemstack_switch<>(SB) // switch to g0 MOVQ DX, g(CX) MOVQ DX, R14 // set the g register MOVQ (g_sched+gobuf_sp)(DX), BX - // make it look like mstart called systemstack on g0, to stop traceback - SUBQ $8, BX - MOVQ $runtime·mstart(SB), DX - MOVQ DX, 0(BX) MOVQ BX, SP // call target function @@ -660,13 +652,17 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16 MOVQ 0(DX), BX JMP BX // but first run the deferred function -// Save state of caller into g->sched. Smashes R9. -TEXT gosave<>(SB),NOSPLIT,$0 +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R9. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT,$0 #ifndef GOEXPERIMENT_REGABI get_tls(R14) MOVQ g(R14), R14 #endif - MOVQ 0(SP), R9 + MOVQ $runtime·systemstack_switch(SB), R9 MOVQ R9, (g_sched+gobuf_pc)(R14) LEAQ 8(SP), R9 MOVQ R9, (g_sched+gobuf_sp)(R14) @@ -724,7 +720,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 // Switch to system stack. MOVQ m_g0(R8), SI - CALL gosave<>(SB) + CALL gosave_systemstack_switch<>(SB) MOVQ SI, g(CX) MOVQ (g_sched+gobuf_sp)(SI), SP diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 109030aada..c8c53e70db 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -305,24 +305,14 @@ TEXT runtime·systemstack(SB),NOSPLIT,$0-4 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVW $runtime·systemstack_switch(SB), R3 - ADD $4, R3, R3 // get past push {lr} - MOVW R3, (g_sched+gobuf_pc)(g) - MOVW R13, (g_sched+gobuf_sp)(g) - MOVW LR, (g_sched+gobuf_lr)(g) - MOVW g, (g_sched+gobuf_g)(g) + BL gosave_systemstack_switch<>(SB) // switch to g0 MOVW R0, R5 MOVW R2, R0 BL setg<>(SB) MOVW R5, R0 - MOVW (g_sched+gobuf_sp)(R2), R3 - // make it look like mstart called systemstack on g0, to stop traceback - SUB $4, R3, R3 - MOVW $runtime·mstart(SB), R4 - MOVW R4, 0(R3) - MOVW R3, R13 + MOVW (g_sched+gobuf_sp)(R2), R13 // call target function MOVW R0, R7 @@ -537,19 +527,25 @@ TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8 MOVW 0(R7), R1 B (R1) -// Save state of caller into g->sched. Smashes R11. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVW LR, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R11. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·systemstack_switch(SB), R11 + ADD $4, R11 // get past push {lr} + MOVW R11, (g_sched+gobuf_pc)(g) MOVW R13, (g_sched+gobuf_sp)(g) + MOVW g, (g_sched+gobuf_g)(g) MOVW $0, R11 MOVW R11, (g_sched+gobuf_lr)(g) MOVW R11, (g_sched+gobuf_ret)(g) - MOVW R11, (g_sched+gobuf_ctxt)(g) // Assert ctxt is zero. See func save. MOVW (g_sched+gobuf_ctxt)(g), R11 - CMP $0, R11 + TST R11, R11 B.EQ 2(PC) - CALL runtime·badctxt(SB) + BL runtime·badctxt(SB) RET // func asmcgocall_no_g(fn, arg unsafe.Pointer) @@ -590,7 +586,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12 MOVW m_g0(R8), R3 CMP R3, g BEQ nosave - BL gosave<>(SB) + BL gosave_systemstack_switch<>(SB) MOVW R0, R5 MOVW R3, R0 BL setg<>(SB) diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 79efd4cb17..31a6fe57b9 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -205,24 +205,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVD $runtime·systemstack_switch(SB), R6 - ADD $8, R6 // get past prologue - MOVD R6, (g_sched+gobuf_pc)(g) - MOVD RSP, R0 - MOVD R0, (g_sched+gobuf_sp)(g) - MOVD R29, (g_sched+gobuf_bp)(g) - MOVD $0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) + BL gosave_systemstack_switch<>(SB) // switch to g0 MOVD R5, g BL runtime·save_g(SB) MOVD (g_sched+gobuf_sp)(g), R3 - // make it look like mstart called systemstack on g0, to stop traceback - SUB $16, R3 - AND $~15, R3 - MOVD $runtime·mstart(SB), R4 - MOVD R4, 0(R3) MOVD R3, RSP MOVD (g_sched+gobuf_bp)(g), R29 @@ -859,14 +847,21 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16 MOVD 0(R26), R3 B (R3) -// Save state of caller into g->sched. Smashes R0. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVD LR, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R0. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVD $runtime·systemstack_switch(SB), R0 + ADD $8, R0 // get past prologue + MOVD R0, (g_sched+gobuf_pc)(g) MOVD RSP, R0 MOVD R0, (g_sched+gobuf_sp)(g) MOVD R29, (g_sched+gobuf_bp)(g) MOVD $0, (g_sched+gobuf_lr)(g) MOVD $0, (g_sched+gobuf_ret)(g) + MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R0 CBZ R0, 2(PC) @@ -908,8 +903,8 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 BEQ nosave // Switch to system stack. - MOVD R0, R9 // gosave<> and save_g might clobber R0 - BL gosave<>(SB) + MOVD R0, R9 // gosave_systemstack_switch<> and save_g might clobber R0 + BL gosave_systemstack_switch<>(SB) MOVD R3, g BL runtime·save_g(SB) MOVD (g_sched+gobuf_sp)(g), R0 diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 6e1d25cd90..75bb223066 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -169,21 +169,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVV $runtime·systemstack_switch(SB), R4 - ADDV $8, R4 // get past prologue - MOVV R4, (g_sched+gobuf_pc)(g) - MOVV R29, (g_sched+gobuf_sp)(g) - MOVV R0, (g_sched+gobuf_lr)(g) - MOVV g, (g_sched+gobuf_g)(g) + JAL gosave_systemstack_switch<>(SB) // switch to g0 MOVV R3, g JAL runtime·save_g(SB) MOVV (g_sched+gobuf_sp)(g), R1 - // make it look like mstart called systemstack on g0, to stop traceback - ADDV $-8, R1 - MOVV $runtime·mstart(SB), R2 - MOVV R2, 0(R1) MOVV R1, R29 // call target function @@ -401,12 +392,19 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16 MOVV 0(REGCTXT), R4 JMP (R4) -// Save state of caller into g->sched. Smashes R1. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVV R31, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R1. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVV $runtime·systemstack_switch(SB), R1 + ADDV $8, R1 // get past prologue + MOVV R1, (g_sched+gobuf_pc)(g) MOVV R29, (g_sched+gobuf_sp)(g) MOVV R0, (g_sched+gobuf_lr)(g) MOVV R0, (g_sched+gobuf_ret)(g) + MOVV g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVV (g_sched+gobuf_ctxt)(g), R1 BEQ R1, 2(PC) @@ -440,7 +438,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 MOVV m_g0(R5), R6 BEQ R6, g, g0 - JAL gosave<>(SB) + JAL gosave_systemstack_switch<>(SB) MOVV R6, g JAL runtime·save_g(SB) MOVV (g_sched+gobuf_sp)(g), R29 diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index 8e5753d255..341da8e8d7 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -170,21 +170,12 @@ TEXT runtime·systemstack(SB),NOSPLIT,$0-4 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVW $runtime·systemstack_switch(SB), R4 - ADDU $8, R4 // get past prologue - MOVW R4, (g_sched+gobuf_pc)(g) - MOVW R29, (g_sched+gobuf_sp)(g) - MOVW R0, (g_sched+gobuf_lr)(g) - MOVW g, (g_sched+gobuf_g)(g) + JAL gosave_systemstack_switch<>(SB) // switch to g0 MOVW R3, g JAL runtime·save_g(SB) MOVW (g_sched+gobuf_sp)(g), R1 - // make it look like mstart called systemstack on g0, to stop traceback - ADDU $-4, R1 - MOVW $runtime·mstart(SB), R2 - MOVW R2, 0(R1) MOVW R1, R29 // call target function @@ -401,12 +392,19 @@ TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8 MOVW 0(REGCTXT), R4 JMP (R4) -// Save state of caller into g->sched. Smashes R1. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVW R31, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R1. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·systemstack_switch(SB), R1 + ADDU $8, R1 // get past prologue + MOVW R1, (g_sched+gobuf_pc)(g) MOVW R29, (g_sched+gobuf_sp)(g) MOVW R0, (g_sched+gobuf_lr)(g) MOVW R0, (g_sched+gobuf_ret)(g) + MOVW g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVW (g_sched+gobuf_ctxt)(g), R1 BEQ R1, 2(PC) @@ -431,7 +429,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12 MOVW m_g0(R5), R6 BEQ R6, g, g0 - JAL gosave<>(SB) + JAL gosave_systemstack_switch<>(SB) MOVW R6, g JAL runtime·save_g(SB) MOVW (g_sched+gobuf_sp)(g), R29 diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 834023cce1..a99a61fd88 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -229,22 +229,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVD $runtime·systemstack_switch(SB), R6 - ADD $16, R6 // get past prologue (including r2-setting instructions when they're there) - MOVD R6, (g_sched+gobuf_pc)(g) - MOVD R1, (g_sched+gobuf_sp)(g) - MOVD R0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) + BL gosave_systemstack_switch<>(SB) // switch to g0 MOVD R5, g BL runtime·save_g(SB) - MOVD (g_sched+gobuf_sp)(g), R3 - // make it look like mstart called systemstack on g0, to stop traceback - SUB $FIXED_FRAME, R3 - MOVD $runtime·mstart(SB), R4 - MOVD R4, 0(R3) - MOVD R3, R1 + MOVD (g_sched+gobuf_sp)(g), R1 // call target function MOVD 0(R11), R12 // code pointer @@ -534,13 +524,19 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16 MOVD R12, CTR BR (CTR) -// Save state of caller into g->sched. Smashes R31. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVD LR, R31 +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R31. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVD $runtime·systemstack_switch(SB), R31 + ADD $16, R31 // get past prologue (including r2-setting instructions when they're there) MOVD R31, (g_sched+gobuf_pc)(g) MOVD R1, (g_sched+gobuf_sp)(g) MOVD R0, (g_sched+gobuf_lr)(g) MOVD R0, (g_sched+gobuf_ret)(g) + MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R31 CMP R0, R31 @@ -577,7 +573,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 MOVD m_g0(R8), R6 CMP R6, g BEQ g0 - BL gosave<>(SB) + BL gosave_systemstack_switch<>(SB) MOVD R6, g BL runtime·save_g(SB) MOVD (g_sched+gobuf_sp)(g), R1 diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index 3d0349471a..fb7c6530dc 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -114,21 +114,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOV $runtime·systemstack_switch(SB), T2 - ADD $8, T2 // get past prologue - MOV T2, (g_sched+gobuf_pc)(g) - MOV X2, (g_sched+gobuf_sp)(g) - MOV ZERO, (g_sched+gobuf_lr)(g) - MOV g, (g_sched+gobuf_g)(g) + CALL gosave_systemstack_switch<>(SB) // switch to g0 MOV T1, g CALL runtime·save_g(SB) MOV (g_sched+gobuf_sp)(g), T0 - // make it look like mstart called systemstack on g0, to stop traceback - ADD $-8, T0 - MOV $runtime·mstart(SB), T1 - MOV T1, 0(T0) MOV T0, X2 // call target function @@ -297,12 +288,19 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 JALR RA, T1 JMP runtime·badmcall2(SB) -// Save state of caller into g->sched. Smashes X31. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOV X1, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes X31. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOV $runtime·systemstack_switch(SB), X31 + ADD $8, X31 // get past prologue + MOV X31, (g_sched+gobuf_pc)(g) MOV X2, (g_sched+gobuf_sp)(g) MOV ZERO, (g_sched+gobuf_lr)(g) MOV ZERO, (g_sched+gobuf_ret)(g) + MOV g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOV (g_sched+gobuf_ctxt)(g), X31 BEQ ZERO, X31, 2(PC) @@ -327,7 +325,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 MOV m_g0(X6), X7 BEQ X7, g, g0 - CALL gosave<>(SB) + CALL gosave_systemstack_switch<>(SB) MOV X7, g CALL runtime·save_g(SB) MOV (g_sched+gobuf_sp)(g), X2 diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index fbd185c353..43244d961f 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -256,22 +256,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. - MOVD $runtime·systemstack_switch(SB), R6 - ADD $16, R6 // get past prologue - MOVD R6, (g_sched+gobuf_pc)(g) - MOVD R15, (g_sched+gobuf_sp)(g) - MOVD $0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) + BL gosave_systemstack_switch<>(SB) // switch to g0 MOVD R5, g BL runtime·save_g(SB) - MOVD (g_sched+gobuf_sp)(g), R3 - // make it look like mstart called systemstack on g0, to stop traceback - SUB $8, R3 - MOVD $runtime·mstart(SB), R4 - MOVD R4, 0(R3) - MOVD R3, R15 + MOVD (g_sched+gobuf_sp)(g), R15 // call target function MOVD 0(R12), R3 // code pointer @@ -498,12 +488,19 @@ TEXT runtime·jmpdefer(SB),NOSPLIT|NOFRAME,$0-16 MOVD 0(R12), R3 BR (R3) -// Save state of caller into g->sched. Smashes R1. -TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0 - MOVD LR, (g_sched+gobuf_pc)(g) +// Save state of caller into g->sched, +// but using fake PC from systemstack_switch. +// Must only be called from functions with no locals ($0) +// or else unwinding from systemstack_switch is incorrect. +// Smashes R1. +TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 + MOVD $runtime·systemstack_switch(SB), R1 + ADD $16, R1 // get past prologue + MOVD R1, (g_sched+gobuf_pc)(g) MOVD R15, (g_sched+gobuf_sp)(g) MOVD $0, (g_sched+gobuf_lr)(g) MOVD $0, (g_sched+gobuf_ret)(g) + MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R1 CMPBEQ R1, $0, 2(PC) @@ -529,7 +526,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20 MOVD g_m(g), R6 MOVD m_g0(R6), R6 CMPBEQ R6, g, g0 - BL gosave<>(SB) + BL gosave_systemstack_switch<>(SB) MOVD R6, g BL runtime·save_g(SB) MOVD (g_sched+gobuf_sp)(g), R15 diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index c556e3a3c2..576dd28771 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -94,7 +94,7 @@ TEXT sigtramp<>(SB),NOSPLIT,$0-0 JNE 2(PC) CALL runtime·badsignal2(SB) - // save g and SP in case of stack switch + // save g in case of stack switch MOVL DX, 32(SP) // g MOVL SP, 36(SP) @@ -108,13 +108,9 @@ TEXT sigtramp<>(SB),NOSPLIT,$0-0 get_tls(BP) MOVL BX, g(BP) MOVL (g_sched+gobuf_sp)(BX), DI - // make it look like mstart called us on g0, to stop traceback - SUBL $4, DI - MOVL $runtime·mstart(SB), 0(DI) - // traceback will think that we've done SUBL - // on this stack, so subtract them here to match. - // (we need room for sighandler arguments anyway). + // make room for sighandler arguments // and re-save old SP for restoring later. + // (note that the 36(DI) here must match the 36(SP) above.) SUBL $40, DI MOVL SP, 36(DI) MOVL DI, SP @@ -132,7 +128,7 @@ g0: // switch back to original stack and g // no-op if we never left. MOVL 36(SP), SP - MOVL 32(SP), DX + MOVL 32(SP), DX // note: different SP get_tls(BP) MOVL DX, g(BP) diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 9cd14016b0..6f2abb5444 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -151,16 +151,10 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0-0 get_tls(BP) MOVQ BX, g(BP) MOVQ (g_sched+gobuf_sp)(BX), DI - // make it look like mstart called us on g0, to stop traceback - SUBQ $8, DI - MOVQ $runtime·mstart(SB), SI - MOVQ SI, 0(DI) - // traceback will think that we've done PUSHFQ and SUBQ - // on this stack, so subtract them here to match. - // (we need room for sighandler arguments anyway). + // make room for sighandler arguments // and re-save old SP for restoring later. - SUBQ $(112+8), DI - // save g, save old stack pointer. + // (note that the 104(DI) here must match the 104(SP) above.) + SUBQ $120, DI MOVQ SP, 104(DI) MOVQ DI, SP diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index d2bdc50e3b..7d134dd3f4 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -6,6 +6,8 @@ #include "go_tls.h" #include "textflag.h" +// Note: For system ABI, R0-R3 are args, R4-R11 are callee-save. + // void runtime·asmstdcall(void *c); TEXT runtime·asmstdcall(SB),NOSPLIT|NOFRAME,$0 MOVM.DB.W [R4, R5, R14], (R13) // push {r4, r5, lr} @@ -139,11 +141,10 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0 MOVW (g_sched+gobuf_sp)(g), R3 // R3 = g->gobuf.sp BL runtime·save_g(SB) - // traceback will think that we've done PUSH and SUB - // on this stack, so subtract them here to match. - // (we need room for sighandler arguments anyway). + // make room for sighandler arguments // and re-save old SP for restoring later. - SUB $(40+8+20), R3 + // (note that the 24(R3) here must match the 24(R13) above.) + SUB $40, R3 MOVW R13, 24(R3) // save old stack pointer MOVW R3, R13 // switch stack @@ -151,22 +152,14 @@ g0: MOVW 0(R6), R2 // R2 = ExceptionPointers->ExceptionRecord MOVW 4(R6), R3 // R3 = ExceptionPointers->ContextRecord - // make it look like mstart called us on g0, to stop traceback - MOVW $runtime·mstart(SB), R4 - - MOVW R4, 0(R13) // Save link register for traceback + MOVW $0, R4 + MOVW R4, 0(R13) // No saved link register. MOVW R2, 4(R13) // Move arg0 (ExceptionRecord) into position MOVW R3, 8(R13) // Move arg1 (ContextRecord) into position MOVW R5, 12(R13) // Move arg2 (original g) into position BL (R7) // Call the go routine MOVW 16(R13), R4 // Fetch return value from stack - // Compute the value of the g0 stack pointer after deallocating - // this frame, then allocating 8 bytes. We may need to store - // the resume SP and PC on the g0 stack to work around - // control flow guard when we resume from the exception. - ADD $(40+20), R13, R12 - // switch back to original stack and g MOVW 24(R13), R13 MOVW 20(R13), g @@ -192,33 +185,36 @@ done: // If returntramp has already been set up by a previous exception // handler, don't clobber the stored SP and PC on the stack. MOVW 4(R3), R3 // PEXCEPTION_POINTERS->Context - MOVW 0x40(R3), R2 // load PC from context record + MOVW context_pc(R3), R2 // load PC from context record MOVW $returntramp<>(SB), R1 CMP R1, R2 B.EQ return // do not clobber saved SP/PC - // Save resume SP and PC on g0 stack - MOVW 0x38(R3), R2 // load SP from context record - MOVW R2, 0(R12) // Store resume SP on g0 stack - MOVW 0x40(R3), R2 // load PC from context record - MOVW R2, 4(R12) // Store resume PC on g0 stack + // Save resume SP and PC into R0, R1. + MOVW context_spr(R3), R2 + MOVW R2, context_r0(R3) + MOVW context_pc(R3), R2 + MOVW R2, context_r1(R3) // Set up context record to return to returntramp on g0 stack - MOVW R12, 0x38(R3) // save g0 stack pointer - // in context record - MOVW $returntramp<>(SB), R2 // save resume address - MOVW R2, 0x40(R3) // in context record + MOVW R12, context_spr(R3) + MOVW $returntramp<>(SB), R2 + MOVW R2, context_pc(R3) return: B (R14) // return -// // Trampoline to resume execution from exception handler. // This is part of the control flow guard workaround. // It switches stacks and jumps to the continuation address. -// +// R0 and R1 are set above at the end of sigtramp<> +// in the context that starts executing at returntramp<>. TEXT returntramp<>(SB),NOSPLIT|NOFRAME,$0 - MOVM.IA (R13), [R13, R15] // ldm sp, [sp, pc] + // Important: do not smash LR, + // which is set to a live value when handling + // a signal by pushing a call to sigpanic onto the stack. + MOVW R0, R13 + B (R1) TEXT runtime·exceptiontramp(SB),NOSPLIT|NOFRAME,$0 MOVW $runtime·exceptionhandler(SB), R1 -- cgit v1.3-5-g9baa From aa0388f2ed937669e9f938da8a65c75ea144ebfd Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 15 Feb 2021 09:25:55 -0500 Subject: runtime: remove unnecessary writes to gp.sched.g A g's sched.g is set in newproc1: newg.sched.g = guintptr(unsafe.Pointer(newg)) After that, it never changes. Yet lots of assembly code does "g.sched.g = g" unnecessarily. Remove all those lines to avoid confusion about whether it ever changes. Also, split gogo into two functions, one that does the nil g check and a second that does the actual switch. This way, if the nil g check fails, we get a stack trace showing the call stack that led to the failure. (The SP write would otherwise cause the stack trace to abort.) Also restore the proper nil g check in a handful of assembly functions. (There is little point in checking for nil g *after* installing it as the real g.) Change-Id: I22866b093f901f765de1d074e36eeec10366abfb Reviewed-on: https://go-review.googlesource.com/c/go/+/292109 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/asm_386.s | 7 ++++--- src/runtime/asm_amd64.s | 7 ++++--- src/runtime/asm_arm.s | 19 +++++-------------- src/runtime/asm_arm64.s | 12 +++++++----- src/runtime/asm_mips64x.s | 11 +++++++---- src/runtime/asm_mipsx.s | 13 +++++++------ src/runtime/asm_ppc64x.s | 12 +++++++----- src/runtime/asm_riscv64.s | 12 +++++++----- src/runtime/asm_s390x.s | 11 +++++++---- src/runtime/asm_wasm.s | 7 +++---- src/runtime/proc.go | 24 ++++++++++++++++++++---- 11 files changed, 78 insertions(+), 57 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index a59054226c..fcf74a03cf 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -275,10 +275,13 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $8-4 +TEXT runtime·gogo(SB), NOSPLIT, $0-4 MOVL buf+0(FP), BX // gobuf MOVL gobuf_g(BX), DX MOVL 0(DX), CX // make sure g != nil + JMP gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT, $0 get_tls(CX) MOVL DX, g(CX) MOVL gobuf_sp(BX), SP // restore SP @@ -303,7 +306,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-4 MOVL BX, (g_sched+gobuf_pc)(AX) LEAL fn+0(FP), BX // caller's SP MOVL BX, (g_sched+gobuf_sp)(AX) - MOVL AX, (g_sched+gobuf_g)(AX) // switch to m->g0 & its stack, call fn MOVL g(DX), BX @@ -432,7 +434,6 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 // Set g->sched to context in f. MOVL 0(SP), AX // f's PC MOVL AX, (g_sched+gobuf_pc)(SI) - MOVL SI, (g_sched+gobuf_g)(SI) LEAL 4(SP), AX // f's SP MOVL AX, (g_sched+gobuf_sp)(SI) MOVL DX, (g_sched+gobuf_ctxt)(SI) diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index cd5ce3effb..8ee2ac2123 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -256,10 +256,13 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 // func gogo(buf *gobuf) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $16-8 +TEXT runtime·gogo(SB), NOSPLIT, $0-8 MOVQ buf+0(FP), BX // gobuf MOVQ gobuf_g(BX), DX MOVQ 0(DX), CX // make sure g != nil + JMP gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT, $0 get_tls(CX) MOVQ DX, g(CX) MOVQ DX, R14 // set the g register @@ -287,7 +290,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8 MOVQ BX, (g_sched+gobuf_pc)(AX) LEAQ fn+0(FP), BX // caller's SP MOVQ BX, (g_sched+gobuf_sp)(AX) - MOVQ AX, (g_sched+gobuf_g)(AX) MOVQ BP, (g_sched+gobuf_bp)(AX) // switch to m->g0 & its stack, call fn @@ -418,7 +420,6 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 // Set g->sched to context in f. MOVQ 0(SP), AX // f's PC MOVQ AX, (g_sched+gobuf_pc)(SI) - MOVQ SI, (g_sched+gobuf_g)(SI) LEAQ 8(SP), AX // f's SP MOVQ AX, (g_sched+gobuf_sp)(SI) MOVQ BP, (g_sched+gobuf_bp)(SI) diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index c8c53e70db..92d7854306 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -208,21 +208,14 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB),NOSPLIT,$8-4 +TEXT runtime·gogo(SB),NOSPLIT|NOFRAME,$0-4 MOVW buf+0(FP), R1 MOVW gobuf_g(R1), R0 - BL setg<>(SB) + MOVW 0(R0), R2 // make sure g != nil + B gogo<>(SB) - // NOTE: We updated g above, and we are about to update SP. - // Until LR and PC are also updated, the g/SP/LR/PC quadruple - // are out of sync and must not be used as the basis of a traceback. - // Sigprof skips the traceback when SP is not within g's bounds, - // and when the PC is inside this function, runtime.gogo. - // Since we are about to update SP, until we complete runtime.gogo - // we must not leave this function. In particular, no calls - // after this point: it must be straight-line code until the - // final B instruction. - // See large comment in sigprof for more details. +TEXT gogo<>(SB),NOSPLIT|NOFRAME,$0 + BL setg<>(SB) MOVW gobuf_sp(R1), R13 // restore SP==R13 MOVW gobuf_lr(R1), LR MOVW gobuf_ret(R1), R0 @@ -246,7 +239,6 @@ TEXT runtime·mcall(SB),NOSPLIT|NOFRAME,$0-4 MOVW LR, (g_sched+gobuf_pc)(g) MOVW $0, R11 MOVW R11, (g_sched+gobuf_lr)(g) - MOVW g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVW g, R1 @@ -537,7 +529,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 ADD $4, R11 // get past push {lr} MOVW R11, (g_sched+gobuf_pc)(g) MOVW R13, (g_sched+gobuf_sp)(g) - MOVW g, (g_sched+gobuf_g)(g) MOVW $0, R11 MOVW R11, (g_sched+gobuf_lr)(g) MOVW R11, (g_sched+gobuf_ret)(g) diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 31a6fe57b9..4f0a680fa4 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -115,12 +115,16 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $24-8 +TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOVD buf+0(FP), R5 - MOVD gobuf_g(R5), g + MOVD gobuf_g(R5), R6 + MOVD 0(R6), R4 // make sure g != nil + B gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 + MOVD R6, g BL runtime·save_g(SB) - MOVD 0(g), R4 // make sure g is not nil MOVD gobuf_sp(R5), R0 MOVD R0, RSP MOVD gobuf_bp(R5), R29 @@ -147,7 +151,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 MOVD R29, (g_sched+gobuf_bp)(g) MOVD LR, (g_sched+gobuf_pc)(g) MOVD $0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVD g, R3 @@ -861,7 +864,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOVD R29, (g_sched+gobuf_bp)(g) MOVD $0, (g_sched+gobuf_lr)(g) MOVD $0, (g_sched+gobuf_ret)(g) - MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R0 CBZ R0, 2(PC) diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index 75bb223066..f6d8931a15 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -91,9 +91,14 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $16-8 +TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOVV buf+0(FP), R3 - MOVV gobuf_g(R3), g // make sure g is not nil + MOVV gobuf_g(R3), R4 + MOVV 0(R4), R5 // make sure g != nil + JMP gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 + MOVV R5, g JAL runtime·save_g(SB) MOVV 0(g), R2 @@ -117,7 +122,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 MOVV R29, (g_sched+gobuf_sp)(g) MOVV R31, (g_sched+gobuf_pc)(g) MOVV R0, (g_sched+gobuf_lr)(g) - MOVV g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVV g, R1 @@ -404,7 +408,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOVV R29, (g_sched+gobuf_sp)(g) MOVV R0, (g_sched+gobuf_lr)(g) MOVV R0, (g_sched+gobuf_ret)(g) - MOVV g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVV (g_sched+gobuf_ctxt)(g), R1 BEQ R1, 2(PC) diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index 341da8e8d7..cf4b1b42cc 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -92,12 +92,15 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB),NOSPLIT,$8-4 +TEXT runtime·gogo(SB),NOSPLIT|NOFRAME,$0-4 MOVW buf+0(FP), R3 - MOVW gobuf_g(R3), g // make sure g is not nil - JAL runtime·save_g(SB) + MOVW gobuf_g(R3), R4 + MOVW 0(R4), R5 // make sure g != nil + JMP gogo<>(SB) - MOVW 0(g), R2 +TEXT gogo<>(SB),NOSPLIT|NOFRAME,$0 + MOVW R4, g + JAL runtime·save_g(SB) MOVW gobuf_sp(R3), R29 MOVW gobuf_lr(R3), R31 MOVW gobuf_ret(R3), R1 @@ -118,7 +121,6 @@ TEXT runtime·mcall(SB),NOSPLIT|NOFRAME,$0-4 MOVW R29, (g_sched+gobuf_sp)(g) MOVW R31, (g_sched+gobuf_pc)(g) MOVW R0, (g_sched+gobuf_lr)(g) - MOVW g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVW g, R1 @@ -404,7 +406,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOVW R29, (g_sched+gobuf_sp)(g) MOVW R0, (g_sched+gobuf_lr)(g) MOVW R0, (g_sched+gobuf_ret)(g) - MOVW g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVW (g_sched+gobuf_ctxt)(g), R1 BEQ R1, 2(PC) diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index a99a61fd88..90f14d8e54 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -130,12 +130,16 @@ TEXT runtime·reginit(SB),NOSPLIT|NOFRAME,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $16-8 +TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOVD buf+0(FP), R5 - MOVD gobuf_g(R5), g // make sure g is not nil + MOVD gobuf_g(R5), R6 + MOVD 0(R6), R4 // make sure g != nil + BR gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 + MOVD R6, g BL runtime·save_g(SB) - MOVD 0(g), R4 MOVD gobuf_sp(R5), R1 MOVD gobuf_lr(R5), R31 #ifndef GOOS_aix @@ -163,7 +167,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 MOVD LR, R31 MOVD R31, (g_sched+gobuf_pc)(g) MOVD R0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVD g, R3 @@ -536,7 +539,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOVD R1, (g_sched+gobuf_sp)(g) MOVD R0, (g_sched+gobuf_lr)(g) MOVD R0, (g_sched+gobuf_ret)(g) - MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R31 CMP R0, R31 diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index fb7c6530dc..d06c77b948 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -224,12 +224,16 @@ TEXT runtime·return0(SB), NOSPLIT, $0 // restore state from Gobuf; longjmp // func gogo(buf *gobuf) -TEXT runtime·gogo(SB), NOSPLIT, $16-8 +TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOV buf+0(FP), T0 - MOV gobuf_g(T0), g // make sure g is not nil + MOV gobuf_g(T0), T1 + MOV 0(T1), ZERO // make sure g != nil + JMP gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 + MOV T1, g CALL runtime·save_g(SB) - MOV (g), ZERO // make sure g is not nil MOV gobuf_sp(T0), X2 MOV gobuf_lr(T0), RA MOV gobuf_ret(T0), A0 @@ -270,7 +274,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8 MOV X2, (g_sched+gobuf_sp)(g) MOV RA, (g_sched+gobuf_pc)(g) MOV ZERO, (g_sched+gobuf_lr)(g) - MOV g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOV g, T0 @@ -300,7 +303,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOV X2, (g_sched+gobuf_sp)(g) MOV ZERO, (g_sched+gobuf_lr)(g) MOV ZERO, (g_sched+gobuf_ret)(g) - MOV g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOV (g_sched+gobuf_ctxt)(g), X31 BEQ ZERO, X31, 2(PC) diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index 43244d961f..203754f32c 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -176,9 +176,14 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 // void gogo(Gobuf*) // restore state from Gobuf; longjmp -TEXT runtime·gogo(SB), NOSPLIT, $16-8 +TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOVD buf+0(FP), R5 - MOVD gobuf_g(R5), g // make sure g is not nil + MOVD gobuf_g(R5), R6 + MOVD 0(R6), R7 // make sure g != nil + BR gogo<>(SB) + +TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 + MOVD R6, g BL runtime·save_g(SB) MOVD 0(g), R4 @@ -203,7 +208,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $-8-8 MOVD R15, (g_sched+gobuf_sp)(g) MOVD LR, (g_sched+gobuf_pc)(g) MOVD $0, (g_sched+gobuf_lr)(g) - MOVD g, (g_sched+gobuf_g)(g) // Switch to m->g0 & its stack, call fn. MOVD g, R3 @@ -500,7 +504,6 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0 MOVD R15, (g_sched+gobuf_sp)(g) MOVD $0, (g_sched+gobuf_lr)(g) MOVD $0, (g_sched+gobuf_ret)(g) - MOVD g, (g_sched+gobuf_g)(g) // Assert ctxt is zero. See func save. MOVD (g_sched+gobuf_ctxt)(g), R1 CMPBEQ R1, $0, 2(PC) diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s index cf3d961b74..3765c756b3 100644 --- a/src/runtime/asm_wasm.s +++ b/src/runtime/asm_wasm.s @@ -34,7 +34,9 @@ TEXT ·checkASM(SB), NOSPLIT, $0-1 TEXT runtime·gogo(SB), NOSPLIT, $0-8 MOVD buf+0(FP), R0 - MOVD gobuf_g(R0), g + MOVD gobuf_g(R0), R1 + MOVD 0(R1), R2 // make sure g != nil + MOVD R1, g MOVD gobuf_sp(R0), SP // Put target PC at -8(SP), wasm_pc_f_loop will pick it up @@ -69,7 +71,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8 // save state in g->sched MOVD 0(SP), g_sched+gobuf_pc(g) // caller's PC MOVD $fn+0(FP), g_sched+gobuf_sp(g) // caller's SP - MOVD g, g_sched+gobuf_g(g) // if g == g0 call badmcall Get g @@ -143,7 +144,6 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8 MOVD $runtime·systemstack_switch(SB), g_sched+gobuf_pc(g) MOVD SP, g_sched+gobuf_sp(g) - MOVD g, g_sched+gobuf_g(g) // switch to g0 MOVD R2, g @@ -270,7 +270,6 @@ TEXT runtime·morestack(SB), NOSPLIT, $0-0 // Set g->sched to context in f. MOVD 0(SP), g_sched+gobuf_pc(g) - MOVD g, g_sched+gobuf_g(g) MOVD $8(SP), g_sched+gobuf_sp(g) // f's SP MOVD CTXT, g_sched+gobuf_ctxt(g) diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 1dbd01ed40..388d843004 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1281,6 +1281,9 @@ func mstart() { mexit(osStack) } +// The go:noinline is to guarantee the getcallerpc/getcallersp below are safe, +// so that we can set up g0.sched to return to the call of mstart1 above. +//go:noinline func mstart1() { _g_ := getg() @@ -1288,11 +1291,16 @@ func mstart1() { throw("bad runtime·mstart") } - // Record the caller for use as the top of stack in mcall and - // for terminating the thread. + // Set up m.g0.sched as a label returning returning to just + // after the mstart1 call in mstart0 above, for use by goexit0 and mcall. // We're never coming back to mstart1 after we call schedule, // so other calls can reuse the current frame. - save(getcallerpc(), getcallersp()) + // And goexit0 does a gogo that needs to return from mstart1 + // and let mstart0 exit the thread. + _g_.sched.g = guintptr(unsafe.Pointer(_g_)) + _g_.sched.pc = getcallerpc() + _g_.sched.sp = getcallersp() + asminit() minit() @@ -3445,11 +3453,19 @@ func goexit0(gp *g) { func save(pc, sp uintptr) { _g_ := getg() + if _g_ == _g_.m.g0 || _g_ == _g_.m.gsignal { + // m.g0.sched is special and must describe the context + // for exiting the thread. mstart1 writes to it directly. + // m.gsignal.sched should not be used at all. + // This check makes sure save calls do not accidentally + // run in contexts where they'd write to system g's. + throw("save on system g not allowed") + } + _g_.sched.pc = pc _g_.sched.sp = sp _g_.sched.lr = 0 _g_.sched.ret = 0 - _g_.sched.g = guintptr(unsafe.Pointer(_g_)) // We need to ensure ctxt is zero, but can't have a write // barrier here. However, it should always already be zero. // Assert that. -- cgit v1.3-5-g9baa From 4dd77bdc910494adcd57fe9d87cd46f72d8d8985 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 15:21:33 -0500 Subject: cmd/asm, cmd/link, runtime: introduce FuncInfo flag bits The runtime traceback code has its own definition of which functions mark the top frame of a stack, separate from the TOPFRAME bits that exist in the assembly and are passed along in DWARF information. It's error-prone and redundant to have two different sources of truth. This CL provides the actual TOPFRAME bits to the runtime, so that the runtime can use those bits instead of reinventing its own category. This CL also adds a new bit, SPWRITE, which marks functions that write directly to SP (anything but adding and subtracting constants). Such functions must stop a traceback, because the traceback has no way to rederive the SP on entry. Again, the runtime has its own definition which is mostly correct, but also missing some functions. During ordinary goroutine context switches, such functions do not appear on the stack, so the incompleteness in the runtime usually doesn't matter. But profiling signals can arrive at any moment, and the runtime may crash during traceback if it attempts to unwind an SP-writing frame and gets out-of-sync with the actual stack. The runtime contains code to try to detect likely candidates but again it is incomplete. Deriving the SPWRITE bit automatically from the actual assembly code provides the complete truth, and passing it to the runtime lets the runtime use it. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I227f53b23ac5b3dabfcc5e8ee3f00df4e113cf58 Reviewed-on: https://go-review.googlesource.com/c/go/+/288800 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/cmd/asm/internal/asm/endtoend_test.go | 2 + src/cmd/asm/internal/flags/flags.go | 2 + src/cmd/asm/main.go | 1 + src/cmd/compile/internal/test/fixedbugs_test.go | 2 +- src/cmd/compile/internal/test/global_test.go | 4 +- src/cmd/internal/goobj/funcinfo.go | 60 ++++++------------------- src/cmd/internal/goobj/objfile.go | 2 - src/cmd/internal/obj/arm/obj5.go | 16 +++++++ src/cmd/internal/obj/arm64/obj7.go | 16 +++++++ src/cmd/internal/obj/link.go | 23 ++++++---- src/cmd/internal/obj/mips/obj0.go | 16 +++++++ src/cmd/internal/obj/objfile.go | 12 +++-- src/cmd/internal/obj/plist.go | 10 ++++- src/cmd/internal/obj/ppc64/obj9.go | 16 +++++++ src/cmd/internal/obj/riscv/obj.go | 16 +++++++ src/cmd/internal/obj/s390x/objz.go | 16 +++++++ src/cmd/internal/obj/util.go | 2 +- src/cmd/internal/obj/x86/obj6.go | 15 +++++++ src/cmd/internal/objabi/funcid.go | 11 ++++- src/cmd/link/internal/ld/dwarf.go | 4 +- src/cmd/link/internal/ld/pcln.go | 9 +++- src/cmd/link/internal/loader/loader.go | 37 +++++---------- src/runtime/runtime2.go | 9 ++-- src/runtime/symtab.go | 9 ++++ 24 files changed, 209 insertions(+), 101 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go index 7472507caf..a4153f3af1 100644 --- a/src/cmd/asm/internal/asm/endtoend_test.go +++ b/src/cmd/asm/internal/asm/endtoend_test.go @@ -36,6 +36,7 @@ func testEndToEnd(t *testing.T, goarch, file string) { var ok bool testOut = new(bytes.Buffer) // The assembler writes test output to this buffer. ctxt.Bso = bufio.NewWriter(os.Stdout) + ctxt.IsAsm = true defer ctxt.Bso.Flush() failed := false ctxt.DiagFunc = func(format string, args ...interface{}) { @@ -278,6 +279,7 @@ func testErrors(t *testing.T, goarch, file string) { var ok bool testOut = new(bytes.Buffer) // The assembler writes test output to this buffer. ctxt.Bso = bufio.NewWriter(os.Stdout) + ctxt.IsAsm = true defer ctxt.Bso.Flush() failed := false var errBuf bytes.Buffer diff --git a/src/cmd/asm/internal/flags/flags.go b/src/cmd/asm/internal/flags/flags.go index 1335860315..dd947c7b5b 100644 --- a/src/cmd/asm/internal/flags/flags.go +++ b/src/cmd/asm/internal/flags/flags.go @@ -32,11 +32,13 @@ var ( D MultiFlag I MultiFlag PrintOut int + DebugV bool ) func init() { flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifier=value; can be set multiple times") flag.Var(&I, "I", "include directory; can be set multiple times") + flag.BoolVar(&DebugV, "v", false, "print debug output") objabi.AddVersionFlag() // -V objabi.Flagcount("S", "print assembly and machine code", &PrintOut) } diff --git a/src/cmd/asm/main.go b/src/cmd/asm/main.go index 31636e3045..98618a67ef 100644 --- a/src/cmd/asm/main.go +++ b/src/cmd/asm/main.go @@ -36,6 +36,7 @@ func main() { ctxt := obj.Linknew(architecture.LinkArch) ctxt.Debugasm = flags.PrintOut + ctxt.Debugvlog = flags.DebugV ctxt.Flag_dynlink = *flags.Dynlink ctxt.Flag_linkshared = *flags.Linkshared ctxt.Flag_shared = *flags.Shared || *flags.Dynlink diff --git a/src/cmd/compile/internal/test/fixedbugs_test.go b/src/cmd/compile/internal/test/fixedbugs_test.go index e7e2f7e58e..376b45edfc 100644 --- a/src/cmd/compile/internal/test/fixedbugs_test.go +++ b/src/cmd/compile/internal/test/fixedbugs_test.go @@ -75,7 +75,7 @@ func TestIssue16214(t *testing.T) { cmd := exec.Command(testenv.GoToolPath(t), "tool", "compile", "-S", "-o", filepath.Join(dir, "out.o"), src) out, err := cmd.CombinedOutput() if err != nil { - t.Fatalf("fail to run go tool compile: %v", err) + t.Fatalf("go tool compile: %v\n%s", err, out) } if strings.Contains(string(out), "unknown line number") { diff --git a/src/cmd/compile/internal/test/global_test.go b/src/cmd/compile/internal/test/global_test.go index 5f5f7d6198..93de894f37 100644 --- a/src/cmd/compile/internal/test/global_test.go +++ b/src/cmd/compile/internal/test/global_test.go @@ -50,7 +50,7 @@ func main() { cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", dst, src) out, err := cmd.CombinedOutput() if err != nil { - t.Fatalf("could not build target: %v", err) + t.Fatalf("could not build target: %v\n%s", err, out) } // Check destination to see if scanf code was included. @@ -95,7 +95,7 @@ func main() { cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags", "-S", "-o", filepath.Join(dir, "test"), src) out, err := cmd.CombinedOutput() if err != nil { - t.Fatalf("could not build target: %v", err) + t.Fatalf("could not build target: %v\n%s", err, out) } patterns := []string{ diff --git a/src/cmd/internal/goobj/funcinfo.go b/src/cmd/internal/goobj/funcinfo.go index 2cca8f6c4e..6d33a10a51 100644 --- a/src/cmd/internal/goobj/funcinfo.go +++ b/src/cmd/internal/goobj/funcinfo.go @@ -19,9 +19,10 @@ type CUFileIndex uint32 // // TODO: make each pcdata a separate symbol? type FuncInfo struct { - Args uint32 - Locals uint32 - FuncID objabi.FuncID + Args uint32 + Locals uint32 + FuncID objabi.FuncID + FuncFlag objabi.FuncFlag Pcsp SymRef Pcfile SymRef @@ -35,6 +36,9 @@ type FuncInfo struct { } func (a *FuncInfo) Write(w *bytes.Buffer) { + writeUint8 := func(x uint8) { + w.WriteByte(x) + } var b [4]byte writeUint32 := func(x uint32) { binary.LittleEndian.PutUint32(b[:], x) @@ -47,8 +51,10 @@ func (a *FuncInfo) Write(w *bytes.Buffer) { writeUint32(a.Args) writeUint32(a.Locals) - writeUint32(uint32(a.FuncID)) - + writeUint8(uint8(a.FuncID)) + writeUint8(uint8(a.FuncFlag)) + writeUint8(0) // pad to uint32 boundary + writeUint8(0) writeSymRef(a.Pcsp) writeSymRef(a.Pcfile) writeSymRef(a.Pcline) @@ -72,46 +78,6 @@ func (a *FuncInfo) Write(w *bytes.Buffer) { } } -func (a *FuncInfo) Read(b []byte) { - readUint32 := func() uint32 { - x := binary.LittleEndian.Uint32(b) - b = b[4:] - return x - } - readSymIdx := func() SymRef { - return SymRef{readUint32(), readUint32()} - } - - a.Args = readUint32() - a.Locals = readUint32() - a.FuncID = objabi.FuncID(readUint32()) - - a.Pcsp = readSymIdx() - a.Pcfile = readSymIdx() - a.Pcline = readSymIdx() - a.Pcinline = readSymIdx() - a.Pcdata = make([]SymRef, readUint32()) - for i := range a.Pcdata { - a.Pcdata[i] = readSymIdx() - } - - funcdataofflen := readUint32() - a.Funcdataoff = make([]uint32, funcdataofflen) - for i := range a.Funcdataoff { - a.Funcdataoff[i] = readUint32() - } - filelen := readUint32() - a.File = make([]CUFileIndex, filelen) - for i := range a.File { - a.File[i] = CUFileIndex(readUint32()) - } - inltreelen := readUint32() - a.InlTree = make([]InlTreeNode, inltreelen) - for i := range a.InlTree { - b = a.InlTree[i].Read(b) - } -} - // FuncInfoLengths is a cache containing a roadmap of offsets and // lengths for things within a serialized FuncInfo. Each length field // stores the number of items (e.g. files, inltree nodes, etc), and the @@ -159,7 +125,9 @@ func (*FuncInfo) ReadArgs(b []byte) uint32 { return binary.LittleEndian.Uint32(b func (*FuncInfo) ReadLocals(b []byte) uint32 { return binary.LittleEndian.Uint32(b[4:]) } -func (*FuncInfo) ReadFuncID(b []byte) uint32 { return binary.LittleEndian.Uint32(b[8:]) } +func (*FuncInfo) ReadFuncID(b []byte) objabi.FuncID { return objabi.FuncID(b[8]) } + +func (*FuncInfo) ReadFuncFlag(b []byte) objabi.FuncFlag { return objabi.FuncFlag(b[9]) } func (*FuncInfo) ReadPcsp(b []byte) SymRef { return SymRef{binary.LittleEndian.Uint32(b[12:]), binary.LittleEndian.Uint32(b[16:])} diff --git a/src/cmd/internal/goobj/objfile.go b/src/cmd/internal/goobj/objfile.go index e6447e455d..d1b838f676 100644 --- a/src/cmd/internal/goobj/objfile.go +++ b/src/cmd/internal/goobj/objfile.go @@ -298,7 +298,6 @@ const ( SymFlagNoSplit SymFlagReflectMethod SymFlagGoType - SymFlagTopFrame ) // Sym.Flag2 @@ -332,7 +331,6 @@ func (s *Sym) Leaf() bool { return s.Flag()&SymFlagLeaf != 0 } func (s *Sym) NoSplit() bool { return s.Flag()&SymFlagNoSplit != 0 } func (s *Sym) ReflectMethod() bool { return s.Flag()&SymFlagReflectMethod != 0 } func (s *Sym) IsGoType() bool { return s.Flag()&SymFlagGoType != 0 } -func (s *Sym) TopFrame() bool { return s.Flag()&SymFlagTopFrame != 0 } func (s *Sym) UsedInIface() bool { return s.Flag2()&SymFlagUsedInIface != 0 } func (s *Sym) IsItab() bool { return s.Flag2()&SymFlagItab != 0 } diff --git a/src/cmd/internal/obj/arm/obj5.go b/src/cmd/internal/obj/arm/obj5.go index 29d3a5867d..7de04302d9 100644 --- a/src/cmd/internal/obj/arm/obj5.go +++ b/src/cmd/internal/obj/arm/obj5.go @@ -34,6 +34,7 @@ import ( "cmd/internal/obj" "cmd/internal/objabi" "cmd/internal/sys" + "log" ) var progedit_tlsfallback *obj.LSym @@ -613,6 +614,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Reg = REGSP } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { + f := c.cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } } diff --git a/src/cmd/internal/obj/arm64/obj7.go b/src/cmd/internal/obj/arm64/obj7.go index 0baf51973a..3b88543852 100644 --- a/src/cmd/internal/obj/arm64/obj7.go +++ b/src/cmd/internal/obj/arm64/obj7.go @@ -35,6 +35,7 @@ import ( "cmd/internal/objabi" "cmd/internal/src" "cmd/internal/sys" + "log" "math" ) @@ -970,6 +971,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p = q5 } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { + f := c.cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } } diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go index 8206902328..a48db3bdc8 100644 --- a/src/cmd/internal/obj/link.go +++ b/src/cmd/internal/obj/link.go @@ -454,6 +454,7 @@ type FuncInfo struct { Locals int32 Align int32 FuncID objabi.FuncID + FuncFlag objabi.FuncFlag Text *Prog Autot map[*LSym]struct{} Pcln Pcln @@ -619,10 +620,6 @@ const ( // target of an inline during compilation AttrWasInlined - // TopFrame means that this function is an entry point and unwinders should not - // keep unwinding beyond this frame. - AttrTopFrame - // Indexed indicates this symbol has been assigned with an index (when using the // new object file format). AttrIndexed @@ -663,7 +660,6 @@ func (a *Attribute) NeedCtxt() bool { return a.load()&AttrNeedCtxt != func (a *Attribute) NoFrame() bool { return a.load()&AttrNoFrame != 0 } func (a *Attribute) Static() bool { return a.load()&AttrStatic != 0 } func (a *Attribute) WasInlined() bool { return a.load()&AttrWasInlined != 0 } -func (a *Attribute) TopFrame() bool { return a.load()&AttrTopFrame != 0 } func (a *Attribute) Indexed() bool { return a.load()&AttrIndexed != 0 } func (a *Attribute) UsedInIface() bool { return a.load()&AttrUsedInIface != 0 } func (a *Attribute) ContentAddressable() bool { return a.load()&AttrContentAddressable != 0 } @@ -713,14 +709,13 @@ var textAttrStrings = [...]struct { {bit: AttrNoFrame, s: "NOFRAME"}, {bit: AttrStatic, s: "STATIC"}, {bit: AttrWasInlined, s: ""}, - {bit: AttrTopFrame, s: "TOPFRAME"}, {bit: AttrIndexed, s: ""}, {bit: AttrContentAddressable, s: ""}, {bit: AttrABIWrapper, s: "ABIWRAPPER"}, } -// TextAttrString formats a for printing in as part of a TEXT prog. -func (a Attribute) TextAttrString() string { +// String formats a for printing in as part of a TEXT prog. +func (a Attribute) String() string { var s string for _, x := range textAttrStrings { if a&x.bit != 0 { @@ -746,6 +741,18 @@ func (a Attribute) TextAttrString() string { return s } +// TextAttrString formats the symbol attributes for printing in as part of a TEXT prog. +func (s *LSym) TextAttrString() string { + attr := s.Attribute.String() + if s.Func().FuncFlag&objabi.FuncFlag_TOPFRAME != 0 { + if attr != "" { + attr += "|" + } + attr += "TOPFRAME" + } + return attr +} + func (s *LSym) String() string { return s.Name } diff --git a/src/cmd/internal/obj/mips/obj0.go b/src/cmd/internal/obj/mips/obj0.go index 135a8df3aa..91bba90d41 100644 --- a/src/cmd/internal/obj/mips/obj0.go +++ b/src/cmd/internal/obj/mips/obj0.go @@ -35,6 +35,7 @@ import ( "cmd/internal/sys" "encoding/binary" "fmt" + "log" "math" ) @@ -536,6 +537,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Reg = REGSP } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { + f := c.cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } if c.ctxt.Arch.Family == sys.MIPS { diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index bb58b4f0c2..85f0570e5d 100644 --- a/src/cmd/internal/obj/objfile.go +++ b/src/cmd/internal/obj/objfile.go @@ -330,9 +330,6 @@ func (w *writer) Sym(s *LSym) { if s.ReflectMethod() { flag |= goobj.SymFlagReflectMethod } - if s.TopFrame() { - flag |= goobj.SymFlagTopFrame - } if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' && s.Type == objabi.SRODATA { flag |= goobj.SymFlagGoType } @@ -673,9 +670,10 @@ func genFuncInfoSyms(ctxt *Link) { continue } o := goobj.FuncInfo{ - Args: uint32(fn.Args), - Locals: uint32(fn.Locals), - FuncID: objabi.FuncID(fn.FuncID), + Args: uint32(fn.Args), + Locals: uint32(fn.Locals), + FuncID: fn.FuncID, + FuncFlag: fn.FuncFlag, } pc := &fn.Pcln o.Pcsp = makeSymRef(preparePcSym(pc.Pcsp)) @@ -788,7 +786,7 @@ func (ctxt *Link) writeSymDebugNamed(s *LSym, name string) { if s.NoSplit() { fmt.Fprintf(ctxt.Bso, "nosplit ") } - if s.TopFrame() { + if s.Func() != nil && s.Func().FuncFlag&objabi.FuncFlag_TOPFRAME != 0 { fmt.Fprintf(ctxt.Bso, "topframe ") } fmt.Fprintf(ctxt.Bso, "size=%d", s.Size) diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go index 679ce7eb8f..177083261c 100644 --- a/src/cmd/internal/obj/plist.go +++ b/src/cmd/internal/obj/plist.go @@ -134,6 +134,7 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) { } name := strings.Replace(s.Name, "\"\"", ctxt.Pkgpath, -1) s.Func().FuncID = objabi.GetFuncID(name, flag&WRAPPER != 0) + s.Func().FuncFlag = toFuncFlag(flag) s.Set(AttrOnList, true) s.Set(AttrDuplicateOK, flag&DUPOK != 0) s.Set(AttrNoSplit, flag&NOSPLIT != 0) @@ -142,7 +143,6 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) { s.Set(AttrABIWrapper, flag&ABIWRAPPER != 0) s.Set(AttrNeedCtxt, flag&NEEDCTXT != 0) s.Set(AttrNoFrame, flag&NOFRAME != 0) - s.Set(AttrTopFrame, flag&TOPFRAME != 0) s.Type = objabi.STEXT ctxt.Text = append(ctxt.Text, s) @@ -150,6 +150,14 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) { ctxt.dwarfSym(s) } +func toFuncFlag(flag int) objabi.FuncFlag { + var out objabi.FuncFlag + if flag&TOPFRAME != 0 { + out |= objabi.FuncFlag_TOPFRAME + } + return out +} + func (ctxt *Link) Globl(s *LSym, size int64, flag int) { if s.OnList() { ctxt.Diag("symbol %s listed multiple times", s.Name) diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go index fddf552156..a77be29cf0 100644 --- a/src/cmd/internal/obj/ppc64/obj9.go +++ b/src/cmd/internal/obj/ppc64/obj9.go @@ -34,6 +34,7 @@ import ( "cmd/internal/objabi" "cmd/internal/src" "cmd/internal/sys" + "log" ) func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) { @@ -984,6 +985,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Reg = REGSP } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 && p.As != ACMPU { + f := c.cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } } diff --git a/src/cmd/internal/obj/riscv/obj.go b/src/cmd/internal/obj/riscv/obj.go index 5ef334dd6a..d104f1cfa5 100644 --- a/src/cmd/internal/obj/riscv/obj.go +++ b/src/cmd/internal/obj/riscv/obj.go @@ -25,6 +25,7 @@ import ( "cmd/internal/objabi" "cmd/internal/sys" "fmt" + "log" ) func buildop(ctxt *obj.Link) {} @@ -716,6 +717,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.Spadj = int32(-p.From.Offset) } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { + f := cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + f.FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } // Rewrite MOV pseudo-instructions. This cannot be done in diff --git a/src/cmd/internal/obj/s390x/objz.go b/src/cmd/internal/obj/s390x/objz.go index 970cf827d6..a02c4fc17f 100644 --- a/src/cmd/internal/obj/s390x/objz.go +++ b/src/cmd/internal/obj/s390x/objz.go @@ -33,6 +33,7 @@ import ( "cmd/internal/obj" "cmd/internal/objabi" "cmd/internal/sys" + "log" "math" ) @@ -545,6 +546,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.From.Reg = REGSP } } + + if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { + f := c.cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s\n", c.cursym.Name) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } } if wasSplit { c.stacksplitPost(pLast, pPre, pPreempt, autosize) // emit post part of split check diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go index b9bacb7a22..1c34b4e833 100644 --- a/src/cmd/internal/obj/util.go +++ b/src/cmd/internal/obj/util.go @@ -187,7 +187,7 @@ func (p *Prog) WriteInstructionString(w io.Writer) { // In short, print one of these two: // TEXT foo(SB), DUPOK|NOSPLIT, $0 // TEXT foo(SB), $0 - s := p.From.Sym.Attribute.TextAttrString() + s := p.From.Sym.TextAttrString() if s != "" { fmt.Fprintf(w, "%s%s", sep, s) sep = ", " diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go index 84de58a4c4..bc3a3b4bbe 100644 --- a/src/cmd/internal/obj/x86/obj6.go +++ b/src/cmd/internal/obj/x86/obj6.go @@ -35,6 +35,7 @@ import ( "cmd/internal/objabi" "cmd/internal/src" "cmd/internal/sys" + "log" "math" "strings" ) @@ -839,6 +840,20 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { switch p.As { default: + if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_SP && p.As != ACMPL && p.As != ACMPQ { + f := cursym.Func() + if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 { + f.FuncFlag |= objabi.FuncFlag_SPWRITE + if ctxt.Debugvlog || !ctxt.IsAsm { + ctxt.Logf("auto-SPWRITE: %s %v\n", cursym.Name, p) + if !ctxt.IsAsm { + ctxt.Diag("invalid auto-SPWRITE in non-assembly") + ctxt.DiagFlush() + log.Fatalf("bad SPWRITE") + } + } + } + } continue case APUSHL, APUSHFL: diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go index e921a82c0c..6e188e31bb 100644 --- a/src/cmd/internal/objabi/funcid.go +++ b/src/cmd/internal/objabi/funcid.go @@ -6,13 +6,22 @@ package objabi import "strings" +// A FuncFlag records bits about a function, passed to the runtime. +type FuncFlag uint8 + +// Note: This list must match the list in runtime/symtab.go. +const ( + FuncFlag_TOPFRAME = 1 << iota + FuncFlag_SPWRITE +) + // A FuncID identifies particular functions that need to be treated // specially by the runtime. // Note that in some situations involving plugins, there may be multiple // copies of a particular special runtime function. -// Note: this list must match the list in runtime/symtab.go. type FuncID uint8 +// Note: this list must match the list in runtime/symtab.go. const ( FuncID_normal FuncID = iota // not a special function FuncID_asmcgocall diff --git a/src/cmd/link/internal/ld/dwarf.go b/src/cmd/link/internal/ld/dwarf.go index 2ab9a55e96..561f6f1475 100644 --- a/src/cmd/link/internal/ld/dwarf.go +++ b/src/cmd/link/internal/ld/dwarf.go @@ -1454,7 +1454,7 @@ func (d *dwctxt) writeframes(fs loader.Sym) dwarfSecInfo { // Emit a FDE, Section 6.4.1. // First build the section contents into a byte buffer. deltaBuf = deltaBuf[:0] - if haslr && d.ldr.AttrTopFrame(fn) { + if haslr && fi.TopFrame() { // Mark the link register as having an undefined value. // This stops call stack unwinders progressing any further. // TODO: similar mark on non-LR architectures. @@ -1480,7 +1480,7 @@ func (d *dwctxt) writeframes(fs loader.Sym) dwarfSecInfo { spdelta += int64(d.arch.PtrSize) } - if haslr && !d.ldr.AttrTopFrame(fn) { + if haslr && !fi.TopFrame() { // TODO(bryanpkc): This is imprecise. In general, the instruction // that stores the return address to the stack frame is not the // same one that allocates the frame. diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go index 72bf33e611..fb733117be 100644 --- a/src/cmd/link/internal/ld/pcln.go +++ b/src/cmd/link/internal/ld/pcln.go @@ -796,7 +796,14 @@ func writeFuncs(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, inlSym } off = uint32(sb.SetUint8(ctxt.Arch, int64(off), uint8(funcID))) - off += 2 // pad + // flag uint8 + var flag objabi.FuncFlag + if fi.Valid() { + flag = fi.FuncFlag() + } + off = uint32(sb.SetUint8(ctxt.Arch, int64(off), uint8(flag))) + + off += 1 // pad // nfuncdata must be the final entry. funcdata, funcdataoff = funcData(fi, 0, funcdata, funcdataoff) diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go index 98c2131c2b..68dc3de273 100644 --- a/src/cmd/link/internal/loader/loader.go +++ b/src/cmd/link/internal/loader/loader.go @@ -241,7 +241,6 @@ type Loader struct { attrExternal Bitmap // external symbols, indexed by ext sym index attrReadOnly map[Sym]bool // readonly data for this sym - attrTopFrame map[Sym]struct{} // top frame symbols attrSpecial map[Sym]struct{} // "special" frame symbols attrCgoExportDynamic map[Sym]struct{} // "cgo_export_dynamic" symbols attrCgoExportStatic map[Sym]struct{} // "cgo_export_static" symbols @@ -349,7 +348,6 @@ func NewLoader(flags uint32, elfsetstring elfsetstringFunc, reporter *ErrorRepor plt: make(map[Sym]int32), got: make(map[Sym]int32), dynid: make(map[Sym]int32), - attrTopFrame: make(map[Sym]struct{}), attrSpecial: make(map[Sym]struct{}), attrCgoExportDynamic: make(map[Sym]struct{}), attrCgoExportStatic: make(map[Sym]struct{}), @@ -1009,24 +1007,6 @@ func (l *Loader) SetAttrExternal(i Sym, v bool) { } } -// AttrTopFrame returns true for a function symbol that is an entry -// point, meaning that unwinders should stop when they hit this -// function. -func (l *Loader) AttrTopFrame(i Sym) bool { - _, ok := l.attrTopFrame[i] - return ok -} - -// SetAttrTopFrame sets the "top frame" property for a symbol (see -// AttrTopFrame). -func (l *Loader) SetAttrTopFrame(i Sym, v bool) { - if v { - l.attrTopFrame[i] = struct{}{} - } else { - delete(l.attrTopFrame, i) - } -} - // AttrSpecial returns true for a symbols that do not have their // address (i.e. Value) computed by the usual mechanism of // data.go:dodata() & data.go:address(). @@ -1905,7 +1885,11 @@ func (fi *FuncInfo) Locals() int { } func (fi *FuncInfo) FuncID() objabi.FuncID { - return objabi.FuncID((*goobj.FuncInfo)(nil).ReadFuncID(fi.data)) + return (*goobj.FuncInfo)(nil).ReadFuncID(fi.data) +} + +func (fi *FuncInfo) FuncFlag() objabi.FuncFlag { + return (*goobj.FuncInfo)(nil).ReadFuncFlag(fi.data) } func (fi *FuncInfo) Pcsp() Sym { @@ -1992,6 +1976,13 @@ func (fi *FuncInfo) File(k int) goobj.CUFileIndex { return (*goobj.FuncInfo)(nil).ReadFile(fi.data, fi.lengths.FileOff, uint32(k)) } +// TopFrame returns true if the function associated with this FuncInfo +// is an entry point, meaning that unwinders should stop when they hit +// this function. +func (fi *FuncInfo) TopFrame() bool { + return (fi.FuncFlag() & objabi.FuncFlag_TOPFRAME) != 0 +} + type InlTreeNode struct { Parent int32 File goobj.CUFileIndex @@ -2151,9 +2142,6 @@ func (st *loadState) preloadSyms(r *oReader, kind int) { } gi := st.addSym(name, v, r, i, kind, osym) r.syms[i] = gi - if osym.TopFrame() { - l.SetAttrTopFrame(gi, true) - } if osym.Local() { l.SetAttrLocal(gi, true) } @@ -2411,7 +2399,6 @@ func (l *Loader) CopyAttributes(src Sym, dst Sym) { // when copying attributes from a dupOK ABI wrapper symbol to // the real target symbol (which may not be marked dupOK). } - l.SetAttrTopFrame(dst, l.AttrTopFrame(src)) l.SetAttrSpecial(dst, l.AttrSpecial(src)) l.SetAttrCgoExportDynamic(dst, l.AttrCgoExportDynamic(src)) l.SetAttrCgoExportStatic(dst, l.AttrCgoExportStatic(src)) diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 675c613b6e..05520d07b2 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -833,10 +833,11 @@ type _func struct { pcfile uint32 pcln uint32 npcdata uint32 - cuOffset uint32 // runtime.cutab offset of this function's CU - funcID funcID // set for certain special runtime functions - _ [2]byte // pad - nfuncdata uint8 // must be last + cuOffset uint32 // runtime.cutab offset of this function's CU + funcID funcID // set for certain special runtime functions + flag funcFlag + _ [1]byte // pad + nfuncdata uint8 // must be last, must end on a uint32-aligned boundary } // Pseudo-Func that is returned for PCs that occur in inlined code. diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index fc93c00c2d..d7da255e43 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -332,6 +332,15 @@ const ( funcID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.) ) +// A FuncFlag holds bits about a function. +// This list must match the list in cmd/internal/objabi/funcid.go. +type funcFlag uint8 + +const ( + funcFlag_TOPFRAME funcFlag = 1 << iota + funcFlag_SPWRITE +) + // pcHeader holds data used by the pclntab lookups. type pcHeader struct { magic uint32 // 0xFFFFFFFA -- cgit v1.3-5-g9baa From fbe74dbf4263841819368a2a3c90e599392e0808 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 16:10:58 -0500 Subject: runtime: use FuncInfo SPWRITE flag to identify untraceable profile samples The old code was very clever about predicting whether a traceback was safe. That cleverness has not aged well. In particular, the setsSP function is missing a bunch of functions that write to SP and will confuse traceback. And one such function - jmpdefer - was handled as a special case in gentraceback instead of simply listing it in setsSP. Throw away all the clever prediction about whether traceback will crash. Instead, make traceback NOT crash, by checking whether the function being walked writes to SP. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I3d55fe257a22745e4919ac4dc9a9378c984ba0da Reviewed-on: https://go-review.googlesource.com/c/go/+/288801 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/asm_arm.s | 4 -- src/runtime/pprof/pprof_test.go | 18 +++++--- src/runtime/proc.go | 95 +---------------------------------------- src/runtime/traceback.go | 52 +++++++++++----------- 4 files changed, 42 insertions(+), 127 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 92d7854306..4620f19074 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -506,10 +506,6 @@ CALLFN(·call1073741824, 1073741824) // 1. grab stored LR for caller // 2. sub 4 bytes to get back to BL deferreturn // 3. B to fn -// TODO(rsc): Push things on stack and then use pop -// to load all registers simultaneously, so that a profiling -// interrupt can never see mismatched SP/LR/PC. -// (And double-check that pop is atomic in that way.) TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8 MOVW 0(R13), LR MOVW $-4(LR), LR // BL deferreturn diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index b6ee160e84..37f12de0d9 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -514,8 +514,10 @@ func TestGoroutineSwitch(t *testing.T) { } StopCPUProfile() - // Read profile to look for entries for runtime.gogo with an attempt at a traceback. - // The special entry + // Read profile to look for entries for gogo with an attempt at a traceback. + // "runtime.gogo" is OK, because that's the part of the context switch + // before the actual switch begins. But we should not see "gogo", + // aka "gogo<>(SB)", which does the actual switch and is marked SPWRITE. parseProfile(t, prof.Bytes(), func(count uintptr, stk []*profile.Location, _ map[string][]string) { // An entry with two frames with 'System' in its top frame // exists to record a PC without a traceback. Those are okay. @@ -526,13 +528,19 @@ func TestGoroutineSwitch(t *testing.T) { } } - // Otherwise, should not see runtime.gogo. + // An entry with just one frame is OK too: + // it knew to stop at gogo. + if len(stk) == 1 { + return + } + + // Otherwise, should not see gogo. // The place we'd see it would be the inner most frame. name := stk[0].Line[0].Function.Name - if name == "runtime.gogo" { + if name == "gogo" { var buf bytes.Buffer fprintStack(&buf, stk) - t.Fatalf("found profile entry for runtime.gogo:\n%s", buf.String()) + t.Fatalf("found profile entry for gogo:\n%s", buf.String()) } }) } diff --git a/src/runtime/proc.go b/src/runtime/proc.go index 388d843004..e6670135db 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -4420,75 +4420,6 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { // See golang.org/issue/17165. getg().m.mallocing++ - // Define that a "user g" is a user-created goroutine, and a "system g" - // is one that is m->g0 or m->gsignal. - // - // We might be interrupted for profiling halfway through a - // goroutine switch. The switch involves updating three (or four) values: - // g, PC, SP, and (on arm) LR. The PC must be the last to be updated, - // because once it gets updated the new g is running. - // - // When switching from a user g to a system g, LR is not considered live, - // so the update only affects g, SP, and PC. Since PC must be last, there - // the possible partial transitions in ordinary execution are (1) g alone is updated, - // (2) both g and SP are updated, and (3) SP alone is updated. - // If SP or g alone is updated, we can detect the partial transition by checking - // whether the SP is within g's stack bounds. (We could also require that SP - // be changed only after g, but the stack bounds check is needed by other - // cases, so there is no need to impose an additional requirement.) - // - // There is one exceptional transition to a system g, not in ordinary execution. - // When a signal arrives, the operating system starts the signal handler running - // with an updated PC and SP. The g is updated last, at the beginning of the - // handler. There are two reasons this is okay. First, until g is updated the - // g and SP do not match, so the stack bounds check detects the partial transition. - // Second, signal handlers currently run with signals disabled, so a profiling - // signal cannot arrive during the handler. - // - // When switching from a system g to a user g, there are three possibilities. - // - // First, it may be that the g switch has no PC update, because the SP - // either corresponds to a user g throughout (as in asmcgocall) - // or because it has been arranged to look like a user g frame - // (as in cgocallback). In this case, since the entire - // transition is a g+SP update, a partial transition updating just one of - // those will be detected by the stack bounds check. - // - // Second, when returning from a signal handler, the PC and SP updates - // are performed by the operating system in an atomic update, so the g - // update must be done before them. The stack bounds check detects - // the partial transition here, and (again) signal handlers run with signals - // disabled, so a profiling signal cannot arrive then anyway. - // - // Third, the common case: it may be that the switch updates g, SP, and PC - // separately. If the PC is within any of the functions that does this, - // we don't ask for a traceback. C.F. the function setsSP for more about this. - // - // There is another apparently viable approach, recorded here in case - // the "PC within setsSP function" check turns out not to be usable. - // It would be possible to delay the update of either g or SP until immediately - // before the PC update instruction. Then, because of the stack bounds check, - // the only problematic interrupt point is just before that PC update instruction, - // and the sigprof handler can detect that instruction and simulate stepping past - // it in order to reach a consistent state. On ARM, the update of g must be made - // in two places (in R10 and also in a TLS slot), so the delayed update would - // need to be the SP update. The sigprof handler must read the instruction at - // the current PC and if it was the known instruction (for example, JMP BX or - // MOV R2, PC), use that other register in place of the PC value. - // The biggest drawback to this solution is that it requires that we can tell - // whether it's safe to read from the memory pointed at by PC. - // In a correct program, we can test PC == nil and otherwise read, - // but if a profiling signal happens at the instant that a program executes - // a bad jump (before the program manages to handle the resulting fault) - // the profiling handler could fault trying to read nonexistent memory. - // - // To recap, there are no constraints on the assembly being used for the - // transition. We simply require that g and SP match and that the PC is not - // in gogo. - traceback := true - if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) { - traceback = false - } var stk [maxCPUProfStack]uintptr n := 0 if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 { @@ -4511,7 +4442,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) { if n > 0 { n += cgoOff } - } else if traceback { + } else { n = gentraceback(pc, sp, lr, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack) } @@ -4590,30 +4521,6 @@ func sigprofNonGoPC(pc uintptr) { } } -// Reports whether a function will set the SP -// to an absolute value. Important that -// we don't traceback when these are at the bottom -// of the stack since we can't be sure that we will -// find the caller. -// -// If the function is not on the bottom of the stack -// we assume that it will have set it up so that traceback will be consistent, -// either by being a traceback terminating function -// or putting one on the stack at the right offset. -func setsSP(pc uintptr) bool { - f := findfunc(pc) - if !f.valid() { - // couldn't find the function for this PC, - // so assume the worst and stop traceback - return true - } - switch f.funcID { - case funcID_gogo, funcID_systemstack, funcID_mcall, funcID_morestack: - return true - } - return false -} - // setcpuprofilerate sets the CPU profiling rate to hz times per second. // If hz <= 0, setcpuprofilerate turns off CPU profiling. func setcpuprofilerate(hz int32) { diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 127f54e42e..18d8a42854 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -15,24 +15,9 @@ import ( // The most important fact about a given architecture is whether it uses a link register. // On systems with link registers, the prologue for a non-leaf function stores the // incoming value of LR at the bottom of the newly allocated stack frame. -// On systems without link registers, the architecture pushes a return PC during +// On systems without link registers (x86), the architecture pushes a return PC during // the call instruction, so the return PC ends up above the stack frame. // In this file, the return PC is always called LR, no matter how it was found. -// -// To date, the opposite of a link register architecture is an x86 architecture. -// This code may need to change if some other kind of non-link-register -// architecture comes along. -// -// The other important fact is the size of a pointer: on 32-bit systems the LR -// takes up only 4 bytes on the stack, while on 64-bit systems it takes up 8 bytes. -// Typically this is ptrSize. -// -// As an exception, amd64p32 had ptrSize == 4 but the CALL instruction still -// stored an 8-byte return PC onto the stack. To accommodate this, we used regSize -// as the size of the architecture-pushed return PC. -// -// usesLR is defined below in terms of minFrameSize, which is defined in -// arch_$GOARCH.go. ptrSize and regSize are defined in stubs.go. const usesLR = sys.MinFrameSize > 0 @@ -180,6 +165,16 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in break } + // Compute function info flags. + flag := f.flag + if f.funcID == funcID_cgocallback { + // cgocallback does write SP to switch from the g0 to the curg stack, + // but it carefully arranges that during the transition BOTH stacks + // have cgocallback frame valid for unwinding through. + // So we don't need to exclude it with the other SP-writing functions. + flag &^= funcFlag_SPWRITE + } + // Found an actual function. // Derive frame pointer and link register. if frame.fp == 0 { @@ -196,6 +191,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in frame.pc = gp.m.curg.sched.pc frame.fn = findfunc(frame.pc) f = frame.fn + flag = f.flag frame.sp = gp.m.curg.sched.sp cgoCtxt = gp.m.curg.cgoCtxt case funcID_systemstack: @@ -203,6 +199,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in // stack transition. frame.sp = gp.m.curg.sched.sp cgoCtxt = gp.m.curg.cgoCtxt + flag &^= funcFlag_SPWRITE } } frame.fp = frame.sp + uintptr(funcspdelta(f, frame.pc, &cache)) @@ -213,19 +210,26 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in } var flr funcInfo if topofstack(f, gp.m != nil && gp == gp.m.g0) { + // This function marks the top of the stack. Stop the traceback. frame.lr = 0 flr = funcInfo{} - } else if usesLR && f.funcID == funcID_jmpdefer { - // jmpdefer modifies SP/LR/PC non-atomically. - // If a profiling interrupt arrives during jmpdefer, - // the stack unwind may see a mismatched register set - // and get confused. Stop if we see PC within jmpdefer - // to avoid that confusion. - // See golang.org/issue/8153. + } else if flag&funcFlag_SPWRITE != 0 { + // The function we are in does a write to SP that we don't know + // how to encode in the spdelta table. Examples include context + // switch routines like runtime.gogo but also any code that switches + // to the g0 stack to run host C code. Since we can't reliably unwind + // the SP (we might not even be on the stack we think we are), + // we stop the traceback here. if callback != nil { - throw("traceback_arm: found jmpdefer when tracing with callback") + // Finding an SPWRITE should only happen for a profiling signal, which can + // arrive at any time. For a GC stack traversal (callback != nil), + // we shouldn't see this case, and we must be sure to walk the + // entire stack or the GC is invalid. So crash. + println("traceback: unexpected SPWRITE function", funcname(f)) + throw("traceback") } frame.lr = 0 + flr = funcInfo{} } else { var lrPtr uintptr if usesLR { -- cgit v1.3-5-g9baa From 54da3ab385686dec5554164ba9558214445deec9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 16:22:52 -0500 Subject: runtime: use TOPFRAME to identify top-of-frame functions No change to actual runtime, but helps reduce the laundry list of functions. mcall, morestack, and asmcgocall are not actually top-of-frame, so those need more attention in follow-up CLs. mstart moved to assembly so that it can be marked TOPFRAME. Since TOPFRAME also tells DWARF consumers not to unwind this way, this change should also improve debuggers a marginal amount. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: If1e0d46ca973de5e46b62948d076f675f285b5d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/288802 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/asm_386.s | 8 ++++++-- src/runtime/asm_amd64.s | 8 ++++++-- src/runtime/asm_arm.s | 6 +++++- src/runtime/asm_arm64.s | 6 +++++- src/runtime/asm_mips64x.s | 6 +++++- src/runtime/asm_mipsx.s | 6 +++++- src/runtime/asm_ppc64x.s | 6 +++++- src/runtime/asm_riscv64.s | 6 +++++- src/runtime/asm_s390x.s | 6 +++++- src/runtime/asm_wasm.s | 8 ++++++-- src/runtime/proc.go | 7 +++++-- src/runtime/sys_windows_386.s | 2 +- src/runtime/sys_windows_amd64.s | 2 +- src/runtime/sys_windows_arm.s | 2 +- src/runtime/traceback.go | 5 +---- 15 files changed, 62 insertions(+), 22 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index fcf74a03cf..5b0852f780 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -89,7 +89,7 @@ GLOBL _rt0_386_lib_argc<>(SB),NOPTR, $4 DATA _rt0_386_lib_argv<>(SB)/4, $0 GLOBL _rt0_386_lib_argv<>(SB),NOPTR, $4 -TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 // Copy arguments forward on an even stack. // Users of this function jump to it, they don't call it. MOVL 0(SP), AX @@ -269,6 +269,10 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 FLDCW runtime·controlWord64(SB) RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + CALL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ @@ -1307,7 +1311,7 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0 // The top-most function running on a goroutine // returns to goexit+PCQuantum. -TEXT runtime·goexit(SB),NOSPLIT,$0-0 +TEXT runtime·goexit(SB),NOSPLIT|TOPFRAME,$0-0 BYTE $0x90 // NOP CALL runtime·goexit1(SB) // does not return // traceback from goexit1 must hit code range of goexit diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 8ee2ac2123..a68dc72ae5 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -84,7 +84,7 @@ GLOBL _rt0_amd64_lib_argc<>(SB),NOPTR, $8 DATA _rt0_amd64_lib_argv<>(SB)/8, $0 GLOBL _rt0_amd64_lib_argv<>(SB),NOPTR, $8 -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // copy arguments forward on an even stack MOVQ DI, AX // argc MOVQ SI, BX // argv @@ -250,6 +250,10 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 // No per-thread init. RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + CALL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ @@ -1440,7 +1444,7 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0 // so as to make it identifiable to traceback (this // function it used as a sentinel; traceback wants to // see the func PC, not a wrapper PC). -TEXT runtime·goexit(SB),NOSPLIT,$0-0 +TEXT runtime·goexit(SB),NOSPLIT|TOPFRAME,$0-0 BYTE $0x90 // NOP CALL runtime·goexit1(SB) // does not return // traceback from goexit1 must hit code range of goexit diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index 4620f19074..f9535bb1bc 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -112,7 +112,7 @@ GLOBL _rt0_arm_lib_argv<>(SB),NOPTR,$4 // using NOFRAME means do not save LR on stack. // argc is in R0, argv is in R1. -TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 MOVW $0xcafebabe, R12 // copy arguments forward on an even stack @@ -202,6 +202,10 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0 WORD $0xeee1ba10 // vmsr fpscr, r11 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + BL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 4f0a680fa4..d81759537e 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -8,7 +8,7 @@ #include "funcdata.h" #include "textflag.h" -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // SP = stack; R0 = argc; R1 = argv SUB $32, RSP @@ -109,6 +109,10 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0 TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + BL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index f6d8931a15..af27b9b555 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -11,7 +11,7 @@ #define REGCTXT R22 -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // R29 = stack; R4 = argc; R5 = argv ADDV $-24, R29 @@ -85,6 +85,10 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0 TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + JAL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s index cf4b1b42cc..0c7d28dcf7 100644 --- a/src/runtime/asm_mipsx.s +++ b/src/runtime/asm_mipsx.s @@ -11,7 +11,7 @@ #define REGCTXT R22 -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // R29 = stack; R4 = argc; R5 = argv ADDU $-12, R29 @@ -86,6 +86,10 @@ TEXT runtime·breakpoint(SB),NOSPLIT,$0-0 TEXT runtime·asminit(SB),NOSPLIT,$0-0 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + JAL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s index 90f14d8e54..56e73742ea 100644 --- a/src/runtime/asm_ppc64x.s +++ b/src/runtime/asm_ppc64x.s @@ -16,7 +16,7 @@ #define cgoCalleeStackSize 32 #endif -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // R1 = stack; R3 = argc; R4 = argv; R13 = C TLS base pointer // initialize essential registers @@ -124,6 +124,10 @@ TEXT runtime·reginit(SB),NOSPLIT|NOFRAME,$0-0 XOR R0, R0 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + BL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s index d06c77b948..30f2bd2e4a 100644 --- a/src/runtime/asm_riscv64.s +++ b/src/runtime/asm_riscv64.s @@ -7,7 +7,7 @@ #include "textflag.h" // func rt0_go() -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // X2 = stack; A0 = argc; A1 = argv ADD $-24, X2 MOV A0, 8(X2) // argc @@ -70,6 +70,10 @@ nocgo: WORD $0 // crash if reached RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + CALL runtime·mstart0(SB) + RET // not reached + // void setg_gcc(G*); set g called from gcc with g in A0 TEXT setg_gcc<>(SB),NOSPLIT,$0-0 MOV A0, g diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s index 203754f32c..f9fb1a4c55 100644 --- a/src/runtime/asm_s390x.s +++ b/src/runtime/asm_s390x.s @@ -84,7 +84,7 @@ GLOBL _rt0_s390x_lib_argc<>(SB), NOPTR, $8 DATA _rt0_s90x_lib_argv<>(SB)/8, $0 GLOBL _rt0_s390x_lib_argv<>(SB), NOPTR, $8 -TEXT runtime·rt0_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0 // R2 = argc; R3 = argv; R11 = temp; R13 = g; R15 = stack pointer // C TLS base pointer in AR0:AR1 @@ -170,6 +170,10 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0 TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0 RET +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + CALL runtime·mstart0(SB) + RET // not reached + /* * go-routine */ diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s index 3765c756b3..33c335ba5a 100644 --- a/src/runtime/asm_wasm.s +++ b/src/runtime/asm_wasm.s @@ -7,7 +7,7 @@ #include "funcdata.h" #include "textflag.h" -TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME, $0 +TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME|TOPFRAME, $0 // save m->g0 = g0 MOVD $runtime·g0(SB), runtime·m0+m_g0(SB) // save m0 to g0->m @@ -24,6 +24,10 @@ TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME, $0 CALL runtime·mstart(SB) // WebAssembly stack will unwind when switching to another goroutine UNDEF +TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 + CALL runtime·mstart0(SB) + RET // not reached + DATA runtime·mainPC+0(SB)/8,$runtime·main(SB) GLOBL runtime·mainPC(SB),RODATA,$8 @@ -424,7 +428,7 @@ CALLFN(·call268435456, 268435456) CALLFN(·call536870912, 536870912) CALLFN(·call1073741824, 1073741824) -TEXT runtime·goexit(SB), NOSPLIT, $0-0 +TEXT runtime·goexit(SB), NOSPLIT|TOPFRAME, $0-0 NOP // first PC of goexit is skipped CALL runtime·goexit1(SB) // does not return UNDEF diff --git a/src/runtime/proc.go b/src/runtime/proc.go index e6670135db..ccfe085691 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -1234,7 +1234,10 @@ func mStackIsSystemAllocated() bool { } // mstart is the entry-point for new Ms. -// +// It is written in assembly, marked TOPFRAME, and calls mstart0. +func mstart() + +// mstart0 is the Go entry-point for new Ms. // This must not split the stack because we may not even have stack // bounds set up yet. // @@ -1243,7 +1246,7 @@ func mStackIsSystemAllocated() bool { // //go:nosplit //go:nowritebarrierrec -func mstart() { +func mstart0() { _g_ := getg() osStack := _g_.stack.lo == 0 diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s index 576dd28771..4f00c58c16 100644 --- a/src/runtime/sys_windows_386.s +++ b/src/runtime/sys_windows_386.s @@ -174,7 +174,7 @@ TEXT runtime·profileloop(SB),NOSPLIT,$0 ADDL $12, SP JMP CX -TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0 +TEXT runtime·externalthreadhandler(SB),NOSPLIT|TOPFRAME,$0 PUSHL BP MOVL SP, BP PUSHL BX diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 6f2abb5444..aba2811e59 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -215,7 +215,7 @@ TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$8 CALL runtime·externalthreadhandler(SB) RET -TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME,$0 +TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 PUSHQ BP MOVQ SP, BP PUSHQ BX diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 7d134dd3f4..a55f474d39 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -257,7 +257,7 @@ TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0 // 0 | retval | // +----------------+ // -TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME,$0 +TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} SUB $(m__size + g__size + 20), R13 // space for locals MOVW R0, 12(R13) diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 18d8a42854..e2bd968919 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -1002,12 +1002,9 @@ func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) { // Does f mark the top of a goroutine stack? func topofstack(f funcInfo, g0 bool) bool { - return f.funcID == funcID_goexit || - f.funcID == funcID_mstart || + return f.flag&funcFlag_TOPFRAME != 0 || f.funcID == funcID_mcall || f.funcID == funcID_morestack || - f.funcID == funcID_rt0_go || - f.funcID == funcID_externalthreadhandler || // asmcgocall is TOS on the system stack because it // switches to the system stack, but in this case we // can come back to the regular stack and still want -- cgit v1.3-5-g9baa From 5ecd9e34dfe0491f1d76372e272d782578ad5bdb Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 17:17:38 -0500 Subject: runtime: do not treat mcall as a topofstack I added mcall to this list in 2013 without explaining why. (https://codereview.appspot.com/11085043/diff/61001/src/pkg/runtime/traceback_x86.c) I suspect I was stopping crashes during profiling where the unwind tried to walk up past mcall and got confused. mcall is not something you can unwind past, because it switches stacks, but it's also not something you should expect as a standard top-of-stack frame. So if you do see it during say a garbage collection stack walk, it would be important to crash instead of silently stopping the walk prematurely. This CL removes it from the topofstack list to avoid the silent stop. Now that mcall is detected as SPWRITE, that will stop the unwind (with a crash if encountered during GC, which we want). This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I666487ce24efd72292f2bc3eac7fe0477e16bddd Reviewed-on: https://go-review.googlesource.com/c/go/+/288803 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/symtab.go | 14 ++++++++++++++ src/runtime/traceback.go | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index d7da255e43..00f802aaa7 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -337,7 +337,21 @@ const ( type funcFlag uint8 const ( + // TOPFRAME indicates a function that appears at the top of its stack. + // The traceback routine stop at such a function and consider that a + // successful, complete traversal of the stack. + // Examples of TOPFRAME functions include goexit, which appears + // at the top of a user goroutine stack, and mstart, which appears + // at the top of a system goroutine stack. funcFlag_TOPFRAME funcFlag = 1 << iota + + // SPWRITE indicates a function that writes an arbitrary value to SP + // (any write other than adding or subtracting a constant amount). + // The traceback routines cannot encode such changes into the + // pcsp tables, so the function traceback cannot safely unwind past + // SPWRITE functions. Stopping at an SPWRITE function is considered + // to be an incomplete unwinding of the stack. In certain contexts + // (in particular garbage collector stack scans) that is a fatal error. funcFlag_SPWRITE ) diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index e2bd968919..c89a8913ae 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -1003,7 +1003,6 @@ func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) { // Does f mark the top of a goroutine stack? func topofstack(f funcInfo, g0 bool) bool { return f.flag&funcFlag_TOPFRAME != 0 || - f.funcID == funcID_mcall || f.funcID == funcID_morestack || // asmcgocall is TOS on the system stack because it // switches to the system stack, but in this case we -- cgit v1.3-5-g9baa From 776ee4079a1d5fabd855a05b300aebdc3ea53efb Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 29 Jan 2021 09:05:10 -0500 Subject: runtime: do not treat morestack as a topofstack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I added morestack to this list in 2013 with an explanation that they were needed if we “start a garbage collection on g0 during a stack split or unsplit”. (https://golang.org/cl/11533043) This explanation no longer applies for a handful of reasons, most importantly that if we did stop a stack scan in the middle of a call to morestack, we'd ignore pointers above the split, which would lead to memory corruption. But we don't scan goroutine stacks during morestack now, so that can't happen. If we did see morestack during a GC, that would be a good time to crash the program. The real problem with morestack is during profiling, as noted in the code review conversation during 2013. And in profiling we just need to know to stop and not unwind further, which the new SPWRITE bit will do for us. So remove from topofstack and let the program crash if GC sees morestack and otherwise let the SPWRITE stop morestack unwinding during profiling. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I06d95920b18c599c7c46f64c21028104978215d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/288804 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/traceback.go | 1 - 1 file changed, 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index c89a8913ae..dbc2bddf42 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -1003,7 +1003,6 @@ func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) { // Does f mark the top of a goroutine stack? func topofstack(f funcInfo, g0 bool) bool { return f.flag&funcFlag_TOPFRAME != 0 || - f.funcID == funcID_morestack || // asmcgocall is TOS on the system stack because it // switches to the system stack, but in this case we // can come back to the regular stack and still want -- cgit v1.3-5-g9baa From a54f7fc0fde79e8edc696de002fe8a73604f077f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 29 Jan 2021 09:55:03 -0500 Subject: runtime: do not treat asmcgocall as a topofstack on g0 This was added in 2018 to fix a runtime crash during unwind during a unhandled-panic-induced crash. (See https://golang.org/cl/90895 and #23576.) Clearly we cannot unwind past this function, and the change did stop the unwind. But it's not a top-of-stack function, and the real issue is that SP is changed. The new SPWRITE bit takes care of this instead, so we can drop it from the topofstack function. At this point the topofstack function is only checking the TOPFRAME bit, so we can inline that into the one call site. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I856552298032770e48e06c95a20823a1dbd5e38c Reviewed-on: https://go-review.googlesource.com/c/go/+/288805 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/traceback.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index dbc2bddf42..7321790b78 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -209,7 +209,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in } } var flr funcInfo - if topofstack(f, gp.m != nil && gp == gp.m.g0) { + if flag&funcFlag_TOPFRAME != 0 { // This function marks the top of the stack. Stop the traceback. frame.lr = 0 flr = funcInfo{} @@ -1000,17 +1000,6 @@ func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) { }) } -// Does f mark the top of a goroutine stack? -func topofstack(f funcInfo, g0 bool) bool { - return f.flag&funcFlag_TOPFRAME != 0 || - // asmcgocall is TOS on the system stack because it - // switches to the system stack, but in this case we - // can come back to the regular stack and still want - // to be able to unwind through the call that appeared - // on the regular stack. - (g0 && f.funcID == funcID_asmcgocall) -} - // isSystemGoroutine reports whether the goroutine g must be omitted // in stack dumps and deadlock detector. This is any goroutine that // starts at a runtime.* entry point, except for runtime.main, -- cgit v1.3-5-g9baa From ece954d8b8e13a76de891c8078c27c5e7f884f9f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:06:04 -0500 Subject: runtime: find g in Windows profiler using SP The architecture-specific interpretation of m->tls[0] is unnecessary and fragile. Delete it. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I927345e52fa2f1741d4914478a29d1fb8acb0dc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/288806 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Jason A. Donenfeld Reviewed-by: Cherry Zhang --- src/runtime/os_windows.go | 22 +++++++++++----------- src/runtime/sys_windows_arm.s | 34 ---------------------------------- 2 files changed, 11 insertions(+), 45 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index a2a124cd9d..a8406460e2 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -1132,21 +1132,21 @@ func profilem(mp *m, thread uintptr) { c.contextflags = _CONTEXT_CONTROL stdcall2(_GetThreadContext, thread, uintptr(unsafe.Pointer(c))) - gp := gFromTLS(mp) + gp := gFromSP(mp, c.sp()) sigprof(c.ip(), c.sp(), c.lr(), gp, mp) } -func gFromTLS(mp *m) *g { - switch GOARCH { - case "arm": - tls := &mp.tls[0] - return **((***g)(unsafe.Pointer(tls))) - case "386", "amd64": - tls := &mp.tls[0] - return *((**g)(unsafe.Pointer(tls))) +func gFromSP(mp *m, sp uintptr) *g { + if gp := mp.g0; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi { + return gp + } + if gp := mp.gsignal; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi { + return gp + } + if gp := mp.curg; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi { + return gp } - throw("unsupported architecture") return nil } @@ -1295,7 +1295,7 @@ func preemptM(mp *m) { unlock(&suspendLock) // Does it want a preemption and is it safe to preempt? - gp := gFromTLS(mp) + gp := gFromSP(mp, c.sp()) if wantAsyncPreempt(gp) { if ok, newpc := isAsyncSafePoint(gp, c.ip(), c.sp(), c.lr()); ok { // Inject call to asyncPreempt diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index a55f474d39..a30d63513a 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -350,9 +350,6 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0 MOVW R0, g_m(g) BL runtime·save_g(SB) - // do per-thread TLS initialization - BL init_thread_tls<>(SB) - // Layout new m scheduler stack on os stack. MOVW R13, R0 MOVW R0, g_stack+stack_hi(g) @@ -581,39 +578,8 @@ TEXT runtime·_initcgo(SB),NOSPLIT|NOFRAME,$0 MOVW $runtime·tls_g(SB), R1 MOVW R0, (R1) - BL init_thread_tls<>(SB) - MOVW R4, R13 MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} -// void init_thread_tls() -// -// Does per-thread TLS initialization. Saves a pointer to the TLS slot -// holding G, in the current m. -// -// g->m->tls[0] = &_TEB->TlsSlots[tls_g] -// -// The purpose of this is to enable the profiling handler to get the -// current g associated with the thread. We cannot use m->curg because curg -// only holds the current user g. If the thread is executing system code or -// external code, m->curg will be NULL. The thread's TLS slot always holds -// the current g, so save a reference to this location so the profiling -// handler can get the real g from the thread's m. -// -// Clobbers R0-R3 -TEXT init_thread_tls<>(SB),NOSPLIT|NOFRAME,$0 - // compute &_TEB->TlsSlots[tls_g] - MRC 15, 0, R0, C13, C0, 2 - ADD $0xe10, R0 - MOVW $runtime·tls_g(SB), R1 - MOVW (R1), R1 - MOVW R1<<2, R1 - ADD R1, R0 - - // save in g->m->tls[0] - MOVW g_m(g), R1 - MOVW R0, m_tls(R1) - RET - // Holds the TLS Slot, which was allocated by TlsAlloc() GLOBL runtime·tls_g+0(SB), NOPTR, $4 -- cgit v1.3-5-g9baa From 76ab626bfc52fad9ce8c12fac56177ce68ff744b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:01:00 -0500 Subject: runtime: factor common code out of defs_windows_*.go Also give up on the fiction that these files can be regenerated. They contain many manual edits, and they're fairly small anyway. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: Ib4e4e20a43d8beb1d5390fd184160c33607641f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/288807 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Alex Brainman Reviewed-by: Jason A. Donenfeld Reviewed-by: Cherry Zhang --- src/runtime/defs_windows.go | 127 ++++++++++++++++++++------------------ src/runtime/defs_windows_386.go | 84 ++----------------------- src/runtime/defs_windows_amd64.go | 87 ++------------------------ src/runtime/defs_windows_arm.go | 79 +----------------------- src/runtime/signal_windows.go | 4 +- 5 files changed, 78 insertions(+), 303 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/defs_windows.go b/src/runtime/defs_windows.go index 43f358d56a..656fd2b8b6 100644 --- a/src/runtime/defs_windows.go +++ b/src/runtime/defs_windows.go @@ -2,77 +2,82 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build ignore - -/* -Input to cgo. - -GOARCH=amd64 go tool cgo -cdefs defs_windows.go > defs_windows_amd64.h -GOARCH=386 go tool cgo -cdefs defs_windows.go > defs_windows_386.h -*/ +// Windows architecture-independent definitions. package runtime -/* -#include -#include -#include -#include -#include +const ( + _PROT_NONE = 0 + _PROT_READ = 1 + _PROT_WRITE = 2 + _PROT_EXEC = 4 -#ifndef _X86_ -typedef struct {} FLOATING_SAVE_AREA; -#endif -#ifndef _AMD64_ -typedef struct {} M128A; -#endif -*/ -import "C" + _MAP_ANON = 1 + _MAP_PRIVATE = 2 -const ( - PROT_NONE = 0 - PROT_READ = 1 - PROT_WRITE = 2 - PROT_EXEC = 4 + _DUPLICATE_SAME_ACCESS = 0x2 + _THREAD_PRIORITY_HIGHEST = 0x2 - MAP_ANON = 1 - MAP_PRIVATE = 2 + _SIGINT = 0x2 + _SIGTERM = 0xF + _CTRL_C_EVENT = 0x0 + _CTRL_BREAK_EVENT = 0x1 + _CTRL_CLOSE_EVENT = 0x2 + _CTRL_LOGOFF_EVENT = 0x5 + _CTRL_SHUTDOWN_EVENT = 0x6 - DUPLICATE_SAME_ACCESS = C.DUPLICATE_SAME_ACCESS - THREAD_PRIORITY_HIGHEST = C.THREAD_PRIORITY_HIGHEST + _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 + _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d + _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e + _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f + _EXCEPTION_FLT_OVERFLOW = 0xc0000091 + _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 + _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 + _EXCEPTION_INT_OVERFLOW = 0xc0000095 - SIGINT = C.SIGINT - SIGTERM = C.SIGTERM - CTRL_C_EVENT = C.CTRL_C_EVENT - CTRL_BREAK_EVENT = C.CTRL_BREAK_EVENT - CTRL_CLOSE_EVENT = C.CTRL_CLOSE_EVENT - CTRL_LOGOFF_EVENT = C.CTRL_LOGOFF_EVENT - CTRL_SHUTDOWN_EVENT = C.CTRL_SHUTDOWN_EVENT + _INFINITE = 0xffffffff + _WAIT_TIMEOUT = 0x102 - CONTEXT_CONTROL = C.CONTEXT_CONTROL - CONTEXT_FULL = C.CONTEXT_FULL + _EXCEPTION_CONTINUE_EXECUTION = -0x1 + _EXCEPTION_CONTINUE_SEARCH = 0x0 +) - EXCEPTION_ACCESS_VIOLATION = C.STATUS_ACCESS_VIOLATION - EXCEPTION_BREAKPOINT = C.STATUS_BREAKPOINT - EXCEPTION_FLT_DENORMAL_OPERAND = C.STATUS_FLOAT_DENORMAL_OPERAND - EXCEPTION_FLT_DIVIDE_BY_ZERO = C.STATUS_FLOAT_DIVIDE_BY_ZERO - EXCEPTION_FLT_INEXACT_RESULT = C.STATUS_FLOAT_INEXACT_RESULT - EXCEPTION_FLT_OVERFLOW = C.STATUS_FLOAT_OVERFLOW - EXCEPTION_FLT_UNDERFLOW = C.STATUS_FLOAT_UNDERFLOW - EXCEPTION_INT_DIVIDE_BY_ZERO = C.STATUS_INTEGER_DIVIDE_BY_ZERO - EXCEPTION_INT_OVERFLOW = C.STATUS_INTEGER_OVERFLOW +type systeminfo struct { + anon0 [4]byte + dwpagesize uint32 + lpminimumapplicationaddress *byte + lpmaximumapplicationaddress *byte + dwactiveprocessormask uintptr + dwnumberofprocessors uint32 + dwprocessortype uint32 + dwallocationgranularity uint32 + wprocessorlevel uint16 + wprocessorrevision uint16 +} - INFINITE = C.INFINITE - WAIT_TIMEOUT = C.WAIT_TIMEOUT +type exceptionrecord struct { + exceptioncode uint32 + exceptionflags uint32 + exceptionrecord *exceptionrecord + exceptionaddress *byte + numberparameters uint32 + exceptioninformation [15]uintptr +} - EXCEPTION_CONTINUE_EXECUTION = C.EXCEPTION_CONTINUE_EXECUTION - EXCEPTION_CONTINUE_SEARCH = C.EXCEPTION_CONTINUE_SEARCH -) +type overlapped struct { + internal uintptr + internalhigh uintptr + anon0 [8]byte + hevent *byte +} -type SystemInfo C.SYSTEM_INFO -type ExceptionRecord C.EXCEPTION_RECORD -type FloatingSaveArea C.FLOATING_SAVE_AREA -type M128a C.M128A -type Context C.CONTEXT -type Overlapped C.OVERLAPPED -type MemoryBasicInformation C.MEMORY_BASIC_INFORMATION +type memoryBasicInformation struct { + baseAddress uintptr + allocationBase uintptr + allocationProtect uint32 + regionSize uintptr + state uint32 + protect uint32 + type_ uint32 +} diff --git a/src/runtime/defs_windows_386.go b/src/runtime/defs_windows_386.go index 3c5057b86f..37fe74c542 100644 --- a/src/runtime/defs_windows_386.go +++ b/src/runtime/defs_windows_386.go @@ -1,69 +1,10 @@ -// created by cgo -cdefs and then converted to Go -// cgo -cdefs defs_windows.go +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. package runtime -const ( - _PROT_NONE = 0 - _PROT_READ = 1 - _PROT_WRITE = 2 - _PROT_EXEC = 4 - - _MAP_ANON = 1 - _MAP_PRIVATE = 2 - - _DUPLICATE_SAME_ACCESS = 0x2 - _THREAD_PRIORITY_HIGHEST = 0x2 - - _SIGINT = 0x2 - _SIGTERM = 0xF - _CTRL_C_EVENT = 0x0 - _CTRL_BREAK_EVENT = 0x1 - _CTRL_CLOSE_EVENT = 0x2 - _CTRL_LOGOFF_EVENT = 0x5 - _CTRL_SHUTDOWN_EVENT = 0x6 - - _CONTEXT_CONTROL = 0x10001 - _CONTEXT_FULL = 0x10007 - - _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 - _EXCEPTION_BREAKPOINT = 0x80000003 - _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d - _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e - _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f - _EXCEPTION_FLT_OVERFLOW = 0xc0000091 - _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 - _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 - _EXCEPTION_INT_OVERFLOW = 0xc0000095 - - _INFINITE = 0xffffffff - _WAIT_TIMEOUT = 0x102 - - _EXCEPTION_CONTINUE_EXECUTION = -0x1 - _EXCEPTION_CONTINUE_SEARCH = 0x0 -) - -type systeminfo struct { - anon0 [4]byte - dwpagesize uint32 - lpminimumapplicationaddress *byte - lpmaximumapplicationaddress *byte - dwactiveprocessormask uint32 - dwnumberofprocessors uint32 - dwprocessortype uint32 - dwallocationgranularity uint32 - wprocessorlevel uint16 - wprocessorrevision uint16 -} - -type exceptionrecord struct { - exceptioncode uint32 - exceptionflags uint32 - exceptionrecord *exceptionrecord - exceptionaddress *byte - numberparameters uint32 - exceptioninformation [15]uint32 -} +const _CONTEXT_CONTROL = 0x10001 type floatingsavearea struct { controlword uint32 @@ -130,20 +71,3 @@ func dumpregs(r *context) { print("fs ", hex(r.segfs), "\n") print("gs ", hex(r.seggs), "\n") } - -type overlapped struct { - internal uint32 - internalhigh uint32 - anon0 [8]byte - hevent *byte -} - -type memoryBasicInformation struct { - baseAddress uintptr - allocationBase uintptr - allocationProtect uint32 - regionSize uintptr - state uint32 - protect uint32 - type_ uint32 -} diff --git a/src/runtime/defs_windows_amd64.go b/src/runtime/defs_windows_amd64.go index ebb1506e2f..ac636a68ec 100644 --- a/src/runtime/defs_windows_amd64.go +++ b/src/runtime/defs_windows_amd64.go @@ -1,70 +1,10 @@ -// created by cgo -cdefs and then converted to Go -// cgo -cdefs defs_windows.go +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. package runtime -const ( - _PROT_NONE = 0 - _PROT_READ = 1 - _PROT_WRITE = 2 - _PROT_EXEC = 4 - - _MAP_ANON = 1 - _MAP_PRIVATE = 2 - - _DUPLICATE_SAME_ACCESS = 0x2 - _THREAD_PRIORITY_HIGHEST = 0x2 - - _SIGINT = 0x2 - _SIGTERM = 0xF - _CTRL_C_EVENT = 0x0 - _CTRL_BREAK_EVENT = 0x1 - _CTRL_CLOSE_EVENT = 0x2 - _CTRL_LOGOFF_EVENT = 0x5 - _CTRL_SHUTDOWN_EVENT = 0x6 - - _CONTEXT_CONTROL = 0x100001 - _CONTEXT_FULL = 0x10000b - - _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 - _EXCEPTION_BREAKPOINT = 0x80000003 - _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d - _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e - _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f - _EXCEPTION_FLT_OVERFLOW = 0xc0000091 - _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 - _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 - _EXCEPTION_INT_OVERFLOW = 0xc0000095 - - _INFINITE = 0xffffffff - _WAIT_TIMEOUT = 0x102 - - _EXCEPTION_CONTINUE_EXECUTION = -0x1 - _EXCEPTION_CONTINUE_SEARCH = 0x0 -) - -type systeminfo struct { - anon0 [4]byte - dwpagesize uint32 - lpminimumapplicationaddress *byte - lpmaximumapplicationaddress *byte - dwactiveprocessormask uint64 - dwnumberofprocessors uint32 - dwprocessortype uint32 - dwallocationgranularity uint32 - wprocessorlevel uint16 - wprocessorrevision uint16 -} - -type exceptionrecord struct { - exceptioncode uint32 - exceptionflags uint32 - exceptionrecord *exceptionrecord - exceptionaddress *byte - numberparameters uint32 - pad_cgo_0 [4]byte - exceptioninformation [15]uint64 -} +const _CONTEXT_CONTROL = 0x100001 type m128a struct { low uint64 @@ -123,7 +63,7 @@ type context struct { func (c *context) ip() uintptr { return uintptr(c.rip) } func (c *context) sp() uintptr { return uintptr(c.rsp) } -// Amd64 does not have link register, so this returns 0. +// AMD64 does not have link register, so this returns 0. func (c *context) lr() uintptr { return 0 } func (c *context) set_lr(x uintptr) {} @@ -152,20 +92,3 @@ func dumpregs(r *context) { print("fs ", hex(r.segfs), "\n") print("gs ", hex(r.seggs), "\n") } - -type overlapped struct { - internal uint64 - internalhigh uint64 - anon0 [8]byte - hevent *byte -} - -type memoryBasicInformation struct { - baseAddress uintptr - allocationBase uintptr - allocationProtect uint32 - regionSize uintptr - state uint32 - protect uint32 - type_ uint32 -} diff --git a/src/runtime/defs_windows_arm.go b/src/runtime/defs_windows_arm.go index b275b0572a..4021f77ba8 100644 --- a/src/runtime/defs_windows_arm.go +++ b/src/runtime/defs_windows_arm.go @@ -4,67 +4,7 @@ package runtime -const ( - _PROT_NONE = 0 - _PROT_READ = 1 - _PROT_WRITE = 2 - _PROT_EXEC = 4 - - _MAP_ANON = 1 - _MAP_PRIVATE = 2 - - _DUPLICATE_SAME_ACCESS = 0x2 - _THREAD_PRIORITY_HIGHEST = 0x2 - - _SIGINT = 0x2 - _SIGTERM = 0xF - _CTRL_C_EVENT = 0x0 - _CTRL_BREAK_EVENT = 0x1 - _CTRL_CLOSE_EVENT = 0x2 - _CTRL_LOGOFF_EVENT = 0x5 - _CTRL_SHUTDOWN_EVENT = 0x6 - - _CONTEXT_CONTROL = 0x10001 - _CONTEXT_FULL = 0x10007 - - _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 - _EXCEPTION_BREAKPOINT = 0x80000003 - _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d - _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e - _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f - _EXCEPTION_FLT_OVERFLOW = 0xc0000091 - _EXCEPTION_FLT_UNDERFLOW = 0xc0000093 - _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094 - _EXCEPTION_INT_OVERFLOW = 0xc0000095 - - _INFINITE = 0xffffffff - _WAIT_TIMEOUT = 0x102 - - _EXCEPTION_CONTINUE_EXECUTION = -0x1 - _EXCEPTION_CONTINUE_SEARCH = 0x0 -) - -type systeminfo struct { - anon0 [4]byte - dwpagesize uint32 - lpminimumapplicationaddress *byte - lpmaximumapplicationaddress *byte - dwactiveprocessormask uint32 - dwnumberofprocessors uint32 - dwprocessortype uint32 - dwallocationgranularity uint32 - wprocessorlevel uint16 - wprocessorrevision uint16 -} - -type exceptionrecord struct { - exceptioncode uint32 - exceptionflags uint32 - exceptionrecord *exceptionrecord - exceptionaddress *byte - numberparameters uint32 - exceptioninformation [15]uint32 -} +const _CONTEXT_CONTROL = 0x10001 type neon128 struct { low uint64 @@ -132,23 +72,6 @@ func dumpregs(r *context) { print("cpsr ", hex(r.cpsr), "\n") } -type overlapped struct { - internal uint32 - internalhigh uint32 - anon0 [8]byte - hevent *byte -} - -type memoryBasicInformation struct { - baseAddress uintptr - allocationBase uintptr - allocationProtect uint32 - regionSize uintptr - state uint32 - protect uint32 - type_ uint32 -} - func stackcheck() { // TODO: not implemented on ARM } diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index 3af2e39b08..89d12617f4 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -112,8 +112,8 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 { // augmenting the stack frame would break // the unwinding code. gp.sig = info.exceptioncode - gp.sigcode0 = uintptr(info.exceptioninformation[0]) - gp.sigcode1 = uintptr(info.exceptioninformation[1]) + gp.sigcode0 = info.exceptioninformation[0] + gp.sigcode1 = info.exceptioninformation[1] gp.sigpc = r.ip() // Only push runtime·sigpanic if r.ip() != 0. -- cgit v1.3-5-g9baa From 75e273fc2c183896a11bf23f0688c38059933336 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:02:33 -0500 Subject: runtime: fix windows/arm CONTEXT_CONTROL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The constant was wrong, and the “right” constant doesn't work either. But with the actually-right constant (and possibly earlier fixes in this stack as well), profiling now works. Change-Id: If8caff1da556826db40961fb9bcfe2b1f31ea9f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/288808 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/runtime/defs_windows_arm.go | 8 +++++++- src/runtime/pprof/pprof_test.go | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/defs_windows_arm.go b/src/runtime/defs_windows_arm.go index 4021f77ba8..370470e35d 100644 --- a/src/runtime/defs_windows_arm.go +++ b/src/runtime/defs_windows_arm.go @@ -4,7 +4,13 @@ package runtime -const _CONTEXT_CONTROL = 0x10001 +// NOTE(rsc): _CONTEXT_CONTROL is actually 0x200001 and should include PC, SP, and LR. +// However, empirically, LR doesn't come along on Windows 10 +// unless you also set _CONTEXT_INTEGER (0x200002). +// Without LR, we skip over the next-to-bottom function in profiles +// when the bottom function is frameless. +// So we set both here, to make a working _CONTEXT_CONTROL. +const _CONTEXT_CONTROL = 0x200003 type neon128 struct { low uint64 diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 37f12de0d9..f7c1349bc6 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -285,10 +285,6 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { broken = true } - case "windows": - if runtime.GOARCH == "arm" { - broken = true // See https://golang.org/issues/42862 - } } maxDuration := 5 * time.Second -- cgit v1.3-5-g9baa From a1e9148e3dbb20a18e0139583e7d835cc7a820bf Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 26 Jan 2021 21:26:01 -0500 Subject: runtime: print hex numbers with hex prefixes in traceback debug If traceback fails, it prints a helpful hex dump of the stack. But the hex numbers have no 0x prefix, which might make it a little unclear that they are hex. We only print two per line, so there is plenty of room for the 0x. Print it, which lets us delete a custom hex formatter. Also, in the translated hints, print off in hex (with a 0x prefix). The offsets were previously decimal, which could have been confused for hex since none of the hex had 0x prefixes. And decimal is kind of useless anyway since the offsets shown in the main traceback are hex, so you can't easily match them up without mental base conversions. Just print hex everywhere, clearly marked by 0x. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I72d26a4e41ada38b620bf8fe3576d787a2e59b47 Reviewed-on: https://go-review.googlesource.com/c/go/+/288809 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/print.go | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/print.go b/src/runtime/print.go index 64055a34cc..f15296cf02 100644 --- a/src/runtime/print.go +++ b/src/runtime/print.go @@ -216,13 +216,15 @@ func printint(v int64) { printuint(uint64(v)) } +var minhexdigits = 0 // protected by printlock + func printhex(v uint64) { const dig = "0123456789abcdef" var buf [100]byte i := len(buf) for i--; i > 0; i-- { buf[i] = dig[v%16] - if v < 16 { + if v < 16 && len(buf)-i >= minhexdigits { break } v /= 16 @@ -265,29 +267,16 @@ func printiface(i iface) { // and should return a character mark to appear just before that // word's value. It can return 0 to indicate no mark. func hexdumpWords(p, end uintptr, mark func(uintptr) byte) { - p1 := func(x uintptr) { - var buf [2 * sys.PtrSize]byte - for i := len(buf) - 1; i >= 0; i-- { - if x&0xF < 10 { - buf[i] = byte(x&0xF) + '0' - } else { - buf[i] = byte(x&0xF) - 10 + 'a' - } - x >>= 4 - } - gwrite(buf[:]) - } - printlock() var markbuf [1]byte markbuf[0] = ' ' + minhexdigits = int(unsafe.Sizeof(uintptr(0)) * 2) for i := uintptr(0); p+i < end; i += sys.PtrSize { if i%16 == 0 { if i != 0 { println() } - p1(p + i) - print(": ") + print(hex(p+i), ": ") } if mark != nil { @@ -298,15 +287,16 @@ func hexdumpWords(p, end uintptr, mark func(uintptr) byte) { } gwrite(markbuf[:]) val := *(*uintptr)(unsafe.Pointer(p + i)) - p1(val) + print(hex(val)) print(" ") // Can we symbolize val? fn := findfunc(val) if fn.valid() { - print("<", funcname(fn), "+", val-fn.entry, "> ") + print("<", funcname(fn), "+", hex(val-fn.entry), "> ") } } + minhexdigits = 0 println() printunlock() } -- cgit v1.3-5-g9baa From 38672d3dcf2eae297c45dc2a899c39528148f14b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:15:33 -0500 Subject: runtime: crash earlier on windows for runtime.abort The isAbort check was wrong for non-x86 systems. That was causing the exception chain to be passed back to Windows. That was causing some other kind of fault - not sure what. That was leading back to lastcontinuehandler to print a larger stack trace, and then the throwing = 1 print added runtime.abort, which made TestAbort pass even though it wasn't really working. Recognize abort properly and handle it as Go, not as something for Windows to try to handle. Keep the throwing = 1 print, because more detail on throw is always better. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: If614f4ab2884bd90410d29e28311bf969ceeac09 Reviewed-on: https://go-review.googlesource.com/c/go/+/288810 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/signal_windows.go | 45 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index 89d12617f4..18834b0ec5 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -43,13 +43,17 @@ func initExceptionHandler() { // //go:nosplit func isAbort(r *context) bool { - // In the case of an abort, the exception IP is one byte after - // the INT3 (this differs from UNIX OSes). - return isAbortPC(r.ip() - 1) + pc := r.ip() + if GOARCH == "386" || GOARCH == "amd64" { + // In the case of an abort, the exception IP is one byte after + // the INT3 (this differs from UNIX OSes). + pc-- + } + return isAbortPC(pc) } // isgoexception reports whether this exception should be translated -// into a Go panic. +// into a Go panic or throw. // // It is nosplit to avoid growing the stack in case we're aborting // because of a stack overflow. @@ -63,11 +67,6 @@ func isgoexception(info *exceptionrecord, r *context) bool { return false } - if isAbort(r) { - // Never turn abort into a panic. - return false - } - // Go will only handle some exceptions. switch info.exceptioncode { default: @@ -99,14 +98,16 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 { return _EXCEPTION_CONTINUE_SEARCH } - // After this point, it is safe to grow the stack. - - if gp.throwsplit { - // We can't safely sigpanic because it may grow the - // stack. Let it fall through. - return _EXCEPTION_CONTINUE_SEARCH + if gp.throwsplit || isAbort(r) { + // We can't safely sigpanic because it may grow the stack. + // Or this is a call to abort. + // Don't go through any more of the Windows handler chain. + // Crash now. + winthrow(info, r, gp) } + // After this point, it is safe to grow the stack. + // Make it look like a call to the signal func. // Have to pass arguments out of band since // augmenting the stack frame would break @@ -181,6 +182,12 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 { return _EXCEPTION_CONTINUE_SEARCH } + winthrow(info, r, gp) + return 0 // not reached +} + +//go:nosplit +func winthrow(info *exceptionrecord, r *context, gp *g) { _g_ := getg() if panicking != 0 { // traceback already printed @@ -206,11 +213,8 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 { } print("\n") - // TODO(jordanrh1): This may be needed for 386/AMD64 as well. - if GOARCH == "arm" { - _g_.m.throwing = 1 - _g_.m.caughtsig.set(gp) - } + _g_.m.throwing = 1 + _g_.m.caughtsig.set(gp) level, _, docrash := gotraceback() if level > 0 { @@ -224,7 +228,6 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 { } exit(2) - return 0 // not reached } func sigpanic() { -- cgit v1.3-5-g9baa From 91cc484ea914fc75e7321d23017d59c9751f5066 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:22:02 -0500 Subject: runtime: fix time on windows/arm under WINE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code has clearly never run successfully, since one of the “tail calls" calls the wrong function, and both of them appear in functions with stack frames that are never going to be properly unwound. Probably there is no windows/arm under WINE at all. But might as well fix the code. Change-Id: I5fa62274b3661bc6bce098657b5bcf11d59655eb Reviewed-on: https://go-review.googlesource.com/c/go/+/288811 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/runtime/sys_windows_arm.s | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index a30d63513a..42278dcbe7 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -419,7 +419,7 @@ TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 #define time_hi1 4 #define time_hi2 8 -TEXT runtime·nanotime1(SB),NOSPLIT,$0-8 +TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8 MOVW $0, R0 MOVB runtime·useQPCTime(SB), R0 CMP $0, R0 @@ -443,9 +443,8 @@ loop: RET useQPC: B runtime·nanotimeQPC(SB) // tail call - RET -TEXT time·now(SB),NOSPLIT,$0-20 +TEXT time·now(SB),NOSPLIT|NOFRAME,$0-20 MOVW $0, R0 MOVB runtime·useQPCTime(SB), R0 CMP $0, R0 @@ -519,8 +518,7 @@ wall: MOVW R1,nsec+8(FP) RET useQPC: - B runtime·nanotimeQPC(SB) // tail call - RET + B runtime·nowQPC(SB) // tail call // save_g saves the g register (R10) into thread local memory // so that we can call externally compiled -- cgit v1.3-5-g9baa From 5421c37a1db5098659f86b21d011fc263d93524e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:27:25 -0500 Subject: runtime: fix windows/arm externalthreadhandler Externalthreadhandler was not handling its own stack correctly. It incorrectly referred to the saved LR slot (uninitialized, it turned out) as holding the return value from the called function. Externalthreadhandler is used to call two different functions: profileloop1 and ctrlhandler1. Profileloop1 does not return, so no harm done. Ctrlhandler1 returns a boolean indicating whether the handler took care of the control event (if true, no other handlers run). It's hard to say exactly what uninitialized values are likely to have been returned instead of ctrlhandler1's result, but it probably wasn't helping matters. Change-Id: Ia02f1c033df618cb82c2193b3a8241ed048a8b18 Reviewed-on: https://go-review.googlesource.com/c/go/+/288812 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Jason A. Donenfeld --- src/runtime/sys_windows_arm.s | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 42278dcbe7..3f01714c66 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -250,16 +250,17 @@ TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0 // +----------------+ // 12| argument (r0) | //---+----------------+ -// 8 | param1 | +// 8 | param1 | (also return value for called Go function) // +----------------+ // 4 | param0 | // +----------------+ -// 0 | retval | +// 0 | slot for LR | // +----------------+ // TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} SUB $(m__size + g__size + 20), R13 // space for locals + MOVW R14, 0(R13) // push LR again for anything unwinding the stack MOVW R0, 12(R13) MOVW R1, 16(R13) @@ -298,7 +299,7 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 MOVW $0, g BL runtime·save_g(SB) - MOVW 0(R13), R0 // load return value + MOVW 8(R13), R0 // load return value ADD $(m__size + g__size + 20), R13 // free locals MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} -- cgit v1.3-5-g9baa From b19e7b518e564cd309d3eb68dfd2da8839a7433b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Jan 2021 09:23:35 -0500 Subject: runtime: clean up windows a bit Document the various hard-coded architecture checks or remove them in favor of more general checks. This should be a no-op now but will make the arm64 port have fewer diffs. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: Ifd6b19e44e8c9ca4a0d2590f314928ce235821b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/288813 Trust: Russ Cox Reviewed-by: Cherry Zhang Reviewed-by: Alex Brainman --- src/runtime/os_windows.go | 12 ++++++++---- src/runtime/signal_windows.go | 13 ++++++------- src/runtime/syscall_windows.go | 3 ++- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index a8406460e2..375c34ed99 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -236,6 +236,8 @@ func windowsLoadSystemLib(name []byte) uintptr { } } +const haveCputicksAsm = GOARCH == "386" || GOARCH == "amd64" + func loadOptionalSyscalls() { var kernel32dll = []byte("kernel32.dll\000") k32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&kernel32dll[0]))) @@ -262,7 +264,7 @@ func loadOptionalSyscalls() { } _NtWaitForSingleObject = windowsFindfunc(n32, []byte("NtWaitForSingleObject\000")) - if GOARCH == "arm" { + if !haveCputicksAsm { _QueryPerformanceCounter = windowsFindfunc(k32, []byte("QueryPerformanceCounter\000")) if _QueryPerformanceCounter == nil { throw("could not find QPC syscalls") @@ -452,8 +454,10 @@ func createHighResTimer() uintptr { _SYNCHRONIZE|_TIMER_QUERY_STATE|_TIMER_MODIFY_STATE) } +const highResTimerSupported = GOARCH == "386" || GOARCH == "amd64" + func initHighResTimer() { - if GOARCH == "arm" { + if !highResTimerSupported { // TODO: Not yet implemented. return } @@ -1217,14 +1221,14 @@ func setThreadCPUProfiler(hz int32) { atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz)) } -const preemptMSupported = GOARCH != "arm" +const preemptMSupported = GOARCH == "386" || GOARCH == "amd64" // suspendLock protects simultaneous SuspendThread operations from // suspending each other. var suspendLock mutex func preemptM(mp *m) { - if GOARCH == "arm" { + if !preemptMSupported { // TODO: Implement call injection return } diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index 18834b0ec5..cb1fbe9f81 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -5,6 +5,7 @@ package runtime import ( + "runtime/internal/sys" "unsafe" ) @@ -132,16 +133,14 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 { // overwrite the PC. (See issue #35773) if r.ip() != 0 && r.ip() != funcPC(asyncPreempt) { sp := unsafe.Pointer(r.sp()) - sp = add(sp, ^(unsafe.Sizeof(uintptr(0)) - 1)) // sp-- + delta := uintptr(sys.StackAlign) + sp = add(sp, -delta) r.set_sp(uintptr(sp)) - switch GOARCH { - default: - panic("unsupported architecture") - case "386", "amd64": - *((*uintptr)(sp)) = r.ip() - case "arm": + if usesLR { *((*uintptr)(sp)) = r.lr() r.set_lr(r.ip()) + } else { + *((*uintptr)(sp)) = r.ip() } } r.set_ip(funcPC(sigpanic)) diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index add40bb0b3..6052cc333c 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -116,13 +116,14 @@ func compileCallback(fn eface, cdecl bool) (code uintptr) { // registers and the stack. panic("compileCallback: argument size is larger than uintptr") } - if k := t.kind & kindMask; (GOARCH == "amd64" || GOARCH == "arm") && (k == kindFloat32 || k == kindFloat64) { + if k := t.kind & kindMask; GOARCH != "386" && (k == kindFloat32 || k == kindFloat64) { // In fastcall, floating-point arguments in // the first four positions are passed in // floating-point registers, which we don't // currently spill. arm passes floating-point // arguments in VFP registers, which we also // don't support. + // So basically we only support 386. panic("compileCallback: float arguments not supported") } -- cgit v1.3-5-g9baa From 09e059afb1270498f416f5b5c75a6a5683b6d1da Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2021 11:34:42 -0500 Subject: runtime: enable framepointer on all arm64 Frame pointers were already enabled on linux, darwin, ios, but not freebsd, android, openbsd, netbsd. But the space was reserved on all platforms, leading to two different arm64 framepointer conditions in different parts of the code, one of which had no name (framepointer_enabled || GOARCH == "arm64", which might have been "framepointer_space_reserved"). So on the disabled systems, the stack layouts were still set up for frame pointers and the only difference was not actually maintaining the FP register in the generated code. Reduce complexity by just enabling the frame pointer completely on all the arm64 systems. This commit passes on freebsd, android, netbsd. I have not been able to try it on openbsd. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. This CL is, however, not windows/arm64-specific. It is cleanup meant to make the port (and future ports) easier. Change-Id: I83bd23369d24b76db4c6a648fa74f6917819a093 Reviewed-on: https://go-review.googlesource.com/c/go/+/288814 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/cmd/compile/internal/dwarfgen/dwarf.go | 3 +- src/cmd/compile/internal/ssagen/pgen.go | 3 +- src/cmd/internal/obj/arm64/a.out.go | 2 +- src/cmd/internal/obj/arm64/obj7.go | 293 +++++++++++++++-------------- src/cmd/internal/objabi/util.go | 2 +- src/runtime/runtime2.go | 2 +- src/runtime/traceback.go | 17 +- 7 files changed, 175 insertions(+), 147 deletions(-) (limited to 'src/runtime') diff --git a/src/cmd/compile/internal/dwarfgen/dwarf.go b/src/cmd/compile/internal/dwarfgen/dwarf.go index dd22c033cc..70168cffeb 100644 --- a/src/cmd/compile/internal/dwarfgen/dwarf.go +++ b/src/cmd/compile/internal/dwarfgen/dwarf.go @@ -271,8 +271,7 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var { if base.Ctxt.FixedFrameSize() == 0 { offs -= int64(types.PtrSize) } - if objabi.Framepointer_enabled || objabi.GOARCH == "arm64" { - // There is a word space for FP on ARM64 even if the frame pointer is disabled + if objabi.Framepointer_enabled { offs -= int64(types.PtrSize) } diff --git a/src/cmd/compile/internal/ssagen/pgen.go b/src/cmd/compile/internal/ssagen/pgen.go index 182f8408cf..40f07a8d45 100644 --- a/src/cmd/compile/internal/ssagen/pgen.go +++ b/src/cmd/compile/internal/ssagen/pgen.go @@ -213,8 +213,7 @@ func StackOffset(slot ssa.LocalSlot) int32 { if base.Ctxt.FixedFrameSize() == 0 { off -= int64(types.PtrSize) } - if objabi.Framepointer_enabled || objabi.GOARCH == "arm64" { - // There is a word space for FP on ARM64 even if the frame pointer is disabled + if objabi.Framepointer_enabled { off -= int64(types.PtrSize) } case ir.PPARAM, ir.PPARAMOUT: diff --git a/src/cmd/internal/obj/arm64/a.out.go b/src/cmd/internal/obj/arm64/a.out.go index 1d1bea505c..7ab9c1475f 100644 --- a/src/cmd/internal/obj/arm64/a.out.go +++ b/src/cmd/internal/obj/arm64/a.out.go @@ -239,7 +239,7 @@ const ( REGCTXT = REG_R26 // environment for closures REGTMP = REG_R27 // reserved for liblink REGG = REG_R28 // G - REGFP = REG_R29 // frame pointer, unused in the Go toolchain + REGFP = REG_R29 // frame pointer REGLINK = REG_R30 // ARM64 uses R31 as both stack pointer and zero register, diff --git a/src/cmd/internal/obj/arm64/obj7.go b/src/cmd/internal/obj/arm64/obj7.go index 3b88543852..8f7648e5d5 100644 --- a/src/cmd/internal/obj/arm64/obj7.go +++ b/src/cmd/internal/obj/arm64/obj7.go @@ -622,25 +622,24 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { prologueEnd.Pos = prologueEnd.Pos.WithXlogue(src.PosPrologueEnd) - if objabi.Framepointer_enabled { - q1 = obj.Appendp(q1, c.newprog) - q1.Pos = p.Pos - q1.As = AMOVD - q1.From.Type = obj.TYPE_REG - q1.From.Reg = REGFP - q1.To.Type = obj.TYPE_MEM - q1.To.Reg = REGSP - q1.To.Offset = -8 - - q1 = obj.Appendp(q1, c.newprog) - q1.Pos = p.Pos - q1.As = ASUB - q1.From.Type = obj.TYPE_CONST - q1.From.Offset = 8 - q1.Reg = REGSP - q1.To.Type = obj.TYPE_REG - q1.To.Reg = REGFP - } + // Frame pointer. + q1 = obj.Appendp(q1, c.newprog) + q1.Pos = p.Pos + q1.As = AMOVD + q1.From.Type = obj.TYPE_REG + q1.From.Reg = REGFP + q1.To.Type = obj.TYPE_MEM + q1.To.Reg = REGSP + q1.To.Offset = -8 + + q1 = obj.Appendp(q1, c.newprog) + q1.Pos = p.Pos + q1.As = ASUB + q1.From.Type = obj.TYPE_CONST + q1.From.Offset = 8 + q1.Reg = REGSP + q1.To.Type = obj.TYPE_REG + q1.To.Reg = REGFP if c.cursym.Func().Text.From.Sym.Wrapper() { // if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame @@ -765,28 +764,26 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { p.To.Reg = REGSP p.Spadj = -c.autosize - if objabi.Framepointer_enabled { - p = obj.Appendp(p, c.newprog) - p.As = ASUB - p.From.Type = obj.TYPE_CONST - p.From.Offset = 8 - p.Reg = REGSP - p.To.Type = obj.TYPE_REG - p.To.Reg = REGFP - } + // Frame pointer. + p = obj.Appendp(p, c.newprog) + p.As = ASUB + p.From.Type = obj.TYPE_CONST + p.From.Offset = 8 + p.Reg = REGSP + p.To.Type = obj.TYPE_REG + p.To.Reg = REGFP } } else { /* want write-back pre-indexed SP+autosize -> SP, loading REGLINK*/ - if objabi.Framepointer_enabled { - p.As = AMOVD - p.From.Type = obj.TYPE_MEM - p.From.Reg = REGSP - p.From.Offset = -8 - p.To.Type = obj.TYPE_REG - p.To.Reg = REGFP - p = obj.Appendp(p, c.newprog) - } + // Frame pointer. + p.As = AMOVD + p.From.Type = obj.TYPE_MEM + p.From.Reg = REGSP + p.From.Offset = -8 + p.To.Type = obj.TYPE_REG + p.To.Reg = REGFP + p = obj.Appendp(p, c.newprog) aoffset := c.autosize @@ -821,6 +818,28 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { } } + // If enabled, this code emits 'MOV PC, R27' before every 'MOV LR, PC', + // so that if you are debugging a low-level crash where PC and LR are zero, + // you can look at R27 to see what jumped to the zero. + // This is useful when bringing up Go on a new system. + // (There is similar code in ../ppc64/obj9.go:/if.false.) + const debugRETZERO = false + if debugRETZERO { + if p.As != obj.ARET { + q = newprog() + q.Pos = p.Pos + q.Link = p.Link + p.Link = q + p = q + } + p.As = AADR + p.From.Type = obj.TYPE_BRANCH + p.From.Offset = 0 + p.To.Type = obj.TYPE_REG + p.To.Reg = REGTMP + + } + if p.As != obj.ARET { q = newprog() q.Pos = p.Pos @@ -866,110 +885,106 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { } case obj.ADUFFCOPY: - if objabi.Framepointer_enabled { - // ADR ret_addr, R27 - // STP (FP, R27), -24(SP) - // SUB 24, SP, FP - // DUFFCOPY - // ret_addr: - // SUB 8, SP, FP - - q1 := p - // copy DUFFCOPY from q1 to q4 - q4 := obj.Appendp(p, c.newprog) - q4.Pos = p.Pos - q4.As = obj.ADUFFCOPY - q4.To = p.To - - q1.As = AADR - q1.From.Type = obj.TYPE_BRANCH - q1.To.Type = obj.TYPE_REG - q1.To.Reg = REG_R27 - - q2 := obj.Appendp(q1, c.newprog) - q2.Pos = p.Pos - q2.As = ASTP - q2.From.Type = obj.TYPE_REGREG - q2.From.Reg = REGFP - q2.From.Offset = int64(REG_R27) - q2.To.Type = obj.TYPE_MEM - q2.To.Reg = REGSP - q2.To.Offset = -24 - - // maintaine FP for DUFFCOPY - q3 := obj.Appendp(q2, c.newprog) - q3.Pos = p.Pos - q3.As = ASUB - q3.From.Type = obj.TYPE_CONST - q3.From.Offset = 24 - q3.Reg = REGSP - q3.To.Type = obj.TYPE_REG - q3.To.Reg = REGFP - - q5 := obj.Appendp(q4, c.newprog) - q5.Pos = p.Pos - q5.As = ASUB - q5.From.Type = obj.TYPE_CONST - q5.From.Offset = 8 - q5.Reg = REGSP - q5.To.Type = obj.TYPE_REG - q5.To.Reg = REGFP - q1.From.SetTarget(q5) - p = q5 - } + // ADR ret_addr, R27 + // STP (FP, R27), -24(SP) + // SUB 24, SP, FP + // DUFFCOPY + // ret_addr: + // SUB 8, SP, FP + + q1 := p + // copy DUFFCOPY from q1 to q4 + q4 := obj.Appendp(p, c.newprog) + q4.Pos = p.Pos + q4.As = obj.ADUFFCOPY + q4.To = p.To + + q1.As = AADR + q1.From.Type = obj.TYPE_BRANCH + q1.To.Type = obj.TYPE_REG + q1.To.Reg = REG_R27 + + q2 := obj.Appendp(q1, c.newprog) + q2.Pos = p.Pos + q2.As = ASTP + q2.From.Type = obj.TYPE_REGREG + q2.From.Reg = REGFP + q2.From.Offset = int64(REG_R27) + q2.To.Type = obj.TYPE_MEM + q2.To.Reg = REGSP + q2.To.Offset = -24 + + // maintain FP for DUFFCOPY + q3 := obj.Appendp(q2, c.newprog) + q3.Pos = p.Pos + q3.As = ASUB + q3.From.Type = obj.TYPE_CONST + q3.From.Offset = 24 + q3.Reg = REGSP + q3.To.Type = obj.TYPE_REG + q3.To.Reg = REGFP + + q5 := obj.Appendp(q4, c.newprog) + q5.Pos = p.Pos + q5.As = ASUB + q5.From.Type = obj.TYPE_CONST + q5.From.Offset = 8 + q5.Reg = REGSP + q5.To.Type = obj.TYPE_REG + q5.To.Reg = REGFP + q1.From.SetTarget(q5) + p = q5 case obj.ADUFFZERO: - if objabi.Framepointer_enabled { - // ADR ret_addr, R27 - // STP (FP, R27), -24(SP) - // SUB 24, SP, FP - // DUFFZERO - // ret_addr: - // SUB 8, SP, FP - - q1 := p - // copy DUFFZERO from q1 to q4 - q4 := obj.Appendp(p, c.newprog) - q4.Pos = p.Pos - q4.As = obj.ADUFFZERO - q4.To = p.To - - q1.As = AADR - q1.From.Type = obj.TYPE_BRANCH - q1.To.Type = obj.TYPE_REG - q1.To.Reg = REG_R27 - - q2 := obj.Appendp(q1, c.newprog) - q2.Pos = p.Pos - q2.As = ASTP - q2.From.Type = obj.TYPE_REGREG - q2.From.Reg = REGFP - q2.From.Offset = int64(REG_R27) - q2.To.Type = obj.TYPE_MEM - q2.To.Reg = REGSP - q2.To.Offset = -24 - - // maintaine FP for DUFFZERO - q3 := obj.Appendp(q2, c.newprog) - q3.Pos = p.Pos - q3.As = ASUB - q3.From.Type = obj.TYPE_CONST - q3.From.Offset = 24 - q3.Reg = REGSP - q3.To.Type = obj.TYPE_REG - q3.To.Reg = REGFP - - q5 := obj.Appendp(q4, c.newprog) - q5.Pos = p.Pos - q5.As = ASUB - q5.From.Type = obj.TYPE_CONST - q5.From.Offset = 8 - q5.Reg = REGSP - q5.To.Type = obj.TYPE_REG - q5.To.Reg = REGFP - q1.From.SetTarget(q5) - p = q5 - } + // ADR ret_addr, R27 + // STP (FP, R27), -24(SP) + // SUB 24, SP, FP + // DUFFZERO + // ret_addr: + // SUB 8, SP, FP + + q1 := p + // copy DUFFZERO from q1 to q4 + q4 := obj.Appendp(p, c.newprog) + q4.Pos = p.Pos + q4.As = obj.ADUFFZERO + q4.To = p.To + + q1.As = AADR + q1.From.Type = obj.TYPE_BRANCH + q1.To.Type = obj.TYPE_REG + q1.To.Reg = REG_R27 + + q2 := obj.Appendp(q1, c.newprog) + q2.Pos = p.Pos + q2.As = ASTP + q2.From.Type = obj.TYPE_REGREG + q2.From.Reg = REGFP + q2.From.Offset = int64(REG_R27) + q2.To.Type = obj.TYPE_MEM + q2.To.Reg = REGSP + q2.To.Offset = -24 + + // maintain FP for DUFFZERO + q3 := obj.Appendp(q2, c.newprog) + q3.Pos = p.Pos + q3.As = ASUB + q3.From.Type = obj.TYPE_CONST + q3.From.Offset = 24 + q3.Reg = REGSP + q3.To.Type = obj.TYPE_REG + q3.To.Reg = REGFP + + q5 := obj.Appendp(q4, c.newprog) + q5.Pos = p.Pos + q5.As = ASUB + q5.From.Type = obj.TYPE_CONST + q5.From.Offset = 8 + q5.Reg = REGSP + q5.To.Type = obj.TYPE_REG + q5.To.Reg = REGFP + q1.From.SetTarget(q5) + p = q5 } if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 { diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go index a73ab479a1..1f99f8ed5d 100644 --- a/src/cmd/internal/objabi/util.go +++ b/src/cmd/internal/objabi/util.go @@ -137,7 +137,7 @@ func init() { } // Note: must agree with runtime.framepointer_enabled. -var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios") +var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" func addexp(s string) { // Could do general integer parsing here, but the runtime copy doesn't yet. diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 05520d07b2..5bd283d12f 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -1106,4 +1106,4 @@ var ( ) // Must agree with cmd/internal/objabi.Framepointer_enabled. -const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios") +const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 7321790b78..eb185eecd3 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -275,7 +275,22 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in // For architectures with frame pointers, if there's // a frame, then there's a saved frame pointer here. - if frame.varp > frame.sp && (GOARCH == "amd64" || GOARCH == "arm64") { + // + // NOTE: This code is not as general as it looks. + // On x86, the ABI is to save the frame pointer word at the + // top of the stack frame, so we have to back down over it. + // On arm64, the frame pointer should be at the bottom of + // the stack (with R29 (aka FP) = RSP), in which case we would + // not want to do the subtraction here. But we started out without + // any frame pointer, and when we wanted to add it, we didn't + // want to break all the assembly doing direct writes to 8(RSP) + // to set the first parameter to a called function. + // So we decided to write the FP link *below* the stack pointer + // (with R29 = RSP - 8 in Go functions). + // This is technically ABI-compatible but not standard. + // And it happens to end up mimicking the x86 layout. + // Other architectures may make different decisions. + if frame.varp > frame.sp && framepointer_enabled { frame.varp -= sys.PtrSize } -- cgit v1.3-5-g9baa From 427bd7599d1aa2bc89faecff09777a5a662e5bf8 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 22 Jan 2021 15:16:13 -0500 Subject: runtime: generate windows/arm64 callback asm This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. Change-Id: I5e2b589797808626bcca771cdf860d5cb85586cb Reviewed-on: https://go-review.googlesource.com/c/go/+/288826 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Alex Brainman Reviewed-by: Jason A. Donenfeld --- src/runtime/syscall_windows.go | 4 +- src/runtime/wincallback.go | 29 + src/runtime/zcallback_windows_arm64.s | 4012 +++++++++++++++++++++++++++++++++ 3 files changed, 4043 insertions(+), 2 deletions(-) create mode 100644 src/runtime/zcallback_windows_arm64.s (limited to 'src/runtime') diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index 6052cc333c..666ec5f69e 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -71,8 +71,8 @@ func callbackasmAddr(i int) uintptr { panic("unsupported architecture") case "386", "amd64": entrySize = 5 - case "arm": - // On ARM, each entry is a MOV instruction + case "arm", "arm64": + // On ARM and ARM64, each entry is a MOV instruction // followed by a branch instruction entrySize = 8 } diff --git a/src/runtime/wincallback.go b/src/runtime/wincallback.go index fb452222da..cf3327c6fe 100644 --- a/src/runtime/wincallback.go +++ b/src/runtime/wincallback.go @@ -72,6 +72,34 @@ TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0 } } +func genasmArm64() { + var buf bytes.Buffer + + buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOV and B instructions. +// The MOV instruction loads R12 with the callback index, and the +// B instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0 +`) + for i := 0; i < maxCallback; i++ { + buf.WriteString(fmt.Sprintf("\tMOVD\t$%d, R12\n", i)) + buf.WriteString("\tB\truntime·callbackasm1(SB)\n") + } + + err := os.WriteFile("zcallback_windows_arm64.s", buf.Bytes(), 0666) + if err != nil { + fmt.Fprintf(os.Stderr, "wincallback: %s\n", err) + os.Exit(2) + } +} + func gengo() { var buf bytes.Buffer @@ -91,5 +119,6 @@ const cb_max = %d // maximum number of windows callbacks allowed func main() { genasm386Amd64() genasmArm() + genasmArm64() gengo() } diff --git a/src/runtime/zcallback_windows_arm64.s b/src/runtime/zcallback_windows_arm64.s new file mode 100644 index 0000000000..69fb05788c --- /dev/null +++ b/src/runtime/zcallback_windows_arm64.s @@ -0,0 +1,4012 @@ +// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. + +// External code calls into callbackasm at an offset corresponding +// to the callback index. Callbackasm is a table of MOV and B instructions. +// The MOV instruction loads R12 with the callback index, and the +// B instruction branches to callbackasm1. +// callbackasm1 takes the callback index from R12 and +// indexes into an array that stores information about each callback. +// It then calls the Go implementation for that callback. +#include "textflag.h" + +TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0 + MOVD $0, R12 + B runtime·callbackasm1(SB) + MOVD $1, R12 + B runtime·callbackasm1(SB) + MOVD $2, R12 + B runtime·callbackasm1(SB) + MOVD $3, R12 + B runtime·callbackasm1(SB) + MOVD $4, R12 + B runtime·callbackasm1(SB) + MOVD $5, R12 + B runtime·callbackasm1(SB) + MOVD $6, R12 + B runtime·callbackasm1(SB) + MOVD $7, R12 + B runtime·callbackasm1(SB) + MOVD $8, R12 + B runtime·callbackasm1(SB) + MOVD $9, R12 + B runtime·callbackasm1(SB) + MOVD $10, R12 + B runtime·callbackasm1(SB) + MOVD $11, R12 + B runtime·callbackasm1(SB) + MOVD $12, R12 + B runtime·callbackasm1(SB) + MOVD $13, R12 + B runtime·callbackasm1(SB) + MOVD $14, R12 + B runtime·callbackasm1(SB) + MOVD $15, R12 + B runtime·callbackasm1(SB) + MOVD $16, R12 + B runtime·callbackasm1(SB) + MOVD $17, R12 + B runtime·callbackasm1(SB) + MOVD $18, R12 + B runtime·callbackasm1(SB) + MOVD $19, R12 + B runtime·callbackasm1(SB) + MOVD $20, R12 + B runtime·callbackasm1(SB) + MOVD $21, R12 + B runtime·callbackasm1(SB) + MOVD $22, R12 + B runtime·callbackasm1(SB) + MOVD $23, R12 + B runtime·callbackasm1(SB) + MOVD $24, R12 + B runtime·callbackasm1(SB) + MOVD $25, R12 + B runtime·callbackasm1(SB) + MOVD $26, R12 + B runtime·callbackasm1(SB) + MOVD $27, R12 + B runtime·callbackasm1(SB) + MOVD $28, R12 + B runtime·callbackasm1(SB) + MOVD $29, R12 + B runtime·callbackasm1(SB) + MOVD $30, R12 + B runtime·callbackasm1(SB) + MOVD $31, R12 + B runtime·callbackasm1(SB) + MOVD $32, R12 + B runtime·callbackasm1(SB) + MOVD $33, R12 + B runtime·callbackasm1(SB) + MOVD $34, R12 + B runtime·callbackasm1(SB) + MOVD $35, R12 + B runtime·callbackasm1(SB) + MOVD $36, R12 + B runtime·callbackasm1(SB) + MOVD $37, R12 + B runtime·callbackasm1(SB) + MOVD $38, R12 + B runtime·callbackasm1(SB) + MOVD $39, R12 + B runtime·callbackasm1(SB) + MOVD $40, R12 + B runtime·callbackasm1(SB) + MOVD $41, R12 + B runtime·callbackasm1(SB) + MOVD $42, R12 + B runtime·callbackasm1(SB) + MOVD $43, R12 + B runtime·callbackasm1(SB) + MOVD $44, R12 + B runtime·callbackasm1(SB) + MOVD $45, R12 + B runtime·callbackasm1(SB) + MOVD $46, R12 + B runtime·callbackasm1(SB) + MOVD $47, R12 + B runtime·callbackasm1(SB) + MOVD $48, R12 + B runtime·callbackasm1(SB) + MOVD $49, R12 + B runtime·callbackasm1(SB) + MOVD $50, R12 + B runtime·callbackasm1(SB) + MOVD $51, R12 + B runtime·callbackasm1(SB) + MOVD $52, R12 + B runtime·callbackasm1(SB) + MOVD $53, R12 + B runtime·callbackasm1(SB) + MOVD $54, R12 + B runtime·callbackasm1(SB) + MOVD $55, R12 + B runtime·callbackasm1(SB) + MOVD $56, R12 + B runtime·callbackasm1(SB) + MOVD $57, R12 + B runtime·callbackasm1(SB) + MOVD $58, R12 + B runtime·callbackasm1(SB) + MOVD $59, R12 + B runtime·callbackasm1(SB) + MOVD $60, R12 + B runtime·callbackasm1(SB) + MOVD $61, R12 + B runtime·callbackasm1(SB) + MOVD $62, R12 + B runtime·callbackasm1(SB) + MOVD $63, R12 + B runtime·callbackasm1(SB) + MOVD $64, R12 + B runtime·callbackasm1(SB) + MOVD $65, R12 + B runtime·callbackasm1(SB) + MOVD $66, R12 + B runtime·callbackasm1(SB) + MOVD $67, R12 + B runtime·callbackasm1(SB) + MOVD $68, R12 + B runtime·callbackasm1(SB) + MOVD $69, R12 + B runtime·callbackasm1(SB) + MOVD $70, R12 + B runtime·callbackasm1(SB) + MOVD $71, R12 + B runtime·callbackasm1(SB) + MOVD $72, R12 + B runtime·callbackasm1(SB) + MOVD $73, R12 + B runtime·callbackasm1(SB) + MOVD $74, R12 + B runtime·callbackasm1(SB) + MOVD $75, R12 + B runtime·callbackasm1(SB) + MOVD $76, R12 + B runtime·callbackasm1(SB) + MOVD $77, R12 + B runtime·callbackasm1(SB) + MOVD $78, R12 + B runtime·callbackasm1(SB) + MOVD $79, R12 + B runtime·callbackasm1(SB) + MOVD $80, R12 + B runtime·callbackasm1(SB) + MOVD $81, R12 + B runtime·callbackasm1(SB) + MOVD $82, R12 + B runtime·callbackasm1(SB) + MOVD $83, R12 + B runtime·callbackasm1(SB) + MOVD $84, R12 + B runtime·callbackasm1(SB) + MOVD $85, R12 + B runtime·callbackasm1(SB) + MOVD $86, R12 + B runtime·callbackasm1(SB) + MOVD $87, R12 + B runtime·callbackasm1(SB) + MOVD $88, R12 + B runtime·callbackasm1(SB) + MOVD $89, R12 + B runtime·callbackasm1(SB) + MOVD $90, R12 + B runtime·callbackasm1(SB) + MOVD $91, R12 + B runtime·callbackasm1(SB) + MOVD $92, R12 + B runtime·callbackasm1(SB) + MOVD $93, R12 + B runtime·callbackasm1(SB) + MOVD $94, R12 + B runtime·callbackasm1(SB) + MOVD $95, R12 + B runtime·callbackasm1(SB) + MOVD $96, R12 + B runtime·callbackasm1(SB) + MOVD $97, R12 + B runtime·callbackasm1(SB) + MOVD $98, R12 + B runtime·callbackasm1(SB) + MOVD $99, R12 + B runtime·callbackasm1(SB) + MOVD $100, R12 + B runtime·callbackasm1(SB) + MOVD $101, R12 + B runtime·callbackasm1(SB) + MOVD $102, R12 + B runtime·callbackasm1(SB) + MOVD $103, R12 + B runtime·callbackasm1(SB) + MOVD $104, R12 + B runtime·callbackasm1(SB) + MOVD $105, R12 + B runtime·callbackasm1(SB) + MOVD $106, R12 + B runtime·callbackasm1(SB) + MOVD $107, R12 + B runtime·callbackasm1(SB) + MOVD $108, R12 + B runtime·callbackasm1(SB) + MOVD $109, R12 + B runtime·callbackasm1(SB) + MOVD $110, R12 + B runtime·callbackasm1(SB) + MOVD $111, R12 + B runtime·callbackasm1(SB) + MOVD $112, R12 + B runtime·callbackasm1(SB) + MOVD $113, R12 + B runtime·callbackasm1(SB) + MOVD $114, R12 + B runtime·callbackasm1(SB) + MOVD $115, R12 + B runtime·callbackasm1(SB) + MOVD $116, R12 + B runtime·callbackasm1(SB) + MOVD $117, R12 + B runtime·callbackasm1(SB) + MOVD $118, R12 + B runtime·callbackasm1(SB) + MOVD $119, R12 + B runtime·callbackasm1(SB) + MOVD $120, R12 + B runtime·callbackasm1(SB) + MOVD $121, R12 + B runtime·callbackasm1(SB) + MOVD $122, R12 + B runtime·callbackasm1(SB) + MOVD $123, R12 + B runtime·callbackasm1(SB) + MOVD $124, R12 + B runtime·callbackasm1(SB) + MOVD $125, R12 + B runtime·callbackasm1(SB) + MOVD $126, R12 + B runtime·callbackasm1(SB) + MOVD $127, R12 + B runtime·callbackasm1(SB) + MOVD $128, R12 + B runtime·callbackasm1(SB) + MOVD $129, R12 + B runtime·callbackasm1(SB) + MOVD $130, R12 + B runtime·callbackasm1(SB) + MOVD $131, R12 + B runtime·callbackasm1(SB) + MOVD $132, R12 + B runtime·callbackasm1(SB) + MOVD $133, R12 + B runtime·callbackasm1(SB) + MOVD $134, R12 + B runtime·callbackasm1(SB) + MOVD $135, R12 + B runtime·callbackasm1(SB) + MOVD $136, R12 + B runtime·callbackasm1(SB) + MOVD $137, R12 + B runtime·callbackasm1(SB) + MOVD $138, R12 + B runtime·callbackasm1(SB) + MOVD $139, R12 + B runtime·callbackasm1(SB) + MOVD $140, R12 + B runtime·callbackasm1(SB) + MOVD $141, R12 + B runtime·callbackasm1(SB) + MOVD $142, R12 + B runtime·callbackasm1(SB) + MOVD $143, R12 + B runtime·callbackasm1(SB) + MOVD $144, R12 + B runtime·callbackasm1(SB) + MOVD $145, R12 + B runtime·callbackasm1(SB) + MOVD $146, R12 + B runtime·callbackasm1(SB) + MOVD $147, R12 + B runtime·callbackasm1(SB) + MOVD $148, R12 + B runtime·callbackasm1(SB) + MOVD $149, R12 + B runtime·callbackasm1(SB) + MOVD $150, R12 + B runtime·callbackasm1(SB) + MOVD $151, R12 + B runtime·callbackasm1(SB) + MOVD $152, R12 + B runtime·callbackasm1(SB) + MOVD $153, R12 + B runtime·callbackasm1(SB) + MOVD $154, R12 + B runtime·callbackasm1(SB) + MOVD $155, R12 + B runtime·callbackasm1(SB) + MOVD $156, R12 + B runtime·callbackasm1(SB) + MOVD $157, R12 + B runtime·callbackasm1(SB) + MOVD $158, R12 + B runtime·callbackasm1(SB) + MOVD $159, R12 + B runtime·callbackasm1(SB) + MOVD $160, R12 + B runtime·callbackasm1(SB) + MOVD $161, R12 + B runtime·callbackasm1(SB) + MOVD $162, R12 + B runtime·callbackasm1(SB) + MOVD $163, R12 + B runtime·callbackasm1(SB) + MOVD $164, R12 + B runtime·callbackasm1(SB) + MOVD $165, R12 + B runtime·callbackasm1(SB) + MOVD $166, R12 + B runtime·callbackasm1(SB) + MOVD $167, R12 + B runtime·callbackasm1(SB) + MOVD $168, R12 + B runtime·callbackasm1(SB) + MOVD $169, R12 + B runtime·callbackasm1(SB) + MOVD $170, R12 + B runtime·callbackasm1(SB) + MOVD $171, R12 + B runtime·callbackasm1(SB) + MOVD $172, R12 + B runtime·callbackasm1(SB) + MOVD $173, R12 + B runtime·callbackasm1(SB) + MOVD $174, R12 + B runtime·callbackasm1(SB) + MOVD $175, R12 + B runtime·callbackasm1(SB) + MOVD $176, R12 + B runtime·callbackasm1(SB) + MOVD $177, R12 + B runtime·callbackasm1(SB) + MOVD $178, R12 + B runtime·callbackasm1(SB) + MOVD $179, R12 + B runtime·callbackasm1(SB) + MOVD $180, R12 + B runtime·callbackasm1(SB) + MOVD $181, R12 + B runtime·callbackasm1(SB) + MOVD $182, R12 + B runtime·callbackasm1(SB) + MOVD $183, R12 + B runtime·callbackasm1(SB) + MOVD $184, R12 + B runtime·callbackasm1(SB) + MOVD $185, R12 + B runtime·callbackasm1(SB) + MOVD $186, R12 + B runtime·callbackasm1(SB) + MOVD $187, R12 + B runtime·callbackasm1(SB) + MOVD $188, R12 + B runtime·callbackasm1(SB) + MOVD $189, R12 + B runtime·callbackasm1(SB) + MOVD $190, R12 + B runtime·callbackasm1(SB) + MOVD $191, R12 + B runtime·callbackasm1(SB) + MOVD $192, R12 + B runtime·callbackasm1(SB) + MOVD $193, R12 + B runtime·callbackasm1(SB) + MOVD $194, R12 + B runtime·callbackasm1(SB) + MOVD $195, R12 + B runtime·callbackasm1(SB) + MOVD $196, R12 + B runtime·callbackasm1(SB) + MOVD $197, R12 + B runtime·callbackasm1(SB) + MOVD $198, R12 + B runtime·callbackasm1(SB) + MOVD $199, R12 + B runtime·callbackasm1(SB) + MOVD $200, R12 + B runtime·callbackasm1(SB) + MOVD $201, R12 + B runtime·callbackasm1(SB) + MOVD $202, R12 + B runtime·callbackasm1(SB) + MOVD $203, R12 + B runtime·callbackasm1(SB) + MOVD $204, R12 + B runtime·callbackasm1(SB) + MOVD $205, R12 + B runtime·callbackasm1(SB) + MOVD $206, R12 + B runtime·callbackasm1(SB) + MOVD $207, R12 + B runtime·callbackasm1(SB) + MOVD $208, R12 + B runtime·callbackasm1(SB) + MOVD $209, R12 + B runtime·callbackasm1(SB) + MOVD $210, R12 + B runtime·callbackasm1(SB) + MOVD $211, R12 + B runtime·callbackasm1(SB) + MOVD $212, R12 + B runtime·callbackasm1(SB) + MOVD $213, R12 + B runtime·callbackasm1(SB) + MOVD $214, R12 + B runtime·callbackasm1(SB) + MOVD $215, R12 + B runtime·callbackasm1(SB) + MOVD $216, R12 + B runtime·callbackasm1(SB) + MOVD $217, R12 + B runtime·callbackasm1(SB) + MOVD $218, R12 + B runtime·callbackasm1(SB) + MOVD $219, R12 + B runtime·callbackasm1(SB) + MOVD $220, R12 + B runtime·callbackasm1(SB) + MOVD $221, R12 + B runtime·callbackasm1(SB) + MOVD $222, R12 + B runtime·callbackasm1(SB) + MOVD $223, R12 + B runtime·callbackasm1(SB) + MOVD $224, R12 + B runtime·callbackasm1(SB) + MOVD $225, R12 + B runtime·callbackasm1(SB) + MOVD $226, R12 + B runtime·callbackasm1(SB) + MOVD $227, R12 + B runtime·callbackasm1(SB) + MOVD $228, R12 + B runtime·callbackasm1(SB) + MOVD $229, R12 + B runtime·callbackasm1(SB) + MOVD $230, R12 + B runtime·callbackasm1(SB) + MOVD $231, R12 + B runtime·callbackasm1(SB) + MOVD $232, R12 + B runtime·callbackasm1(SB) + MOVD $233, R12 + B runtime·callbackasm1(SB) + MOVD $234, R12 + B runtime·callbackasm1(SB) + MOVD $235, R12 + B runtime·callbackasm1(SB) + MOVD $236, R12 + B runtime·callbackasm1(SB) + MOVD $237, R12 + B runtime·callbackasm1(SB) + MOVD $238, R12 + B runtime·callbackasm1(SB) + MOVD $239, R12 + B runtime·callbackasm1(SB) + MOVD $240, R12 + B runtime·callbackasm1(SB) + MOVD $241, R12 + B runtime·callbackasm1(SB) + MOVD $242, R12 + B runtime·callbackasm1(SB) + MOVD $243, R12 + B runtime·callbackasm1(SB) + MOVD $244, R12 + B runtime·callbackasm1(SB) + MOVD $245, R12 + B runtime·callbackasm1(SB) + MOVD $246, R12 + B runtime·callbackasm1(SB) + MOVD $247, R12 + B runtime·callbackasm1(SB) + MOVD $248, R12 + B runtime·callbackasm1(SB) + MOVD $249, R12 + B runtime·callbackasm1(SB) + MOVD $250, R12 + B runtime·callbackasm1(SB) + MOVD $251, R12 + B runtime·callbackasm1(SB) + MOVD $252, R12 + B runtime·callbackasm1(SB) + MOVD $253, R12 + B runtime·callbackasm1(SB) + MOVD $254, R12 + B runtime·callbackasm1(SB) + MOVD $255, R12 + B runtime·callbackasm1(SB) + MOVD $256, R12 + B runtime·callbackasm1(SB) + MOVD $257, R12 + B runtime·callbackasm1(SB) + MOVD $258, R12 + B runtime·callbackasm1(SB) + MOVD $259, R12 + B runtime·callbackasm1(SB) + MOVD $260, R12 + B runtime·callbackasm1(SB) + MOVD $261, R12 + B runtime·callbackasm1(SB) + MOVD $262, R12 + B runtime·callbackasm1(SB) + MOVD $263, R12 + B runtime·callbackasm1(SB) + MOVD $264, R12 + B runtime·callbackasm1(SB) + MOVD $265, R12 + B runtime·callbackasm1(SB) + MOVD $266, R12 + B runtime·callbackasm1(SB) + MOVD $267, R12 + B runtime·callbackasm1(SB) + MOVD $268, R12 + B runtime·callbackasm1(SB) + MOVD $269, R12 + B runtime·callbackasm1(SB) + MOVD $270, R12 + B runtime·callbackasm1(SB) + MOVD $271, R12 + B runtime·callbackasm1(SB) + MOVD $272, R12 + B runtime·callbackasm1(SB) + MOVD $273, R12 + B runtime·callbackasm1(SB) + MOVD $274, R12 + B runtime·callbackasm1(SB) + MOVD $275, R12 + B runtime·callbackasm1(SB) + MOVD $276, R12 + B runtime·callbackasm1(SB) + MOVD $277, R12 + B runtime·callbackasm1(SB) + MOVD $278, R12 + B runtime·callbackasm1(SB) + MOVD $279, R12 + B runtime·callbackasm1(SB) + MOVD $280, R12 + B runtime·callbackasm1(SB) + MOVD $281, R12 + B runtime·callbackasm1(SB) + MOVD $282, R12 + B runtime·callbackasm1(SB) + MOVD $283, R12 + B runtime·callbackasm1(SB) + MOVD $284, R12 + B runtime·callbackasm1(SB) + MOVD $285, R12 + B runtime·callbackasm1(SB) + MOVD $286, R12 + B runtime·callbackasm1(SB) + MOVD $287, R12 + B runtime·callbackasm1(SB) + MOVD $288, R12 + B runtime·callbackasm1(SB) + MOVD $289, R12 + B runtime·callbackasm1(SB) + MOVD $290, R12 + B runtime·callbackasm1(SB) + MOVD $291, R12 + B runtime·callbackasm1(SB) + MOVD $292, R12 + B runtime·callbackasm1(SB) + MOVD $293, R12 + B runtime·callbackasm1(SB) + MOVD $294, R12 + B runtime·callbackasm1(SB) + MOVD $295, R12 + B runtime·callbackasm1(SB) + MOVD $296, R12 + B runtime·callbackasm1(SB) + MOVD $297, R12 + B runtime·callbackasm1(SB) + MOVD $298, R12 + B runtime·callbackasm1(SB) + MOVD $299, R12 + B runtime·callbackasm1(SB) + MOVD $300, R12 + B runtime·callbackasm1(SB) + MOVD $301, R12 + B runtime·callbackasm1(SB) + MOVD $302, R12 + B runtime·callbackasm1(SB) + MOVD $303, R12 + B runtime·callbackasm1(SB) + MOVD $304, R12 + B runtime·callbackasm1(SB) + MOVD $305, R12 + B runtime·callbackasm1(SB) + MOVD $306, R12 + B runtime·callbackasm1(SB) + MOVD $307, R12 + B runtime·callbackasm1(SB) + MOVD $308, R12 + B runtime·callbackasm1(SB) + MOVD $309, R12 + B runtime·callbackasm1(SB) + MOVD $310, R12 + B runtime·callbackasm1(SB) + MOVD $311, R12 + B runtime·callbackasm1(SB) + MOVD $312, R12 + B runtime·callbackasm1(SB) + MOVD $313, R12 + B runtime·callbackasm1(SB) + MOVD $314, R12 + B runtime·callbackasm1(SB) + MOVD $315, R12 + B runtime·callbackasm1(SB) + MOVD $316, R12 + B runtime·callbackasm1(SB) + MOVD $317, R12 + B runtime·callbackasm1(SB) + MOVD $318, R12 + B runtime·callbackasm1(SB) + MOVD $319, R12 + B runtime·callbackasm1(SB) + MOVD $320, R12 + B runtime·callbackasm1(SB) + MOVD $321, R12 + B runtime·callbackasm1(SB) + MOVD $322, R12 + B runtime·callbackasm1(SB) + MOVD $323, R12 + B runtime·callbackasm1(SB) + MOVD $324, R12 + B runtime·callbackasm1(SB) + MOVD $325, R12 + B runtime·callbackasm1(SB) + MOVD $326, R12 + B runtime·callbackasm1(SB) + MOVD $327, R12 + B runtime·callbackasm1(SB) + MOVD $328, R12 + B runtime·callbackasm1(SB) + MOVD $329, R12 + B runtime·callbackasm1(SB) + MOVD $330, R12 + B runtime·callbackasm1(SB) + MOVD $331, R12 + B runtime·callbackasm1(SB) + MOVD $332, R12 + B runtime·callbackasm1(SB) + MOVD $333, R12 + B runtime·callbackasm1(SB) + MOVD $334, R12 + B runtime·callbackasm1(SB) + MOVD $335, R12 + B runtime·callbackasm1(SB) + MOVD $336, R12 + B runtime·callbackasm1(SB) + MOVD $337, R12 + B runtime·callbackasm1(SB) + MOVD $338, R12 + B runtime·callbackasm1(SB) + MOVD $339, R12 + B runtime·callbackasm1(SB) + MOVD $340, R12 + B runtime·callbackasm1(SB) + MOVD $341, R12 + B runtime·callbackasm1(SB) + MOVD $342, R12 + B runtime·callbackasm1(SB) + MOVD $343, R12 + B runtime·callbackasm1(SB) + MOVD $344, R12 + B runtime·callbackasm1(SB) + MOVD $345, R12 + B runtime·callbackasm1(SB) + MOVD $346, R12 + B runtime·callbackasm1(SB) + MOVD $347, R12 + B runtime·callbackasm1(SB) + MOVD $348, R12 + B runtime·callbackasm1(SB) + MOVD $349, R12 + B runtime·callbackasm1(SB) + MOVD $350, R12 + B runtime·callbackasm1(SB) + MOVD $351, R12 + B runtime·callbackasm1(SB) + MOVD $352, R12 + B runtime·callbackasm1(SB) + MOVD $353, R12 + B runtime·callbackasm1(SB) + MOVD $354, R12 + B runtime·callbackasm1(SB) + MOVD $355, R12 + B runtime·callbackasm1(SB) + MOVD $356, R12 + B runtime·callbackasm1(SB) + MOVD $357, R12 + B runtime·callbackasm1(SB) + MOVD $358, R12 + B runtime·callbackasm1(SB) + MOVD $359, R12 + B runtime·callbackasm1(SB) + MOVD $360, R12 + B runtime·callbackasm1(SB) + MOVD $361, R12 + B runtime·callbackasm1(SB) + MOVD $362, R12 + B runtime·callbackasm1(SB) + MOVD $363, R12 + B runtime·callbackasm1(SB) + MOVD $364, R12 + B runtime·callbackasm1(SB) + MOVD $365, R12 + B runtime·callbackasm1(SB) + MOVD $366, R12 + B runtime·callbackasm1(SB) + MOVD $367, R12 + B runtime·callbackasm1(SB) + MOVD $368, R12 + B runtime·callbackasm1(SB) + MOVD $369, R12 + B runtime·callbackasm1(SB) + MOVD $370, R12 + B runtime·callbackasm1(SB) + MOVD $371, R12 + B runtime·callbackasm1(SB) + MOVD $372, R12 + B runtime·callbackasm1(SB) + MOVD $373, R12 + B runtime·callbackasm1(SB) + MOVD $374, R12 + B runtime·callbackasm1(SB) + MOVD $375, R12 + B runtime·callbackasm1(SB) + MOVD $376, R12 + B runtime·callbackasm1(SB) + MOVD $377, R12 + B runtime·callbackasm1(SB) + MOVD $378, R12 + B runtime·callbackasm1(SB) + MOVD $379, R12 + B runtime·callbackasm1(SB) + MOVD $380, R12 + B runtime·callbackasm1(SB) + MOVD $381, R12 + B runtime·callbackasm1(SB) + MOVD $382, R12 + B runtime·callbackasm1(SB) + MOVD $383, R12 + B runtime·callbackasm1(SB) + MOVD $384, R12 + B runtime·callbackasm1(SB) + MOVD $385, R12 + B runtime·callbackasm1(SB) + MOVD $386, R12 + B runtime·callbackasm1(SB) + MOVD $387, R12 + B runtime·callbackasm1(SB) + MOVD $388, R12 + B runtime·callbackasm1(SB) + MOVD $389, R12 + B runtime·callbackasm1(SB) + MOVD $390, R12 + B runtime·callbackasm1(SB) + MOVD $391, R12 + B runtime·callbackasm1(SB) + MOVD $392, R12 + B runtime·callbackasm1(SB) + MOVD $393, R12 + B runtime·callbackasm1(SB) + MOVD $394, R12 + B runtime·callbackasm1(SB) + MOVD $395, R12 + B runtime·callbackasm1(SB) + MOVD $396, R12 + B runtime·callbackasm1(SB) + MOVD $397, R12 + B runtime·callbackasm1(SB) + MOVD $398, R12 + B runtime·callbackasm1(SB) + MOVD $399, R12 + B runtime·callbackasm1(SB) + MOVD $400, R12 + B runtime·callbackasm1(SB) + MOVD $401, R12 + B runtime·callbackasm1(SB) + MOVD $402, R12 + B runtime·callbackasm1(SB) + MOVD $403, R12 + B runtime·callbackasm1(SB) + MOVD $404, R12 + B runtime·callbackasm1(SB) + MOVD $405, R12 + B runtime·callbackasm1(SB) + MOVD $406, R12 + B runtime·callbackasm1(SB) + MOVD $407, R12 + B runtime·callbackasm1(SB) + MOVD $408, R12 + B runtime·callbackasm1(SB) + MOVD $409, R12 + B runtime·callbackasm1(SB) + MOVD $410, R12 + B runtime·callbackasm1(SB) + MOVD $411, R12 + B runtime·callbackasm1(SB) + MOVD $412, R12 + B runtime·callbackasm1(SB) + MOVD $413, R12 + B runtime·callbackasm1(SB) + MOVD $414, R12 + B runtime·callbackasm1(SB) + MOVD $415, R12 + B runtime·callbackasm1(SB) + MOVD $416, R12 + B runtime·callbackasm1(SB) + MOVD $417, R12 + B runtime·callbackasm1(SB) + MOVD $418, R12 + B runtime·callbackasm1(SB) + MOVD $419, R12 + B runtime·callbackasm1(SB) + MOVD $420, R12 + B runtime·callbackasm1(SB) + MOVD $421, R12 + B runtime·callbackasm1(SB) + MOVD $422, R12 + B runtime·callbackasm1(SB) + MOVD $423, R12 + B runtime·callbackasm1(SB) + MOVD $424, R12 + B runtime·callbackasm1(SB) + MOVD $425, R12 + B runtime·callbackasm1(SB) + MOVD $426, R12 + B runtime·callbackasm1(SB) + MOVD $427, R12 + B runtime·callbackasm1(SB) + MOVD $428, R12 + B runtime·callbackasm1(SB) + MOVD $429, R12 + B runtime·callbackasm1(SB) + MOVD $430, R12 + B runtime·callbackasm1(SB) + MOVD $431, R12 + B runtime·callbackasm1(SB) + MOVD $432, R12 + B runtime·callbackasm1(SB) + MOVD $433, R12 + B runtime·callbackasm1(SB) + MOVD $434, R12 + B runtime·callbackasm1(SB) + MOVD $435, R12 + B runtime·callbackasm1(SB) + MOVD $436, R12 + B runtime·callbackasm1(SB) + MOVD $437, R12 + B runtime·callbackasm1(SB) + MOVD $438, R12 + B runtime·callbackasm1(SB) + MOVD $439, R12 + B runtime·callbackasm1(SB) + MOVD $440, R12 + B runtime·callbackasm1(SB) + MOVD $441, R12 + B runtime·callbackasm1(SB) + MOVD $442, R12 + B runtime·callbackasm1(SB) + MOVD $443, R12 + B runtime·callbackasm1(SB) + MOVD $444, R12 + B runtime·callbackasm1(SB) + MOVD $445, R12 + B runtime·callbackasm1(SB) + MOVD $446, R12 + B runtime·callbackasm1(SB) + MOVD $447, R12 + B runtime·callbackasm1(SB) + MOVD $448, R12 + B runtime·callbackasm1(SB) + MOVD $449, R12 + B runtime·callbackasm1(SB) + MOVD $450, R12 + B runtime·callbackasm1(SB) + MOVD $451, R12 + B runtime·callbackasm1(SB) + MOVD $452, R12 + B runtime·callbackasm1(SB) + MOVD $453, R12 + B runtime·callbackasm1(SB) + MOVD $454, R12 + B runtime·callbackasm1(SB) + MOVD $455, R12 + B runtime·callbackasm1(SB) + MOVD $456, R12 + B runtime·callbackasm1(SB) + MOVD $457, R12 + B runtime·callbackasm1(SB) + MOVD $458, R12 + B runtime·callbackasm1(SB) + MOVD $459, R12 + B runtime·callbackasm1(SB) + MOVD $460, R12 + B runtime·callbackasm1(SB) + MOVD $461, R12 + B runtime·callbackasm1(SB) + MOVD $462, R12 + B runtime·callbackasm1(SB) + MOVD $463, R12 + B runtime·callbackasm1(SB) + MOVD $464, R12 + B runtime·callbackasm1(SB) + MOVD $465, R12 + B runtime·callbackasm1(SB) + MOVD $466, R12 + B runtime·callbackasm1(SB) + MOVD $467, R12 + B runtime·callbackasm1(SB) + MOVD $468, R12 + B runtime·callbackasm1(SB) + MOVD $469, R12 + B runtime·callbackasm1(SB) + MOVD $470, R12 + B runtime·callbackasm1(SB) + MOVD $471, R12 + B runtime·callbackasm1(SB) + MOVD $472, R12 + B runtime·callbackasm1(SB) + MOVD $473, R12 + B runtime·callbackasm1(SB) + MOVD $474, R12 + B runtime·callbackasm1(SB) + MOVD $475, R12 + B runtime·callbackasm1(SB) + MOVD $476, R12 + B runtime·callbackasm1(SB) + MOVD $477, R12 + B runtime·callbackasm1(SB) + MOVD $478, R12 + B runtime·callbackasm1(SB) + MOVD $479, R12 + B runtime·callbackasm1(SB) + MOVD $480, R12 + B runtime·callbackasm1(SB) + MOVD $481, R12 + B runtime·callbackasm1(SB) + MOVD $482, R12 + B runtime·callbackasm1(SB) + MOVD $483, R12 + B runtime·callbackasm1(SB) + MOVD $484, R12 + B runtime·callbackasm1(SB) + MOVD $485, R12 + B runtime·callbackasm1(SB) + MOVD $486, R12 + B runtime·callbackasm1(SB) + MOVD $487, R12 + B runtime·callbackasm1(SB) + MOVD $488, R12 + B runtime·callbackasm1(SB) + MOVD $489, R12 + B runtime·callbackasm1(SB) + MOVD $490, R12 + B runtime·callbackasm1(SB) + MOVD $491, R12 + B runtime·callbackasm1(SB) + MOVD $492, R12 + B runtime·callbackasm1(SB) + MOVD $493, R12 + B runtime·callbackasm1(SB) + MOVD $494, R12 + B runtime·callbackasm1(SB) + MOVD $495, R12 + B runtime·callbackasm1(SB) + MOVD $496, R12 + B runtime·callbackasm1(SB) + MOVD $497, R12 + B runtime·callbackasm1(SB) + MOVD $498, R12 + B runtime·callbackasm1(SB) + MOVD $499, R12 + B runtime·callbackasm1(SB) + MOVD $500, R12 + B runtime·callbackasm1(SB) + MOVD $501, R12 + B runtime·callbackasm1(SB) + MOVD $502, R12 + B runtime·callbackasm1(SB) + MOVD $503, R12 + B runtime·callbackasm1(SB) + MOVD $504, R12 + B runtime·callbackasm1(SB) + MOVD $505, R12 + B runtime·callbackasm1(SB) + MOVD $506, R12 + B runtime·callbackasm1(SB) + MOVD $507, R12 + B runtime·callbackasm1(SB) + MOVD $508, R12 + B runtime·callbackasm1(SB) + MOVD $509, R12 + B runtime·callbackasm1(SB) + MOVD $510, R12 + B runtime·callbackasm1(SB) + MOVD $511, R12 + B runtime·callbackasm1(SB) + MOVD $512, R12 + B runtime·callbackasm1(SB) + MOVD $513, R12 + B runtime·callbackasm1(SB) + MOVD $514, R12 + B runtime·callbackasm1(SB) + MOVD $515, R12 + B runtime·callbackasm1(SB) + MOVD $516, R12 + B runtime·callbackasm1(SB) + MOVD $517, R12 + B runtime·callbackasm1(SB) + MOVD $518, R12 + B runtime·callbackasm1(SB) + MOVD $519, R12 + B runtime·callbackasm1(SB) + MOVD $520, R12 + B runtime·callbackasm1(SB) + MOVD $521, R12 + B runtime·callbackasm1(SB) + MOVD $522, R12 + B runtime·callbackasm1(SB) + MOVD $523, R12 + B runtime·callbackasm1(SB) + MOVD $524, R12 + B runtime·callbackasm1(SB) + MOVD $525, R12 + B runtime·callbackasm1(SB) + MOVD $526, R12 + B runtime·callbackasm1(SB) + MOVD $527, R12 + B runtime·callbackasm1(SB) + MOVD $528, R12 + B runtime·callbackasm1(SB) + MOVD $529, R12 + B runtime·callbackasm1(SB) + MOVD $530, R12 + B runtime·callbackasm1(SB) + MOVD $531, R12 + B runtime·callbackasm1(SB) + MOVD $532, R12 + B runtime·callbackasm1(SB) + MOVD $533, R12 + B runtime·callbackasm1(SB) + MOVD $534, R12 + B runtime·callbackasm1(SB) + MOVD $535, R12 + B runtime·callbackasm1(SB) + MOVD $536, R12 + B runtime·callbackasm1(SB) + MOVD $537, R12 + B runtime·callbackasm1(SB) + MOVD $538, R12 + B runtime·callbackasm1(SB) + MOVD $539, R12 + B runtime·callbackasm1(SB) + MOVD $540, R12 + B runtime·callbackasm1(SB) + MOVD $541, R12 + B runtime·callbackasm1(SB) + MOVD $542, R12 + B runtime·callbackasm1(SB) + MOVD $543, R12 + B runtime·callbackasm1(SB) + MOVD $544, R12 + B runtime·callbackasm1(SB) + MOVD $545, R12 + B runtime·callbackasm1(SB) + MOVD $546, R12 + B runtime·callbackasm1(SB) + MOVD $547, R12 + B runtime·callbackasm1(SB) + MOVD $548, R12 + B runtime·callbackasm1(SB) + MOVD $549, R12 + B runtime·callbackasm1(SB) + MOVD $550, R12 + B runtime·callbackasm1(SB) + MOVD $551, R12 + B runtime·callbackasm1(SB) + MOVD $552, R12 + B runtime·callbackasm1(SB) + MOVD $553, R12 + B runtime·callbackasm1(SB) + MOVD $554, R12 + B runtime·callbackasm1(SB) + MOVD $555, R12 + B runtime·callbackasm1(SB) + MOVD $556, R12 + B runtime·callbackasm1(SB) + MOVD $557, R12 + B runtime·callbackasm1(SB) + MOVD $558, R12 + B runtime·callbackasm1(SB) + MOVD $559, R12 + B runtime·callbackasm1(SB) + MOVD $560, R12 + B runtime·callbackasm1(SB) + MOVD $561, R12 + B runtime·callbackasm1(SB) + MOVD $562, R12 + B runtime·callbackasm1(SB) + MOVD $563, R12 + B runtime·callbackasm1(SB) + MOVD $564, R12 + B runtime·callbackasm1(SB) + MOVD $565, R12 + B runtime·callbackasm1(SB) + MOVD $566, R12 + B runtime·callbackasm1(SB) + MOVD $567, R12 + B runtime·callbackasm1(SB) + MOVD $568, R12 + B runtime·callbackasm1(SB) + MOVD $569, R12 + B runtime·callbackasm1(SB) + MOVD $570, R12 + B runtime·callbackasm1(SB) + MOVD $571, R12 + B runtime·callbackasm1(SB) + MOVD $572, R12 + B runtime·callbackasm1(SB) + MOVD $573, R12 + B runtime·callbackasm1(SB) + MOVD $574, R12 + B runtime·callbackasm1(SB) + MOVD $575, R12 + B runtime·callbackasm1(SB) + MOVD $576, R12 + B runtime·callbackasm1(SB) + MOVD $577, R12 + B runtime·callbackasm1(SB) + MOVD $578, R12 + B runtime·callbackasm1(SB) + MOVD $579, R12 + B runtime·callbackasm1(SB) + MOVD $580, R12 + B runtime·callbackasm1(SB) + MOVD $581, R12 + B runtime·callbackasm1(SB) + MOVD $582, R12 + B runtime·callbackasm1(SB) + MOVD $583, R12 + B runtime·callbackasm1(SB) + MOVD $584, R12 + B runtime·callbackasm1(SB) + MOVD $585, R12 + B runtime·callbackasm1(SB) + MOVD $586, R12 + B runtime·callbackasm1(SB) + MOVD $587, R12 + B runtime·callbackasm1(SB) + MOVD $588, R12 + B runtime·callbackasm1(SB) + MOVD $589, R12 + B runtime·callbackasm1(SB) + MOVD $590, R12 + B runtime·callbackasm1(SB) + MOVD $591, R12 + B runtime·callbackasm1(SB) + MOVD $592, R12 + B runtime·callbackasm1(SB) + MOVD $593, R12 + B runtime·callbackasm1(SB) + MOVD $594, R12 + B runtime·callbackasm1(SB) + MOVD $595, R12 + B runtime·callbackasm1(SB) + MOVD $596, R12 + B runtime·callbackasm1(SB) + MOVD $597, R12 + B runtime·callbackasm1(SB) + MOVD $598, R12 + B runtime·callbackasm1(SB) + MOVD $599, R12 + B runtime·callbackasm1(SB) + MOVD $600, R12 + B runtime·callbackasm1(SB) + MOVD $601, R12 + B runtime·callbackasm1(SB) + MOVD $602, R12 + B runtime·callbackasm1(SB) + MOVD $603, R12 + B runtime·callbackasm1(SB) + MOVD $604, R12 + B runtime·callbackasm1(SB) + MOVD $605, R12 + B runtime·callbackasm1(SB) + MOVD $606, R12 + B runtime·callbackasm1(SB) + MOVD $607, R12 + B runtime·callbackasm1(SB) + MOVD $608, R12 + B runtime·callbackasm1(SB) + MOVD $609, R12 + B runtime·callbackasm1(SB) + MOVD $610, R12 + B runtime·callbackasm1(SB) + MOVD $611, R12 + B runtime·callbackasm1(SB) + MOVD $612, R12 + B runtime·callbackasm1(SB) + MOVD $613, R12 + B runtime·callbackasm1(SB) + MOVD $614, R12 + B runtime·callbackasm1(SB) + MOVD $615, R12 + B runtime·callbackasm1(SB) + MOVD $616, R12 + B runtime·callbackasm1(SB) + MOVD $617, R12 + B runtime·callbackasm1(SB) + MOVD $618, R12 + B runtime·callbackasm1(SB) + MOVD $619, R12 + B runtime·callbackasm1(SB) + MOVD $620, R12 + B runtime·callbackasm1(SB) + MOVD $621, R12 + B runtime·callbackasm1(SB) + MOVD $622, R12 + B runtime·callbackasm1(SB) + MOVD $623, R12 + B runtime·callbackasm1(SB) + MOVD $624, R12 + B runtime·callbackasm1(SB) + MOVD $625, R12 + B runtime·callbackasm1(SB) + MOVD $626, R12 + B runtime·callbackasm1(SB) + MOVD $627, R12 + B runtime·callbackasm1(SB) + MOVD $628, R12 + B runtime·callbackasm1(SB) + MOVD $629, R12 + B runtime·callbackasm1(SB) + MOVD $630, R12 + B runtime·callbackasm1(SB) + MOVD $631, R12 + B runtime·callbackasm1(SB) + MOVD $632, R12 + B runtime·callbackasm1(SB) + MOVD $633, R12 + B runtime·callbackasm1(SB) + MOVD $634, R12 + B runtime·callbackasm1(SB) + MOVD $635, R12 + B runtime·callbackasm1(SB) + MOVD $636, R12 + B runtime·callbackasm1(SB) + MOVD $637, R12 + B runtime·callbackasm1(SB) + MOVD $638, R12 + B runtime·callbackasm1(SB) + MOVD $639, R12 + B runtime·callbackasm1(SB) + MOVD $640, R12 + B runtime·callbackasm1(SB) + MOVD $641, R12 + B runtime·callbackasm1(SB) + MOVD $642, R12 + B runtime·callbackasm1(SB) + MOVD $643, R12 + B runtime·callbackasm1(SB) + MOVD $644, R12 + B runtime·callbackasm1(SB) + MOVD $645, R12 + B runtime·callbackasm1(SB) + MOVD $646, R12 + B runtime·callbackasm1(SB) + MOVD $647, R12 + B runtime·callbackasm1(SB) + MOVD $648, R12 + B runtime·callbackasm1(SB) + MOVD $649, R12 + B runtime·callbackasm1(SB) + MOVD $650, R12 + B runtime·callbackasm1(SB) + MOVD $651, R12 + B runtime·callbackasm1(SB) + MOVD $652, R12 + B runtime·callbackasm1(SB) + MOVD $653, R12 + B runtime·callbackasm1(SB) + MOVD $654, R12 + B runtime·callbackasm1(SB) + MOVD $655, R12 + B runtime·callbackasm1(SB) + MOVD $656, R12 + B runtime·callbackasm1(SB) + MOVD $657, R12 + B runtime·callbackasm1(SB) + MOVD $658, R12 + B runtime·callbackasm1(SB) + MOVD $659, R12 + B runtime·callbackasm1(SB) + MOVD $660, R12 + B runtime·callbackasm1(SB) + MOVD $661, R12 + B runtime·callbackasm1(SB) + MOVD $662, R12 + B runtime·callbackasm1(SB) + MOVD $663, R12 + B runtime·callbackasm1(SB) + MOVD $664, R12 + B runtime·callbackasm1(SB) + MOVD $665, R12 + B runtime·callbackasm1(SB) + MOVD $666, R12 + B runtime·callbackasm1(SB) + MOVD $667, R12 + B runtime·callbackasm1(SB) + MOVD $668, R12 + B runtime·callbackasm1(SB) + MOVD $669, R12 + B runtime·callbackasm1(SB) + MOVD $670, R12 + B runtime·callbackasm1(SB) + MOVD $671, R12 + B runtime·callbackasm1(SB) + MOVD $672, R12 + B runtime·callbackasm1(SB) + MOVD $673, R12 + B runtime·callbackasm1(SB) + MOVD $674, R12 + B runtime·callbackasm1(SB) + MOVD $675, R12 + B runtime·callbackasm1(SB) + MOVD $676, R12 + B runtime·callbackasm1(SB) + MOVD $677, R12 + B runtime·callbackasm1(SB) + MOVD $678, R12 + B runtime·callbackasm1(SB) + MOVD $679, R12 + B runtime·callbackasm1(SB) + MOVD $680, R12 + B runtime·callbackasm1(SB) + MOVD $681, R12 + B runtime·callbackasm1(SB) + MOVD $682, R12 + B runtime·callbackasm1(SB) + MOVD $683, R12 + B runtime·callbackasm1(SB) + MOVD $684, R12 + B runtime·callbackasm1(SB) + MOVD $685, R12 + B runtime·callbackasm1(SB) + MOVD $686, R12 + B runtime·callbackasm1(SB) + MOVD $687, R12 + B runtime·callbackasm1(SB) + MOVD $688, R12 + B runtime·callbackasm1(SB) + MOVD $689, R12 + B runtime·callbackasm1(SB) + MOVD $690, R12 + B runtime·callbackasm1(SB) + MOVD $691, R12 + B runtime·callbackasm1(SB) + MOVD $692, R12 + B runtime·callbackasm1(SB) + MOVD $693, R12 + B runtime·callbackasm1(SB) + MOVD $694, R12 + B runtime·callbackasm1(SB) + MOVD $695, R12 + B runtime·callbackasm1(SB) + MOVD $696, R12 + B runtime·callbackasm1(SB) + MOVD $697, R12 + B runtime·callbackasm1(SB) + MOVD $698, R12 + B runtime·callbackasm1(SB) + MOVD $699, R12 + B runtime·callbackasm1(SB) + MOVD $700, R12 + B runtime·callbackasm1(SB) + MOVD $701, R12 + B runtime·callbackasm1(SB) + MOVD $702, R12 + B runtime·callbackasm1(SB) + MOVD $703, R12 + B runtime·callbackasm1(SB) + MOVD $704, R12 + B runtime·callbackasm1(SB) + MOVD $705, R12 + B runtime·callbackasm1(SB) + MOVD $706, R12 + B runtime·callbackasm1(SB) + MOVD $707, R12 + B runtime·callbackasm1(SB) + MOVD $708, R12 + B runtime·callbackasm1(SB) + MOVD $709, R12 + B runtime·callbackasm1(SB) + MOVD $710, R12 + B runtime·callbackasm1(SB) + MOVD $711, R12 + B runtime·callbackasm1(SB) + MOVD $712, R12 + B runtime·callbackasm1(SB) + MOVD $713, R12 + B runtime·callbackasm1(SB) + MOVD $714, R12 + B runtime·callbackasm1(SB) + MOVD $715, R12 + B runtime·callbackasm1(SB) + MOVD $716, R12 + B runtime·callbackasm1(SB) + MOVD $717, R12 + B runtime·callbackasm1(SB) + MOVD $718, R12 + B runtime·callbackasm1(SB) + MOVD $719, R12 + B runtime·callbackasm1(SB) + MOVD $720, R12 + B runtime·callbackasm1(SB) + MOVD $721, R12 + B runtime·callbackasm1(SB) + MOVD $722, R12 + B runtime·callbackasm1(SB) + MOVD $723, R12 + B runtime·callbackasm1(SB) + MOVD $724, R12 + B runtime·callbackasm1(SB) + MOVD $725, R12 + B runtime·callbackasm1(SB) + MOVD $726, R12 + B runtime·callbackasm1(SB) + MOVD $727, R12 + B runtime·callbackasm1(SB) + MOVD $728, R12 + B runtime·callbackasm1(SB) + MOVD $729, R12 + B runtime·callbackasm1(SB) + MOVD $730, R12 + B runtime·callbackasm1(SB) + MOVD $731, R12 + B runtime·callbackasm1(SB) + MOVD $732, R12 + B runtime·callbackasm1(SB) + MOVD $733, R12 + B runtime·callbackasm1(SB) + MOVD $734, R12 + B runtime·callbackasm1(SB) + MOVD $735, R12 + B runtime·callbackasm1(SB) + MOVD $736, R12 + B runtime·callbackasm1(SB) + MOVD $737, R12 + B runtime·callbackasm1(SB) + MOVD $738, R12 + B runtime·callbackasm1(SB) + MOVD $739, R12 + B runtime·callbackasm1(SB) + MOVD $740, R12 + B runtime·callbackasm1(SB) + MOVD $741, R12 + B runtime·callbackasm1(SB) + MOVD $742, R12 + B runtime·callbackasm1(SB) + MOVD $743, R12 + B runtime·callbackasm1(SB) + MOVD $744, R12 + B runtime·callbackasm1(SB) + MOVD $745, R12 + B runtime·callbackasm1(SB) + MOVD $746, R12 + B runtime·callbackasm1(SB) + MOVD $747, R12 + B runtime·callbackasm1(SB) + MOVD $748, R12 + B runtime·callbackasm1(SB) + MOVD $749, R12 + B runtime·callbackasm1(SB) + MOVD $750, R12 + B runtime·callbackasm1(SB) + MOVD $751, R12 + B runtime·callbackasm1(SB) + MOVD $752, R12 + B runtime·callbackasm1(SB) + MOVD $753, R12 + B runtime·callbackasm1(SB) + MOVD $754, R12 + B runtime·callbackasm1(SB) + MOVD $755, R12 + B runtime·callbackasm1(SB) + MOVD $756, R12 + B runtime·callbackasm1(SB) + MOVD $757, R12 + B runtime·callbackasm1(SB) + MOVD $758, R12 + B runtime·callbackasm1(SB) + MOVD $759, R12 + B runtime·callbackasm1(SB) + MOVD $760, R12 + B runtime·callbackasm1(SB) + MOVD $761, R12 + B runtime·callbackasm1(SB) + MOVD $762, R12 + B runtime·callbackasm1(SB) + MOVD $763, R12 + B runtime·callbackasm1(SB) + MOVD $764, R12 + B runtime·callbackasm1(SB) + MOVD $765, R12 + B runtime·callbackasm1(SB) + MOVD $766, R12 + B runtime·callbackasm1(SB) + MOVD $767, R12 + B runtime·callbackasm1(SB) + MOVD $768, R12 + B runtime·callbackasm1(SB) + MOVD $769, R12 + B runtime·callbackasm1(SB) + MOVD $770, R12 + B runtime·callbackasm1(SB) + MOVD $771, R12 + B runtime·callbackasm1(SB) + MOVD $772, R12 + B runtime·callbackasm1(SB) + MOVD $773, R12 + B runtime·callbackasm1(SB) + MOVD $774, R12 + B runtime·callbackasm1(SB) + MOVD $775, R12 + B runtime·callbackasm1(SB) + MOVD $776, R12 + B runtime·callbackasm1(SB) + MOVD $777, R12 + B runtime·callbackasm1(SB) + MOVD $778, R12 + B runtime·callbackasm1(SB) + MOVD $779, R12 + B runtime·callbackasm1(SB) + MOVD $780, R12 + B runtime·callbackasm1(SB) + MOVD $781, R12 + B runtime·callbackasm1(SB) + MOVD $782, R12 + B runtime·callbackasm1(SB) + MOVD $783, R12 + B runtime·callbackasm1(SB) + MOVD $784, R12 + B runtime·callbackasm1(SB) + MOVD $785, R12 + B runtime·callbackasm1(SB) + MOVD $786, R12 + B runtime·callbackasm1(SB) + MOVD $787, R12 + B runtime·callbackasm1(SB) + MOVD $788, R12 + B runtime·callbackasm1(SB) + MOVD $789, R12 + B runtime·callbackasm1(SB) + MOVD $790, R12 + B runtime·callbackasm1(SB) + MOVD $791, R12 + B runtime·callbackasm1(SB) + MOVD $792, R12 + B runtime·callbackasm1(SB) + MOVD $793, R12 + B runtime·callbackasm1(SB) + MOVD $794, R12 + B runtime·callbackasm1(SB) + MOVD $795, R12 + B runtime·callbackasm1(SB) + MOVD $796, R12 + B runtime·callbackasm1(SB) + MOVD $797, R12 + B runtime·callbackasm1(SB) + MOVD $798, R12 + B runtime·callbackasm1(SB) + MOVD $799, R12 + B runtime·callbackasm1(SB) + MOVD $800, R12 + B runtime·callbackasm1(SB) + MOVD $801, R12 + B runtime·callbackasm1(SB) + MOVD $802, R12 + B runtime·callbackasm1(SB) + MOVD $803, R12 + B runtime·callbackasm1(SB) + MOVD $804, R12 + B runtime·callbackasm1(SB) + MOVD $805, R12 + B runtime·callbackasm1(SB) + MOVD $806, R12 + B runtime·callbackasm1(SB) + MOVD $807, R12 + B runtime·callbackasm1(SB) + MOVD $808, R12 + B runtime·callbackasm1(SB) + MOVD $809, R12 + B runtime·callbackasm1(SB) + MOVD $810, R12 + B runtime·callbackasm1(SB) + MOVD $811, R12 + B runtime·callbackasm1(SB) + MOVD $812, R12 + B runtime·callbackasm1(SB) + MOVD $813, R12 + B runtime·callbackasm1(SB) + MOVD $814, R12 + B runtime·callbackasm1(SB) + MOVD $815, R12 + B runtime·callbackasm1(SB) + MOVD $816, R12 + B runtime·callbackasm1(SB) + MOVD $817, R12 + B runtime·callbackasm1(SB) + MOVD $818, R12 + B runtime·callbackasm1(SB) + MOVD $819, R12 + B runtime·callbackasm1(SB) + MOVD $820, R12 + B runtime·callbackasm1(SB) + MOVD $821, R12 + B runtime·callbackasm1(SB) + MOVD $822, R12 + B runtime·callbackasm1(SB) + MOVD $823, R12 + B runtime·callbackasm1(SB) + MOVD $824, R12 + B runtime·callbackasm1(SB) + MOVD $825, R12 + B runtime·callbackasm1(SB) + MOVD $826, R12 + B runtime·callbackasm1(SB) + MOVD $827, R12 + B runtime·callbackasm1(SB) + MOVD $828, R12 + B runtime·callbackasm1(SB) + MOVD $829, R12 + B runtime·callbackasm1(SB) + MOVD $830, R12 + B runtime·callbackasm1(SB) + MOVD $831, R12 + B runtime·callbackasm1(SB) + MOVD $832, R12 + B runtime·callbackasm1(SB) + MOVD $833, R12 + B runtime·callbackasm1(SB) + MOVD $834, R12 + B runtime·callbackasm1(SB) + MOVD $835, R12 + B runtime·callbackasm1(SB) + MOVD $836, R12 + B runtime·callbackasm1(SB) + MOVD $837, R12 + B runtime·callbackasm1(SB) + MOVD $838, R12 + B runtime·callbackasm1(SB) + MOVD $839, R12 + B runtime·callbackasm1(SB) + MOVD $840, R12 + B runtime·callbackasm1(SB) + MOVD $841, R12 + B runtime·callbackasm1(SB) + MOVD $842, R12 + B runtime·callbackasm1(SB) + MOVD $843, R12 + B runtime·callbackasm1(SB) + MOVD $844, R12 + B runtime·callbackasm1(SB) + MOVD $845, R12 + B runtime·callbackasm1(SB) + MOVD $846, R12 + B runtime·callbackasm1(SB) + MOVD $847, R12 + B runtime·callbackasm1(SB) + MOVD $848, R12 + B runtime·callbackasm1(SB) + MOVD $849, R12 + B runtime·callbackasm1(SB) + MOVD $850, R12 + B runtime·callbackasm1(SB) + MOVD $851, R12 + B runtime·callbackasm1(SB) + MOVD $852, R12 + B runtime·callbackasm1(SB) + MOVD $853, R12 + B runtime·callbackasm1(SB) + MOVD $854, R12 + B runtime·callbackasm1(SB) + MOVD $855, R12 + B runtime·callbackasm1(SB) + MOVD $856, R12 + B runtime·callbackasm1(SB) + MOVD $857, R12 + B runtime·callbackasm1(SB) + MOVD $858, R12 + B runtime·callbackasm1(SB) + MOVD $859, R12 + B runtime·callbackasm1(SB) + MOVD $860, R12 + B runtime·callbackasm1(SB) + MOVD $861, R12 + B runtime·callbackasm1(SB) + MOVD $862, R12 + B runtime·callbackasm1(SB) + MOVD $863, R12 + B runtime·callbackasm1(SB) + MOVD $864, R12 + B runtime·callbackasm1(SB) + MOVD $865, R12 + B runtime·callbackasm1(SB) + MOVD $866, R12 + B runtime·callbackasm1(SB) + MOVD $867, R12 + B runtime·callbackasm1(SB) + MOVD $868, R12 + B runtime·callbackasm1(SB) + MOVD $869, R12 + B runtime·callbackasm1(SB) + MOVD $870, R12 + B runtime·callbackasm1(SB) + MOVD $871, R12 + B runtime·callbackasm1(SB) + MOVD $872, R12 + B runtime·callbackasm1(SB) + MOVD $873, R12 + B runtime·callbackasm1(SB) + MOVD $874, R12 + B runtime·callbackasm1(SB) + MOVD $875, R12 + B runtime·callbackasm1(SB) + MOVD $876, R12 + B runtime·callbackasm1(SB) + MOVD $877, R12 + B runtime·callbackasm1(SB) + MOVD $878, R12 + B runtime·callbackasm1(SB) + MOVD $879, R12 + B runtime·callbackasm1(SB) + MOVD $880, R12 + B runtime·callbackasm1(SB) + MOVD $881, R12 + B runtime·callbackasm1(SB) + MOVD $882, R12 + B runtime·callbackasm1(SB) + MOVD $883, R12 + B runtime·callbackasm1(SB) + MOVD $884, R12 + B runtime·callbackasm1(SB) + MOVD $885, R12 + B runtime·callbackasm1(SB) + MOVD $886, R12 + B runtime·callbackasm1(SB) + MOVD $887, R12 + B runtime·callbackasm1(SB) + MOVD $888, R12 + B runtime·callbackasm1(SB) + MOVD $889, R12 + B runtime·callbackasm1(SB) + MOVD $890, R12 + B runtime·callbackasm1(SB) + MOVD $891, R12 + B runtime·callbackasm1(SB) + MOVD $892, R12 + B runtime·callbackasm1(SB) + MOVD $893, R12 + B runtime·callbackasm1(SB) + MOVD $894, R12 + B runtime·callbackasm1(SB) + MOVD $895, R12 + B runtime·callbackasm1(SB) + MOVD $896, R12 + B runtime·callbackasm1(SB) + MOVD $897, R12 + B runtime·callbackasm1(SB) + MOVD $898, R12 + B runtime·callbackasm1(SB) + MOVD $899, R12 + B runtime·callbackasm1(SB) + MOVD $900, R12 + B runtime·callbackasm1(SB) + MOVD $901, R12 + B runtime·callbackasm1(SB) + MOVD $902, R12 + B runtime·callbackasm1(SB) + MOVD $903, R12 + B runtime·callbackasm1(SB) + MOVD $904, R12 + B runtime·callbackasm1(SB) + MOVD $905, R12 + B runtime·callbackasm1(SB) + MOVD $906, R12 + B runtime·callbackasm1(SB) + MOVD $907, R12 + B runtime·callbackasm1(SB) + MOVD $908, R12 + B runtime·callbackasm1(SB) + MOVD $909, R12 + B runtime·callbackasm1(SB) + MOVD $910, R12 + B runtime·callbackasm1(SB) + MOVD $911, R12 + B runtime·callbackasm1(SB) + MOVD $912, R12 + B runtime·callbackasm1(SB) + MOVD $913, R12 + B runtime·callbackasm1(SB) + MOVD $914, R12 + B runtime·callbackasm1(SB) + MOVD $915, R12 + B runtime·callbackasm1(SB) + MOVD $916, R12 + B runtime·callbackasm1(SB) + MOVD $917, R12 + B runtime·callbackasm1(SB) + MOVD $918, R12 + B runtime·callbackasm1(SB) + MOVD $919, R12 + B runtime·callbackasm1(SB) + MOVD $920, R12 + B runtime·callbackasm1(SB) + MOVD $921, R12 + B runtime·callbackasm1(SB) + MOVD $922, R12 + B runtime·callbackasm1(SB) + MOVD $923, R12 + B runtime·callbackasm1(SB) + MOVD $924, R12 + B runtime·callbackasm1(SB) + MOVD $925, R12 + B runtime·callbackasm1(SB) + MOVD $926, R12 + B runtime·callbackasm1(SB) + MOVD $927, R12 + B runtime·callbackasm1(SB) + MOVD $928, R12 + B runtime·callbackasm1(SB) + MOVD $929, R12 + B runtime·callbackasm1(SB) + MOVD $930, R12 + B runtime·callbackasm1(SB) + MOVD $931, R12 + B runtime·callbackasm1(SB) + MOVD $932, R12 + B runtime·callbackasm1(SB) + MOVD $933, R12 + B runtime·callbackasm1(SB) + MOVD $934, R12 + B runtime·callbackasm1(SB) + MOVD $935, R12 + B runtime·callbackasm1(SB) + MOVD $936, R12 + B runtime·callbackasm1(SB) + MOVD $937, R12 + B runtime·callbackasm1(SB) + MOVD $938, R12 + B runtime·callbackasm1(SB) + MOVD $939, R12 + B runtime·callbackasm1(SB) + MOVD $940, R12 + B runtime·callbackasm1(SB) + MOVD $941, R12 + B runtime·callbackasm1(SB) + MOVD $942, R12 + B runtime·callbackasm1(SB) + MOVD $943, R12 + B runtime·callbackasm1(SB) + MOVD $944, R12 + B runtime·callbackasm1(SB) + MOVD $945, R12 + B runtime·callbackasm1(SB) + MOVD $946, R12 + B runtime·callbackasm1(SB) + MOVD $947, R12 + B runtime·callbackasm1(SB) + MOVD $948, R12 + B runtime·callbackasm1(SB) + MOVD $949, R12 + B runtime·callbackasm1(SB) + MOVD $950, R12 + B runtime·callbackasm1(SB) + MOVD $951, R12 + B runtime·callbackasm1(SB) + MOVD $952, R12 + B runtime·callbackasm1(SB) + MOVD $953, R12 + B runtime·callbackasm1(SB) + MOVD $954, R12 + B runtime·callbackasm1(SB) + MOVD $955, R12 + B runtime·callbackasm1(SB) + MOVD $956, R12 + B runtime·callbackasm1(SB) + MOVD $957, R12 + B runtime·callbackasm1(SB) + MOVD $958, R12 + B runtime·callbackasm1(SB) + MOVD $959, R12 + B runtime·callbackasm1(SB) + MOVD $960, R12 + B runtime·callbackasm1(SB) + MOVD $961, R12 + B runtime·callbackasm1(SB) + MOVD $962, R12 + B runtime·callbackasm1(SB) + MOVD $963, R12 + B runtime·callbackasm1(SB) + MOVD $964, R12 + B runtime·callbackasm1(SB) + MOVD $965, R12 + B runtime·callbackasm1(SB) + MOVD $966, R12 + B runtime·callbackasm1(SB) + MOVD $967, R12 + B runtime·callbackasm1(SB) + MOVD $968, R12 + B runtime·callbackasm1(SB) + MOVD $969, R12 + B runtime·callbackasm1(SB) + MOVD $970, R12 + B runtime·callbackasm1(SB) + MOVD $971, R12 + B runtime·callbackasm1(SB) + MOVD $972, R12 + B runtime·callbackasm1(SB) + MOVD $973, R12 + B runtime·callbackasm1(SB) + MOVD $974, R12 + B runtime·callbackasm1(SB) + MOVD $975, R12 + B runtime·callbackasm1(SB) + MOVD $976, R12 + B runtime·callbackasm1(SB) + MOVD $977, R12 + B runtime·callbackasm1(SB) + MOVD $978, R12 + B runtime·callbackasm1(SB) + MOVD $979, R12 + B runtime·callbackasm1(SB) + MOVD $980, R12 + B runtime·callbackasm1(SB) + MOVD $981, R12 + B runtime·callbackasm1(SB) + MOVD $982, R12 + B runtime·callbackasm1(SB) + MOVD $983, R12 + B runtime·callbackasm1(SB) + MOVD $984, R12 + B runtime·callbackasm1(SB) + MOVD $985, R12 + B runtime·callbackasm1(SB) + MOVD $986, R12 + B runtime·callbackasm1(SB) + MOVD $987, R12 + B runtime·callbackasm1(SB) + MOVD $988, R12 + B runtime·callbackasm1(SB) + MOVD $989, R12 + B runtime·callbackasm1(SB) + MOVD $990, R12 + B runtime·callbackasm1(SB) + MOVD $991, R12 + B runtime·callbackasm1(SB) + MOVD $992, R12 + B runtime·callbackasm1(SB) + MOVD $993, R12 + B runtime·callbackasm1(SB) + MOVD $994, R12 + B runtime·callbackasm1(SB) + MOVD $995, R12 + B runtime·callbackasm1(SB) + MOVD $996, R12 + B runtime·callbackasm1(SB) + MOVD $997, R12 + B runtime·callbackasm1(SB) + MOVD $998, R12 + B runtime·callbackasm1(SB) + MOVD $999, R12 + B runtime·callbackasm1(SB) + MOVD $1000, R12 + B runtime·callbackasm1(SB) + MOVD $1001, R12 + B runtime·callbackasm1(SB) + MOVD $1002, R12 + B runtime·callbackasm1(SB) + MOVD $1003, R12 + B runtime·callbackasm1(SB) + MOVD $1004, R12 + B runtime·callbackasm1(SB) + MOVD $1005, R12 + B runtime·callbackasm1(SB) + MOVD $1006, R12 + B runtime·callbackasm1(SB) + MOVD $1007, R12 + B runtime·callbackasm1(SB) + MOVD $1008, R12 + B runtime·callbackasm1(SB) + MOVD $1009, R12 + B runtime·callbackasm1(SB) + MOVD $1010, R12 + B runtime·callbackasm1(SB) + MOVD $1011, R12 + B runtime·callbackasm1(SB) + MOVD $1012, R12 + B runtime·callbackasm1(SB) + MOVD $1013, R12 + B runtime·callbackasm1(SB) + MOVD $1014, R12 + B runtime·callbackasm1(SB) + MOVD $1015, R12 + B runtime·callbackasm1(SB) + MOVD $1016, R12 + B runtime·callbackasm1(SB) + MOVD $1017, R12 + B runtime·callbackasm1(SB) + MOVD $1018, R12 + B runtime·callbackasm1(SB) + MOVD $1019, R12 + B runtime·callbackasm1(SB) + MOVD $1020, R12 + B runtime·callbackasm1(SB) + MOVD $1021, R12 + B runtime·callbackasm1(SB) + MOVD $1022, R12 + B runtime·callbackasm1(SB) + MOVD $1023, R12 + B runtime·callbackasm1(SB) + MOVD $1024, R12 + B runtime·callbackasm1(SB) + MOVD $1025, R12 + B runtime·callbackasm1(SB) + MOVD $1026, R12 + B runtime·callbackasm1(SB) + MOVD $1027, R12 + B runtime·callbackasm1(SB) + MOVD $1028, R12 + B runtime·callbackasm1(SB) + MOVD $1029, R12 + B runtime·callbackasm1(SB) + MOVD $1030, R12 + B runtime·callbackasm1(SB) + MOVD $1031, R12 + B runtime·callbackasm1(SB) + MOVD $1032, R12 + B runtime·callbackasm1(SB) + MOVD $1033, R12 + B runtime·callbackasm1(SB) + MOVD $1034, R12 + B runtime·callbackasm1(SB) + MOVD $1035, R12 + B runtime·callbackasm1(SB) + MOVD $1036, R12 + B runtime·callbackasm1(SB) + MOVD $1037, R12 + B runtime·callbackasm1(SB) + MOVD $1038, R12 + B runtime·callbackasm1(SB) + MOVD $1039, R12 + B runtime·callbackasm1(SB) + MOVD $1040, R12 + B runtime·callbackasm1(SB) + MOVD $1041, R12 + B runtime·callbackasm1(SB) + MOVD $1042, R12 + B runtime·callbackasm1(SB) + MOVD $1043, R12 + B runtime·callbackasm1(SB) + MOVD $1044, R12 + B runtime·callbackasm1(SB) + MOVD $1045, R12 + B runtime·callbackasm1(SB) + MOVD $1046, R12 + B runtime·callbackasm1(SB) + MOVD $1047, R12 + B runtime·callbackasm1(SB) + MOVD $1048, R12 + B runtime·callbackasm1(SB) + MOVD $1049, R12 + B runtime·callbackasm1(SB) + MOVD $1050, R12 + B runtime·callbackasm1(SB) + MOVD $1051, R12 + B runtime·callbackasm1(SB) + MOVD $1052, R12 + B runtime·callbackasm1(SB) + MOVD $1053, R12 + B runtime·callbackasm1(SB) + MOVD $1054, R12 + B runtime·callbackasm1(SB) + MOVD $1055, R12 + B runtime·callbackasm1(SB) + MOVD $1056, R12 + B runtime·callbackasm1(SB) + MOVD $1057, R12 + B runtime·callbackasm1(SB) + MOVD $1058, R12 + B runtime·callbackasm1(SB) + MOVD $1059, R12 + B runtime·callbackasm1(SB) + MOVD $1060, R12 + B runtime·callbackasm1(SB) + MOVD $1061, R12 + B runtime·callbackasm1(SB) + MOVD $1062, R12 + B runtime·callbackasm1(SB) + MOVD $1063, R12 + B runtime·callbackasm1(SB) + MOVD $1064, R12 + B runtime·callbackasm1(SB) + MOVD $1065, R12 + B runtime·callbackasm1(SB) + MOVD $1066, R12 + B runtime·callbackasm1(SB) + MOVD $1067, R12 + B runtime·callbackasm1(SB) + MOVD $1068, R12 + B runtime·callbackasm1(SB) + MOVD $1069, R12 + B runtime·callbackasm1(SB) + MOVD $1070, R12 + B runtime·callbackasm1(SB) + MOVD $1071, R12 + B runtime·callbackasm1(SB) + MOVD $1072, R12 + B runtime·callbackasm1(SB) + MOVD $1073, R12 + B runtime·callbackasm1(SB) + MOVD $1074, R12 + B runtime·callbackasm1(SB) + MOVD $1075, R12 + B runtime·callbackasm1(SB) + MOVD $1076, R12 + B runtime·callbackasm1(SB) + MOVD $1077, R12 + B runtime·callbackasm1(SB) + MOVD $1078, R12 + B runtime·callbackasm1(SB) + MOVD $1079, R12 + B runtime·callbackasm1(SB) + MOVD $1080, R12 + B runtime·callbackasm1(SB) + MOVD $1081, R12 + B runtime·callbackasm1(SB) + MOVD $1082, R12 + B runtime·callbackasm1(SB) + MOVD $1083, R12 + B runtime·callbackasm1(SB) + MOVD $1084, R12 + B runtime·callbackasm1(SB) + MOVD $1085, R12 + B runtime·callbackasm1(SB) + MOVD $1086, R12 + B runtime·callbackasm1(SB) + MOVD $1087, R12 + B runtime·callbackasm1(SB) + MOVD $1088, R12 + B runtime·callbackasm1(SB) + MOVD $1089, R12 + B runtime·callbackasm1(SB) + MOVD $1090, R12 + B runtime·callbackasm1(SB) + MOVD $1091, R12 + B runtime·callbackasm1(SB) + MOVD $1092, R12 + B runtime·callbackasm1(SB) + MOVD $1093, R12 + B runtime·callbackasm1(SB) + MOVD $1094, R12 + B runtime·callbackasm1(SB) + MOVD $1095, R12 + B runtime·callbackasm1(SB) + MOVD $1096, R12 + B runtime·callbackasm1(SB) + MOVD $1097, R12 + B runtime·callbackasm1(SB) + MOVD $1098, R12 + B runtime·callbackasm1(SB) + MOVD $1099, R12 + B runtime·callbackasm1(SB) + MOVD $1100, R12 + B runtime·callbackasm1(SB) + MOVD $1101, R12 + B runtime·callbackasm1(SB) + MOVD $1102, R12 + B runtime·callbackasm1(SB) + MOVD $1103, R12 + B runtime·callbackasm1(SB) + MOVD $1104, R12 + B runtime·callbackasm1(SB) + MOVD $1105, R12 + B runtime·callbackasm1(SB) + MOVD $1106, R12 + B runtime·callbackasm1(SB) + MOVD $1107, R12 + B runtime·callbackasm1(SB) + MOVD $1108, R12 + B runtime·callbackasm1(SB) + MOVD $1109, R12 + B runtime·callbackasm1(SB) + MOVD $1110, R12 + B runtime·callbackasm1(SB) + MOVD $1111, R12 + B runtime·callbackasm1(SB) + MOVD $1112, R12 + B runtime·callbackasm1(SB) + MOVD $1113, R12 + B runtime·callbackasm1(SB) + MOVD $1114, R12 + B runtime·callbackasm1(SB) + MOVD $1115, R12 + B runtime·callbackasm1(SB) + MOVD $1116, R12 + B runtime·callbackasm1(SB) + MOVD $1117, R12 + B runtime·callbackasm1(SB) + MOVD $1118, R12 + B runtime·callbackasm1(SB) + MOVD $1119, R12 + B runtime·callbackasm1(SB) + MOVD $1120, R12 + B runtime·callbackasm1(SB) + MOVD $1121, R12 + B runtime·callbackasm1(SB) + MOVD $1122, R12 + B runtime·callbackasm1(SB) + MOVD $1123, R12 + B runtime·callbackasm1(SB) + MOVD $1124, R12 + B runtime·callbackasm1(SB) + MOVD $1125, R12 + B runtime·callbackasm1(SB) + MOVD $1126, R12 + B runtime·callbackasm1(SB) + MOVD $1127, R12 + B runtime·callbackasm1(SB) + MOVD $1128, R12 + B runtime·callbackasm1(SB) + MOVD $1129, R12 + B runtime·callbackasm1(SB) + MOVD $1130, R12 + B runtime·callbackasm1(SB) + MOVD $1131, R12 + B runtime·callbackasm1(SB) + MOVD $1132, R12 + B runtime·callbackasm1(SB) + MOVD $1133, R12 + B runtime·callbackasm1(SB) + MOVD $1134, R12 + B runtime·callbackasm1(SB) + MOVD $1135, R12 + B runtime·callbackasm1(SB) + MOVD $1136, R12 + B runtime·callbackasm1(SB) + MOVD $1137, R12 + B runtime·callbackasm1(SB) + MOVD $1138, R12 + B runtime·callbackasm1(SB) + MOVD $1139, R12 + B runtime·callbackasm1(SB) + MOVD $1140, R12 + B runtime·callbackasm1(SB) + MOVD $1141, R12 + B runtime·callbackasm1(SB) + MOVD $1142, R12 + B runtime·callbackasm1(SB) + MOVD $1143, R12 + B runtime·callbackasm1(SB) + MOVD $1144, R12 + B runtime·callbackasm1(SB) + MOVD $1145, R12 + B runtime·callbackasm1(SB) + MOVD $1146, R12 + B runtime·callbackasm1(SB) + MOVD $1147, R12 + B runtime·callbackasm1(SB) + MOVD $1148, R12 + B runtime·callbackasm1(SB) + MOVD $1149, R12 + B runtime·callbackasm1(SB) + MOVD $1150, R12 + B runtime·callbackasm1(SB) + MOVD $1151, R12 + B runtime·callbackasm1(SB) + MOVD $1152, R12 + B runtime·callbackasm1(SB) + MOVD $1153, R12 + B runtime·callbackasm1(SB) + MOVD $1154, R12 + B runtime·callbackasm1(SB) + MOVD $1155, R12 + B runtime·callbackasm1(SB) + MOVD $1156, R12 + B runtime·callbackasm1(SB) + MOVD $1157, R12 + B runtime·callbackasm1(SB) + MOVD $1158, R12 + B runtime·callbackasm1(SB) + MOVD $1159, R12 + B runtime·callbackasm1(SB) + MOVD $1160, R12 + B runtime·callbackasm1(SB) + MOVD $1161, R12 + B runtime·callbackasm1(SB) + MOVD $1162, R12 + B runtime·callbackasm1(SB) + MOVD $1163, R12 + B runtime·callbackasm1(SB) + MOVD $1164, R12 + B runtime·callbackasm1(SB) + MOVD $1165, R12 + B runtime·callbackasm1(SB) + MOVD $1166, R12 + B runtime·callbackasm1(SB) + MOVD $1167, R12 + B runtime·callbackasm1(SB) + MOVD $1168, R12 + B runtime·callbackasm1(SB) + MOVD $1169, R12 + B runtime·callbackasm1(SB) + MOVD $1170, R12 + B runtime·callbackasm1(SB) + MOVD $1171, R12 + B runtime·callbackasm1(SB) + MOVD $1172, R12 + B runtime·callbackasm1(SB) + MOVD $1173, R12 + B runtime·callbackasm1(SB) + MOVD $1174, R12 + B runtime·callbackasm1(SB) + MOVD $1175, R12 + B runtime·callbackasm1(SB) + MOVD $1176, R12 + B runtime·callbackasm1(SB) + MOVD $1177, R12 + B runtime·callbackasm1(SB) + MOVD $1178, R12 + B runtime·callbackasm1(SB) + MOVD $1179, R12 + B runtime·callbackasm1(SB) + MOVD $1180, R12 + B runtime·callbackasm1(SB) + MOVD $1181, R12 + B runtime·callbackasm1(SB) + MOVD $1182, R12 + B runtime·callbackasm1(SB) + MOVD $1183, R12 + B runtime·callbackasm1(SB) + MOVD $1184, R12 + B runtime·callbackasm1(SB) + MOVD $1185, R12 + B runtime·callbackasm1(SB) + MOVD $1186, R12 + B runtime·callbackasm1(SB) + MOVD $1187, R12 + B runtime·callbackasm1(SB) + MOVD $1188, R12 + B runtime·callbackasm1(SB) + MOVD $1189, R12 + B runtime·callbackasm1(SB) + MOVD $1190, R12 + B runtime·callbackasm1(SB) + MOVD $1191, R12 + B runtime·callbackasm1(SB) + MOVD $1192, R12 + B runtime·callbackasm1(SB) + MOVD $1193, R12 + B runtime·callbackasm1(SB) + MOVD $1194, R12 + B runtime·callbackasm1(SB) + MOVD $1195, R12 + B runtime·callbackasm1(SB) + MOVD $1196, R12 + B runtime·callbackasm1(SB) + MOVD $1197, R12 + B runtime·callbackasm1(SB) + MOVD $1198, R12 + B runtime·callbackasm1(SB) + MOVD $1199, R12 + B runtime·callbackasm1(SB) + MOVD $1200, R12 + B runtime·callbackasm1(SB) + MOVD $1201, R12 + B runtime·callbackasm1(SB) + MOVD $1202, R12 + B runtime·callbackasm1(SB) + MOVD $1203, R12 + B runtime·callbackasm1(SB) + MOVD $1204, R12 + B runtime·callbackasm1(SB) + MOVD $1205, R12 + B runtime·callbackasm1(SB) + MOVD $1206, R12 + B runtime·callbackasm1(SB) + MOVD $1207, R12 + B runtime·callbackasm1(SB) + MOVD $1208, R12 + B runtime·callbackasm1(SB) + MOVD $1209, R12 + B runtime·callbackasm1(SB) + MOVD $1210, R12 + B runtime·callbackasm1(SB) + MOVD $1211, R12 + B runtime·callbackasm1(SB) + MOVD $1212, R12 + B runtime·callbackasm1(SB) + MOVD $1213, R12 + B runtime·callbackasm1(SB) + MOVD $1214, R12 + B runtime·callbackasm1(SB) + MOVD $1215, R12 + B runtime·callbackasm1(SB) + MOVD $1216, R12 + B runtime·callbackasm1(SB) + MOVD $1217, R12 + B runtime·callbackasm1(SB) + MOVD $1218, R12 + B runtime·callbackasm1(SB) + MOVD $1219, R12 + B runtime·callbackasm1(SB) + MOVD $1220, R12 + B runtime·callbackasm1(SB) + MOVD $1221, R12 + B runtime·callbackasm1(SB) + MOVD $1222, R12 + B runtime·callbackasm1(SB) + MOVD $1223, R12 + B runtime·callbackasm1(SB) + MOVD $1224, R12 + B runtime·callbackasm1(SB) + MOVD $1225, R12 + B runtime·callbackasm1(SB) + MOVD $1226, R12 + B runtime·callbackasm1(SB) + MOVD $1227, R12 + B runtime·callbackasm1(SB) + MOVD $1228, R12 + B runtime·callbackasm1(SB) + MOVD $1229, R12 + B runtime·callbackasm1(SB) + MOVD $1230, R12 + B runtime·callbackasm1(SB) + MOVD $1231, R12 + B runtime·callbackasm1(SB) + MOVD $1232, R12 + B runtime·callbackasm1(SB) + MOVD $1233, R12 + B runtime·callbackasm1(SB) + MOVD $1234, R12 + B runtime·callbackasm1(SB) + MOVD $1235, R12 + B runtime·callbackasm1(SB) + MOVD $1236, R12 + B runtime·callbackasm1(SB) + MOVD $1237, R12 + B runtime·callbackasm1(SB) + MOVD $1238, R12 + B runtime·callbackasm1(SB) + MOVD $1239, R12 + B runtime·callbackasm1(SB) + MOVD $1240, R12 + B runtime·callbackasm1(SB) + MOVD $1241, R12 + B runtime·callbackasm1(SB) + MOVD $1242, R12 + B runtime·callbackasm1(SB) + MOVD $1243, R12 + B runtime·callbackasm1(SB) + MOVD $1244, R12 + B runtime·callbackasm1(SB) + MOVD $1245, R12 + B runtime·callbackasm1(SB) + MOVD $1246, R12 + B runtime·callbackasm1(SB) + MOVD $1247, R12 + B runtime·callbackasm1(SB) + MOVD $1248, R12 + B runtime·callbackasm1(SB) + MOVD $1249, R12 + B runtime·callbackasm1(SB) + MOVD $1250, R12 + B runtime·callbackasm1(SB) + MOVD $1251, R12 + B runtime·callbackasm1(SB) + MOVD $1252, R12 + B runtime·callbackasm1(SB) + MOVD $1253, R12 + B runtime·callbackasm1(SB) + MOVD $1254, R12 + B runtime·callbackasm1(SB) + MOVD $1255, R12 + B runtime·callbackasm1(SB) + MOVD $1256, R12 + B runtime·callbackasm1(SB) + MOVD $1257, R12 + B runtime·callbackasm1(SB) + MOVD $1258, R12 + B runtime·callbackasm1(SB) + MOVD $1259, R12 + B runtime·callbackasm1(SB) + MOVD $1260, R12 + B runtime·callbackasm1(SB) + MOVD $1261, R12 + B runtime·callbackasm1(SB) + MOVD $1262, R12 + B runtime·callbackasm1(SB) + MOVD $1263, R12 + B runtime·callbackasm1(SB) + MOVD $1264, R12 + B runtime·callbackasm1(SB) + MOVD $1265, R12 + B runtime·callbackasm1(SB) + MOVD $1266, R12 + B runtime·callbackasm1(SB) + MOVD $1267, R12 + B runtime·callbackasm1(SB) + MOVD $1268, R12 + B runtime·callbackasm1(SB) + MOVD $1269, R12 + B runtime·callbackasm1(SB) + MOVD $1270, R12 + B runtime·callbackasm1(SB) + MOVD $1271, R12 + B runtime·callbackasm1(SB) + MOVD $1272, R12 + B runtime·callbackasm1(SB) + MOVD $1273, R12 + B runtime·callbackasm1(SB) + MOVD $1274, R12 + B runtime·callbackasm1(SB) + MOVD $1275, R12 + B runtime·callbackasm1(SB) + MOVD $1276, R12 + B runtime·callbackasm1(SB) + MOVD $1277, R12 + B runtime·callbackasm1(SB) + MOVD $1278, R12 + B runtime·callbackasm1(SB) + MOVD $1279, R12 + B runtime·callbackasm1(SB) + MOVD $1280, R12 + B runtime·callbackasm1(SB) + MOVD $1281, R12 + B runtime·callbackasm1(SB) + MOVD $1282, R12 + B runtime·callbackasm1(SB) + MOVD $1283, R12 + B runtime·callbackasm1(SB) + MOVD $1284, R12 + B runtime·callbackasm1(SB) + MOVD $1285, R12 + B runtime·callbackasm1(SB) + MOVD $1286, R12 + B runtime·callbackasm1(SB) + MOVD $1287, R12 + B runtime·callbackasm1(SB) + MOVD $1288, R12 + B runtime·callbackasm1(SB) + MOVD $1289, R12 + B runtime·callbackasm1(SB) + MOVD $1290, R12 + B runtime·callbackasm1(SB) + MOVD $1291, R12 + B runtime·callbackasm1(SB) + MOVD $1292, R12 + B runtime·callbackasm1(SB) + MOVD $1293, R12 + B runtime·callbackasm1(SB) + MOVD $1294, R12 + B runtime·callbackasm1(SB) + MOVD $1295, R12 + B runtime·callbackasm1(SB) + MOVD $1296, R12 + B runtime·callbackasm1(SB) + MOVD $1297, R12 + B runtime·callbackasm1(SB) + MOVD $1298, R12 + B runtime·callbackasm1(SB) + MOVD $1299, R12 + B runtime·callbackasm1(SB) + MOVD $1300, R12 + B runtime·callbackasm1(SB) + MOVD $1301, R12 + B runtime·callbackasm1(SB) + MOVD $1302, R12 + B runtime·callbackasm1(SB) + MOVD $1303, R12 + B runtime·callbackasm1(SB) + MOVD $1304, R12 + B runtime·callbackasm1(SB) + MOVD $1305, R12 + B runtime·callbackasm1(SB) + MOVD $1306, R12 + B runtime·callbackasm1(SB) + MOVD $1307, R12 + B runtime·callbackasm1(SB) + MOVD $1308, R12 + B runtime·callbackasm1(SB) + MOVD $1309, R12 + B runtime·callbackasm1(SB) + MOVD $1310, R12 + B runtime·callbackasm1(SB) + MOVD $1311, R12 + B runtime·callbackasm1(SB) + MOVD $1312, R12 + B runtime·callbackasm1(SB) + MOVD $1313, R12 + B runtime·callbackasm1(SB) + MOVD $1314, R12 + B runtime·callbackasm1(SB) + MOVD $1315, R12 + B runtime·callbackasm1(SB) + MOVD $1316, R12 + B runtime·callbackasm1(SB) + MOVD $1317, R12 + B runtime·callbackasm1(SB) + MOVD $1318, R12 + B runtime·callbackasm1(SB) + MOVD $1319, R12 + B runtime·callbackasm1(SB) + MOVD $1320, R12 + B runtime·callbackasm1(SB) + MOVD $1321, R12 + B runtime·callbackasm1(SB) + MOVD $1322, R12 + B runtime·callbackasm1(SB) + MOVD $1323, R12 + B runtime·callbackasm1(SB) + MOVD $1324, R12 + B runtime·callbackasm1(SB) + MOVD $1325, R12 + B runtime·callbackasm1(SB) + MOVD $1326, R12 + B runtime·callbackasm1(SB) + MOVD $1327, R12 + B runtime·callbackasm1(SB) + MOVD $1328, R12 + B runtime·callbackasm1(SB) + MOVD $1329, R12 + B runtime·callbackasm1(SB) + MOVD $1330, R12 + B runtime·callbackasm1(SB) + MOVD $1331, R12 + B runtime·callbackasm1(SB) + MOVD $1332, R12 + B runtime·callbackasm1(SB) + MOVD $1333, R12 + B runtime·callbackasm1(SB) + MOVD $1334, R12 + B runtime·callbackasm1(SB) + MOVD $1335, R12 + B runtime·callbackasm1(SB) + MOVD $1336, R12 + B runtime·callbackasm1(SB) + MOVD $1337, R12 + B runtime·callbackasm1(SB) + MOVD $1338, R12 + B runtime·callbackasm1(SB) + MOVD $1339, R12 + B runtime·callbackasm1(SB) + MOVD $1340, R12 + B runtime·callbackasm1(SB) + MOVD $1341, R12 + B runtime·callbackasm1(SB) + MOVD $1342, R12 + B runtime·callbackasm1(SB) + MOVD $1343, R12 + B runtime·callbackasm1(SB) + MOVD $1344, R12 + B runtime·callbackasm1(SB) + MOVD $1345, R12 + B runtime·callbackasm1(SB) + MOVD $1346, R12 + B runtime·callbackasm1(SB) + MOVD $1347, R12 + B runtime·callbackasm1(SB) + MOVD $1348, R12 + B runtime·callbackasm1(SB) + MOVD $1349, R12 + B runtime·callbackasm1(SB) + MOVD $1350, R12 + B runtime·callbackasm1(SB) + MOVD $1351, R12 + B runtime·callbackasm1(SB) + MOVD $1352, R12 + B runtime·callbackasm1(SB) + MOVD $1353, R12 + B runtime·callbackasm1(SB) + MOVD $1354, R12 + B runtime·callbackasm1(SB) + MOVD $1355, R12 + B runtime·callbackasm1(SB) + MOVD $1356, R12 + B runtime·callbackasm1(SB) + MOVD $1357, R12 + B runtime·callbackasm1(SB) + MOVD $1358, R12 + B runtime·callbackasm1(SB) + MOVD $1359, R12 + B runtime·callbackasm1(SB) + MOVD $1360, R12 + B runtime·callbackasm1(SB) + MOVD $1361, R12 + B runtime·callbackasm1(SB) + MOVD $1362, R12 + B runtime·callbackasm1(SB) + MOVD $1363, R12 + B runtime·callbackasm1(SB) + MOVD $1364, R12 + B runtime·callbackasm1(SB) + MOVD $1365, R12 + B runtime·callbackasm1(SB) + MOVD $1366, R12 + B runtime·callbackasm1(SB) + MOVD $1367, R12 + B runtime·callbackasm1(SB) + MOVD $1368, R12 + B runtime·callbackasm1(SB) + MOVD $1369, R12 + B runtime·callbackasm1(SB) + MOVD $1370, R12 + B runtime·callbackasm1(SB) + MOVD $1371, R12 + B runtime·callbackasm1(SB) + MOVD $1372, R12 + B runtime·callbackasm1(SB) + MOVD $1373, R12 + B runtime·callbackasm1(SB) + MOVD $1374, R12 + B runtime·callbackasm1(SB) + MOVD $1375, R12 + B runtime·callbackasm1(SB) + MOVD $1376, R12 + B runtime·callbackasm1(SB) + MOVD $1377, R12 + B runtime·callbackasm1(SB) + MOVD $1378, R12 + B runtime·callbackasm1(SB) + MOVD $1379, R12 + B runtime·callbackasm1(SB) + MOVD $1380, R12 + B runtime·callbackasm1(SB) + MOVD $1381, R12 + B runtime·callbackasm1(SB) + MOVD $1382, R12 + B runtime·callbackasm1(SB) + MOVD $1383, R12 + B runtime·callbackasm1(SB) + MOVD $1384, R12 + B runtime·callbackasm1(SB) + MOVD $1385, R12 + B runtime·callbackasm1(SB) + MOVD $1386, R12 + B runtime·callbackasm1(SB) + MOVD $1387, R12 + B runtime·callbackasm1(SB) + MOVD $1388, R12 + B runtime·callbackasm1(SB) + MOVD $1389, R12 + B runtime·callbackasm1(SB) + MOVD $1390, R12 + B runtime·callbackasm1(SB) + MOVD $1391, R12 + B runtime·callbackasm1(SB) + MOVD $1392, R12 + B runtime·callbackasm1(SB) + MOVD $1393, R12 + B runtime·callbackasm1(SB) + MOVD $1394, R12 + B runtime·callbackasm1(SB) + MOVD $1395, R12 + B runtime·callbackasm1(SB) + MOVD $1396, R12 + B runtime·callbackasm1(SB) + MOVD $1397, R12 + B runtime·callbackasm1(SB) + MOVD $1398, R12 + B runtime·callbackasm1(SB) + MOVD $1399, R12 + B runtime·callbackasm1(SB) + MOVD $1400, R12 + B runtime·callbackasm1(SB) + MOVD $1401, R12 + B runtime·callbackasm1(SB) + MOVD $1402, R12 + B runtime·callbackasm1(SB) + MOVD $1403, R12 + B runtime·callbackasm1(SB) + MOVD $1404, R12 + B runtime·callbackasm1(SB) + MOVD $1405, R12 + B runtime·callbackasm1(SB) + MOVD $1406, R12 + B runtime·callbackasm1(SB) + MOVD $1407, R12 + B runtime·callbackasm1(SB) + MOVD $1408, R12 + B runtime·callbackasm1(SB) + MOVD $1409, R12 + B runtime·callbackasm1(SB) + MOVD $1410, R12 + B runtime·callbackasm1(SB) + MOVD $1411, R12 + B runtime·callbackasm1(SB) + MOVD $1412, R12 + B runtime·callbackasm1(SB) + MOVD $1413, R12 + B runtime·callbackasm1(SB) + MOVD $1414, R12 + B runtime·callbackasm1(SB) + MOVD $1415, R12 + B runtime·callbackasm1(SB) + MOVD $1416, R12 + B runtime·callbackasm1(SB) + MOVD $1417, R12 + B runtime·callbackasm1(SB) + MOVD $1418, R12 + B runtime·callbackasm1(SB) + MOVD $1419, R12 + B runtime·callbackasm1(SB) + MOVD $1420, R12 + B runtime·callbackasm1(SB) + MOVD $1421, R12 + B runtime·callbackasm1(SB) + MOVD $1422, R12 + B runtime·callbackasm1(SB) + MOVD $1423, R12 + B runtime·callbackasm1(SB) + MOVD $1424, R12 + B runtime·callbackasm1(SB) + MOVD $1425, R12 + B runtime·callbackasm1(SB) + MOVD $1426, R12 + B runtime·callbackasm1(SB) + MOVD $1427, R12 + B runtime·callbackasm1(SB) + MOVD $1428, R12 + B runtime·callbackasm1(SB) + MOVD $1429, R12 + B runtime·callbackasm1(SB) + MOVD $1430, R12 + B runtime·callbackasm1(SB) + MOVD $1431, R12 + B runtime·callbackasm1(SB) + MOVD $1432, R12 + B runtime·callbackasm1(SB) + MOVD $1433, R12 + B runtime·callbackasm1(SB) + MOVD $1434, R12 + B runtime·callbackasm1(SB) + MOVD $1435, R12 + B runtime·callbackasm1(SB) + MOVD $1436, R12 + B runtime·callbackasm1(SB) + MOVD $1437, R12 + B runtime·callbackasm1(SB) + MOVD $1438, R12 + B runtime·callbackasm1(SB) + MOVD $1439, R12 + B runtime·callbackasm1(SB) + MOVD $1440, R12 + B runtime·callbackasm1(SB) + MOVD $1441, R12 + B runtime·callbackasm1(SB) + MOVD $1442, R12 + B runtime·callbackasm1(SB) + MOVD $1443, R12 + B runtime·callbackasm1(SB) + MOVD $1444, R12 + B runtime·callbackasm1(SB) + MOVD $1445, R12 + B runtime·callbackasm1(SB) + MOVD $1446, R12 + B runtime·callbackasm1(SB) + MOVD $1447, R12 + B runtime·callbackasm1(SB) + MOVD $1448, R12 + B runtime·callbackasm1(SB) + MOVD $1449, R12 + B runtime·callbackasm1(SB) + MOVD $1450, R12 + B runtime·callbackasm1(SB) + MOVD $1451, R12 + B runtime·callbackasm1(SB) + MOVD $1452, R12 + B runtime·callbackasm1(SB) + MOVD $1453, R12 + B runtime·callbackasm1(SB) + MOVD $1454, R12 + B runtime·callbackasm1(SB) + MOVD $1455, R12 + B runtime·callbackasm1(SB) + MOVD $1456, R12 + B runtime·callbackasm1(SB) + MOVD $1457, R12 + B runtime·callbackasm1(SB) + MOVD $1458, R12 + B runtime·callbackasm1(SB) + MOVD $1459, R12 + B runtime·callbackasm1(SB) + MOVD $1460, R12 + B runtime·callbackasm1(SB) + MOVD $1461, R12 + B runtime·callbackasm1(SB) + MOVD $1462, R12 + B runtime·callbackasm1(SB) + MOVD $1463, R12 + B runtime·callbackasm1(SB) + MOVD $1464, R12 + B runtime·callbackasm1(SB) + MOVD $1465, R12 + B runtime·callbackasm1(SB) + MOVD $1466, R12 + B runtime·callbackasm1(SB) + MOVD $1467, R12 + B runtime·callbackasm1(SB) + MOVD $1468, R12 + B runtime·callbackasm1(SB) + MOVD $1469, R12 + B runtime·callbackasm1(SB) + MOVD $1470, R12 + B runtime·callbackasm1(SB) + MOVD $1471, R12 + B runtime·callbackasm1(SB) + MOVD $1472, R12 + B runtime·callbackasm1(SB) + MOVD $1473, R12 + B runtime·callbackasm1(SB) + MOVD $1474, R12 + B runtime·callbackasm1(SB) + MOVD $1475, R12 + B runtime·callbackasm1(SB) + MOVD $1476, R12 + B runtime·callbackasm1(SB) + MOVD $1477, R12 + B runtime·callbackasm1(SB) + MOVD $1478, R12 + B runtime·callbackasm1(SB) + MOVD $1479, R12 + B runtime·callbackasm1(SB) + MOVD $1480, R12 + B runtime·callbackasm1(SB) + MOVD $1481, R12 + B runtime·callbackasm1(SB) + MOVD $1482, R12 + B runtime·callbackasm1(SB) + MOVD $1483, R12 + B runtime·callbackasm1(SB) + MOVD $1484, R12 + B runtime·callbackasm1(SB) + MOVD $1485, R12 + B runtime·callbackasm1(SB) + MOVD $1486, R12 + B runtime·callbackasm1(SB) + MOVD $1487, R12 + B runtime·callbackasm1(SB) + MOVD $1488, R12 + B runtime·callbackasm1(SB) + MOVD $1489, R12 + B runtime·callbackasm1(SB) + MOVD $1490, R12 + B runtime·callbackasm1(SB) + MOVD $1491, R12 + B runtime·callbackasm1(SB) + MOVD $1492, R12 + B runtime·callbackasm1(SB) + MOVD $1493, R12 + B runtime·callbackasm1(SB) + MOVD $1494, R12 + B runtime·callbackasm1(SB) + MOVD $1495, R12 + B runtime·callbackasm1(SB) + MOVD $1496, R12 + B runtime·callbackasm1(SB) + MOVD $1497, R12 + B runtime·callbackasm1(SB) + MOVD $1498, R12 + B runtime·callbackasm1(SB) + MOVD $1499, R12 + B runtime·callbackasm1(SB) + MOVD $1500, R12 + B runtime·callbackasm1(SB) + MOVD $1501, R12 + B runtime·callbackasm1(SB) + MOVD $1502, R12 + B runtime·callbackasm1(SB) + MOVD $1503, R12 + B runtime·callbackasm1(SB) + MOVD $1504, R12 + B runtime·callbackasm1(SB) + MOVD $1505, R12 + B runtime·callbackasm1(SB) + MOVD $1506, R12 + B runtime·callbackasm1(SB) + MOVD $1507, R12 + B runtime·callbackasm1(SB) + MOVD $1508, R12 + B runtime·callbackasm1(SB) + MOVD $1509, R12 + B runtime·callbackasm1(SB) + MOVD $1510, R12 + B runtime·callbackasm1(SB) + MOVD $1511, R12 + B runtime·callbackasm1(SB) + MOVD $1512, R12 + B runtime·callbackasm1(SB) + MOVD $1513, R12 + B runtime·callbackasm1(SB) + MOVD $1514, R12 + B runtime·callbackasm1(SB) + MOVD $1515, R12 + B runtime·callbackasm1(SB) + MOVD $1516, R12 + B runtime·callbackasm1(SB) + MOVD $1517, R12 + B runtime·callbackasm1(SB) + MOVD $1518, R12 + B runtime·callbackasm1(SB) + MOVD $1519, R12 + B runtime·callbackasm1(SB) + MOVD $1520, R12 + B runtime·callbackasm1(SB) + MOVD $1521, R12 + B runtime·callbackasm1(SB) + MOVD $1522, R12 + B runtime·callbackasm1(SB) + MOVD $1523, R12 + B runtime·callbackasm1(SB) + MOVD $1524, R12 + B runtime·callbackasm1(SB) + MOVD $1525, R12 + B runtime·callbackasm1(SB) + MOVD $1526, R12 + B runtime·callbackasm1(SB) + MOVD $1527, R12 + B runtime·callbackasm1(SB) + MOVD $1528, R12 + B runtime·callbackasm1(SB) + MOVD $1529, R12 + B runtime·callbackasm1(SB) + MOVD $1530, R12 + B runtime·callbackasm1(SB) + MOVD $1531, R12 + B runtime·callbackasm1(SB) + MOVD $1532, R12 + B runtime·callbackasm1(SB) + MOVD $1533, R12 + B runtime·callbackasm1(SB) + MOVD $1534, R12 + B runtime·callbackasm1(SB) + MOVD $1535, R12 + B runtime·callbackasm1(SB) + MOVD $1536, R12 + B runtime·callbackasm1(SB) + MOVD $1537, R12 + B runtime·callbackasm1(SB) + MOVD $1538, R12 + B runtime·callbackasm1(SB) + MOVD $1539, R12 + B runtime·callbackasm1(SB) + MOVD $1540, R12 + B runtime·callbackasm1(SB) + MOVD $1541, R12 + B runtime·callbackasm1(SB) + MOVD $1542, R12 + B runtime·callbackasm1(SB) + MOVD $1543, R12 + B runtime·callbackasm1(SB) + MOVD $1544, R12 + B runtime·callbackasm1(SB) + MOVD $1545, R12 + B runtime·callbackasm1(SB) + MOVD $1546, R12 + B runtime·callbackasm1(SB) + MOVD $1547, R12 + B runtime·callbackasm1(SB) + MOVD $1548, R12 + B runtime·callbackasm1(SB) + MOVD $1549, R12 + B runtime·callbackasm1(SB) + MOVD $1550, R12 + B runtime·callbackasm1(SB) + MOVD $1551, R12 + B runtime·callbackasm1(SB) + MOVD $1552, R12 + B runtime·callbackasm1(SB) + MOVD $1553, R12 + B runtime·callbackasm1(SB) + MOVD $1554, R12 + B runtime·callbackasm1(SB) + MOVD $1555, R12 + B runtime·callbackasm1(SB) + MOVD $1556, R12 + B runtime·callbackasm1(SB) + MOVD $1557, R12 + B runtime·callbackasm1(SB) + MOVD $1558, R12 + B runtime·callbackasm1(SB) + MOVD $1559, R12 + B runtime·callbackasm1(SB) + MOVD $1560, R12 + B runtime·callbackasm1(SB) + MOVD $1561, R12 + B runtime·callbackasm1(SB) + MOVD $1562, R12 + B runtime·callbackasm1(SB) + MOVD $1563, R12 + B runtime·callbackasm1(SB) + MOVD $1564, R12 + B runtime·callbackasm1(SB) + MOVD $1565, R12 + B runtime·callbackasm1(SB) + MOVD $1566, R12 + B runtime·callbackasm1(SB) + MOVD $1567, R12 + B runtime·callbackasm1(SB) + MOVD $1568, R12 + B runtime·callbackasm1(SB) + MOVD $1569, R12 + B runtime·callbackasm1(SB) + MOVD $1570, R12 + B runtime·callbackasm1(SB) + MOVD $1571, R12 + B runtime·callbackasm1(SB) + MOVD $1572, R12 + B runtime·callbackasm1(SB) + MOVD $1573, R12 + B runtime·callbackasm1(SB) + MOVD $1574, R12 + B runtime·callbackasm1(SB) + MOVD $1575, R12 + B runtime·callbackasm1(SB) + MOVD $1576, R12 + B runtime·callbackasm1(SB) + MOVD $1577, R12 + B runtime·callbackasm1(SB) + MOVD $1578, R12 + B runtime·callbackasm1(SB) + MOVD $1579, R12 + B runtime·callbackasm1(SB) + MOVD $1580, R12 + B runtime·callbackasm1(SB) + MOVD $1581, R12 + B runtime·callbackasm1(SB) + MOVD $1582, R12 + B runtime·callbackasm1(SB) + MOVD $1583, R12 + B runtime·callbackasm1(SB) + MOVD $1584, R12 + B runtime·callbackasm1(SB) + MOVD $1585, R12 + B runtime·callbackasm1(SB) + MOVD $1586, R12 + B runtime·callbackasm1(SB) + MOVD $1587, R12 + B runtime·callbackasm1(SB) + MOVD $1588, R12 + B runtime·callbackasm1(SB) + MOVD $1589, R12 + B runtime·callbackasm1(SB) + MOVD $1590, R12 + B runtime·callbackasm1(SB) + MOVD $1591, R12 + B runtime·callbackasm1(SB) + MOVD $1592, R12 + B runtime·callbackasm1(SB) + MOVD $1593, R12 + B runtime·callbackasm1(SB) + MOVD $1594, R12 + B runtime·callbackasm1(SB) + MOVD $1595, R12 + B runtime·callbackasm1(SB) + MOVD $1596, R12 + B runtime·callbackasm1(SB) + MOVD $1597, R12 + B runtime·callbackasm1(SB) + MOVD $1598, R12 + B runtime·callbackasm1(SB) + MOVD $1599, R12 + B runtime·callbackasm1(SB) + MOVD $1600, R12 + B runtime·callbackasm1(SB) + MOVD $1601, R12 + B runtime·callbackasm1(SB) + MOVD $1602, R12 + B runtime·callbackasm1(SB) + MOVD $1603, R12 + B runtime·callbackasm1(SB) + MOVD $1604, R12 + B runtime·callbackasm1(SB) + MOVD $1605, R12 + B runtime·callbackasm1(SB) + MOVD $1606, R12 + B runtime·callbackasm1(SB) + MOVD $1607, R12 + B runtime·callbackasm1(SB) + MOVD $1608, R12 + B runtime·callbackasm1(SB) + MOVD $1609, R12 + B runtime·callbackasm1(SB) + MOVD $1610, R12 + B runtime·callbackasm1(SB) + MOVD $1611, R12 + B runtime·callbackasm1(SB) + MOVD $1612, R12 + B runtime·callbackasm1(SB) + MOVD $1613, R12 + B runtime·callbackasm1(SB) + MOVD $1614, R12 + B runtime·callbackasm1(SB) + MOVD $1615, R12 + B runtime·callbackasm1(SB) + MOVD $1616, R12 + B runtime·callbackasm1(SB) + MOVD $1617, R12 + B runtime·callbackasm1(SB) + MOVD $1618, R12 + B runtime·callbackasm1(SB) + MOVD $1619, R12 + B runtime·callbackasm1(SB) + MOVD $1620, R12 + B runtime·callbackasm1(SB) + MOVD $1621, R12 + B runtime·callbackasm1(SB) + MOVD $1622, R12 + B runtime·callbackasm1(SB) + MOVD $1623, R12 + B runtime·callbackasm1(SB) + MOVD $1624, R12 + B runtime·callbackasm1(SB) + MOVD $1625, R12 + B runtime·callbackasm1(SB) + MOVD $1626, R12 + B runtime·callbackasm1(SB) + MOVD $1627, R12 + B runtime·callbackasm1(SB) + MOVD $1628, R12 + B runtime·callbackasm1(SB) + MOVD $1629, R12 + B runtime·callbackasm1(SB) + MOVD $1630, R12 + B runtime·callbackasm1(SB) + MOVD $1631, R12 + B runtime·callbackasm1(SB) + MOVD $1632, R12 + B runtime·callbackasm1(SB) + MOVD $1633, R12 + B runtime·callbackasm1(SB) + MOVD $1634, R12 + B runtime·callbackasm1(SB) + MOVD $1635, R12 + B runtime·callbackasm1(SB) + MOVD $1636, R12 + B runtime·callbackasm1(SB) + MOVD $1637, R12 + B runtime·callbackasm1(SB) + MOVD $1638, R12 + B runtime·callbackasm1(SB) + MOVD $1639, R12 + B runtime·callbackasm1(SB) + MOVD $1640, R12 + B runtime·callbackasm1(SB) + MOVD $1641, R12 + B runtime·callbackasm1(SB) + MOVD $1642, R12 + B runtime·callbackasm1(SB) + MOVD $1643, R12 + B runtime·callbackasm1(SB) + MOVD $1644, R12 + B runtime·callbackasm1(SB) + MOVD $1645, R12 + B runtime·callbackasm1(SB) + MOVD $1646, R12 + B runtime·callbackasm1(SB) + MOVD $1647, R12 + B runtime·callbackasm1(SB) + MOVD $1648, R12 + B runtime·callbackasm1(SB) + MOVD $1649, R12 + B runtime·callbackasm1(SB) + MOVD $1650, R12 + B runtime·callbackasm1(SB) + MOVD $1651, R12 + B runtime·callbackasm1(SB) + MOVD $1652, R12 + B runtime·callbackasm1(SB) + MOVD $1653, R12 + B runtime·callbackasm1(SB) + MOVD $1654, R12 + B runtime·callbackasm1(SB) + MOVD $1655, R12 + B runtime·callbackasm1(SB) + MOVD $1656, R12 + B runtime·callbackasm1(SB) + MOVD $1657, R12 + B runtime·callbackasm1(SB) + MOVD $1658, R12 + B runtime·callbackasm1(SB) + MOVD $1659, R12 + B runtime·callbackasm1(SB) + MOVD $1660, R12 + B runtime·callbackasm1(SB) + MOVD $1661, R12 + B runtime·callbackasm1(SB) + MOVD $1662, R12 + B runtime·callbackasm1(SB) + MOVD $1663, R12 + B runtime·callbackasm1(SB) + MOVD $1664, R12 + B runtime·callbackasm1(SB) + MOVD $1665, R12 + B runtime·callbackasm1(SB) + MOVD $1666, R12 + B runtime·callbackasm1(SB) + MOVD $1667, R12 + B runtime·callbackasm1(SB) + MOVD $1668, R12 + B runtime·callbackasm1(SB) + MOVD $1669, R12 + B runtime·callbackasm1(SB) + MOVD $1670, R12 + B runtime·callbackasm1(SB) + MOVD $1671, R12 + B runtime·callbackasm1(SB) + MOVD $1672, R12 + B runtime·callbackasm1(SB) + MOVD $1673, R12 + B runtime·callbackasm1(SB) + MOVD $1674, R12 + B runtime·callbackasm1(SB) + MOVD $1675, R12 + B runtime·callbackasm1(SB) + MOVD $1676, R12 + B runtime·callbackasm1(SB) + MOVD $1677, R12 + B runtime·callbackasm1(SB) + MOVD $1678, R12 + B runtime·callbackasm1(SB) + MOVD $1679, R12 + B runtime·callbackasm1(SB) + MOVD $1680, R12 + B runtime·callbackasm1(SB) + MOVD $1681, R12 + B runtime·callbackasm1(SB) + MOVD $1682, R12 + B runtime·callbackasm1(SB) + MOVD $1683, R12 + B runtime·callbackasm1(SB) + MOVD $1684, R12 + B runtime·callbackasm1(SB) + MOVD $1685, R12 + B runtime·callbackasm1(SB) + MOVD $1686, R12 + B runtime·callbackasm1(SB) + MOVD $1687, R12 + B runtime·callbackasm1(SB) + MOVD $1688, R12 + B runtime·callbackasm1(SB) + MOVD $1689, R12 + B runtime·callbackasm1(SB) + MOVD $1690, R12 + B runtime·callbackasm1(SB) + MOVD $1691, R12 + B runtime·callbackasm1(SB) + MOVD $1692, R12 + B runtime·callbackasm1(SB) + MOVD $1693, R12 + B runtime·callbackasm1(SB) + MOVD $1694, R12 + B runtime·callbackasm1(SB) + MOVD $1695, R12 + B runtime·callbackasm1(SB) + MOVD $1696, R12 + B runtime·callbackasm1(SB) + MOVD $1697, R12 + B runtime·callbackasm1(SB) + MOVD $1698, R12 + B runtime·callbackasm1(SB) + MOVD $1699, R12 + B runtime·callbackasm1(SB) + MOVD $1700, R12 + B runtime·callbackasm1(SB) + MOVD $1701, R12 + B runtime·callbackasm1(SB) + MOVD $1702, R12 + B runtime·callbackasm1(SB) + MOVD $1703, R12 + B runtime·callbackasm1(SB) + MOVD $1704, R12 + B runtime·callbackasm1(SB) + MOVD $1705, R12 + B runtime·callbackasm1(SB) + MOVD $1706, R12 + B runtime·callbackasm1(SB) + MOVD $1707, R12 + B runtime·callbackasm1(SB) + MOVD $1708, R12 + B runtime·callbackasm1(SB) + MOVD $1709, R12 + B runtime·callbackasm1(SB) + MOVD $1710, R12 + B runtime·callbackasm1(SB) + MOVD $1711, R12 + B runtime·callbackasm1(SB) + MOVD $1712, R12 + B runtime·callbackasm1(SB) + MOVD $1713, R12 + B runtime·callbackasm1(SB) + MOVD $1714, R12 + B runtime·callbackasm1(SB) + MOVD $1715, R12 + B runtime·callbackasm1(SB) + MOVD $1716, R12 + B runtime·callbackasm1(SB) + MOVD $1717, R12 + B runtime·callbackasm1(SB) + MOVD $1718, R12 + B runtime·callbackasm1(SB) + MOVD $1719, R12 + B runtime·callbackasm1(SB) + MOVD $1720, R12 + B runtime·callbackasm1(SB) + MOVD $1721, R12 + B runtime·callbackasm1(SB) + MOVD $1722, R12 + B runtime·callbackasm1(SB) + MOVD $1723, R12 + B runtime·callbackasm1(SB) + MOVD $1724, R12 + B runtime·callbackasm1(SB) + MOVD $1725, R12 + B runtime·callbackasm1(SB) + MOVD $1726, R12 + B runtime·callbackasm1(SB) + MOVD $1727, R12 + B runtime·callbackasm1(SB) + MOVD $1728, R12 + B runtime·callbackasm1(SB) + MOVD $1729, R12 + B runtime·callbackasm1(SB) + MOVD $1730, R12 + B runtime·callbackasm1(SB) + MOVD $1731, R12 + B runtime·callbackasm1(SB) + MOVD $1732, R12 + B runtime·callbackasm1(SB) + MOVD $1733, R12 + B runtime·callbackasm1(SB) + MOVD $1734, R12 + B runtime·callbackasm1(SB) + MOVD $1735, R12 + B runtime·callbackasm1(SB) + MOVD $1736, R12 + B runtime·callbackasm1(SB) + MOVD $1737, R12 + B runtime·callbackasm1(SB) + MOVD $1738, R12 + B runtime·callbackasm1(SB) + MOVD $1739, R12 + B runtime·callbackasm1(SB) + MOVD $1740, R12 + B runtime·callbackasm1(SB) + MOVD $1741, R12 + B runtime·callbackasm1(SB) + MOVD $1742, R12 + B runtime·callbackasm1(SB) + MOVD $1743, R12 + B runtime·callbackasm1(SB) + MOVD $1744, R12 + B runtime·callbackasm1(SB) + MOVD $1745, R12 + B runtime·callbackasm1(SB) + MOVD $1746, R12 + B runtime·callbackasm1(SB) + MOVD $1747, R12 + B runtime·callbackasm1(SB) + MOVD $1748, R12 + B runtime·callbackasm1(SB) + MOVD $1749, R12 + B runtime·callbackasm1(SB) + MOVD $1750, R12 + B runtime·callbackasm1(SB) + MOVD $1751, R12 + B runtime·callbackasm1(SB) + MOVD $1752, R12 + B runtime·callbackasm1(SB) + MOVD $1753, R12 + B runtime·callbackasm1(SB) + MOVD $1754, R12 + B runtime·callbackasm1(SB) + MOVD $1755, R12 + B runtime·callbackasm1(SB) + MOVD $1756, R12 + B runtime·callbackasm1(SB) + MOVD $1757, R12 + B runtime·callbackasm1(SB) + MOVD $1758, R12 + B runtime·callbackasm1(SB) + MOVD $1759, R12 + B runtime·callbackasm1(SB) + MOVD $1760, R12 + B runtime·callbackasm1(SB) + MOVD $1761, R12 + B runtime·callbackasm1(SB) + MOVD $1762, R12 + B runtime·callbackasm1(SB) + MOVD $1763, R12 + B runtime·callbackasm1(SB) + MOVD $1764, R12 + B runtime·callbackasm1(SB) + MOVD $1765, R12 + B runtime·callbackasm1(SB) + MOVD $1766, R12 + B runtime·callbackasm1(SB) + MOVD $1767, R12 + B runtime·callbackasm1(SB) + MOVD $1768, R12 + B runtime·callbackasm1(SB) + MOVD $1769, R12 + B runtime·callbackasm1(SB) + MOVD $1770, R12 + B runtime·callbackasm1(SB) + MOVD $1771, R12 + B runtime·callbackasm1(SB) + MOVD $1772, R12 + B runtime·callbackasm1(SB) + MOVD $1773, R12 + B runtime·callbackasm1(SB) + MOVD $1774, R12 + B runtime·callbackasm1(SB) + MOVD $1775, R12 + B runtime·callbackasm1(SB) + MOVD $1776, R12 + B runtime·callbackasm1(SB) + MOVD $1777, R12 + B runtime·callbackasm1(SB) + MOVD $1778, R12 + B runtime·callbackasm1(SB) + MOVD $1779, R12 + B runtime·callbackasm1(SB) + MOVD $1780, R12 + B runtime·callbackasm1(SB) + MOVD $1781, R12 + B runtime·callbackasm1(SB) + MOVD $1782, R12 + B runtime·callbackasm1(SB) + MOVD $1783, R12 + B runtime·callbackasm1(SB) + MOVD $1784, R12 + B runtime·callbackasm1(SB) + MOVD $1785, R12 + B runtime·callbackasm1(SB) + MOVD $1786, R12 + B runtime·callbackasm1(SB) + MOVD $1787, R12 + B runtime·callbackasm1(SB) + MOVD $1788, R12 + B runtime·callbackasm1(SB) + MOVD $1789, R12 + B runtime·callbackasm1(SB) + MOVD $1790, R12 + B runtime·callbackasm1(SB) + MOVD $1791, R12 + B runtime·callbackasm1(SB) + MOVD $1792, R12 + B runtime·callbackasm1(SB) + MOVD $1793, R12 + B runtime·callbackasm1(SB) + MOVD $1794, R12 + B runtime·callbackasm1(SB) + MOVD $1795, R12 + B runtime·callbackasm1(SB) + MOVD $1796, R12 + B runtime·callbackasm1(SB) + MOVD $1797, R12 + B runtime·callbackasm1(SB) + MOVD $1798, R12 + B runtime·callbackasm1(SB) + MOVD $1799, R12 + B runtime·callbackasm1(SB) + MOVD $1800, R12 + B runtime·callbackasm1(SB) + MOVD $1801, R12 + B runtime·callbackasm1(SB) + MOVD $1802, R12 + B runtime·callbackasm1(SB) + MOVD $1803, R12 + B runtime·callbackasm1(SB) + MOVD $1804, R12 + B runtime·callbackasm1(SB) + MOVD $1805, R12 + B runtime·callbackasm1(SB) + MOVD $1806, R12 + B runtime·callbackasm1(SB) + MOVD $1807, R12 + B runtime·callbackasm1(SB) + MOVD $1808, R12 + B runtime·callbackasm1(SB) + MOVD $1809, R12 + B runtime·callbackasm1(SB) + MOVD $1810, R12 + B runtime·callbackasm1(SB) + MOVD $1811, R12 + B runtime·callbackasm1(SB) + MOVD $1812, R12 + B runtime·callbackasm1(SB) + MOVD $1813, R12 + B runtime·callbackasm1(SB) + MOVD $1814, R12 + B runtime·callbackasm1(SB) + MOVD $1815, R12 + B runtime·callbackasm1(SB) + MOVD $1816, R12 + B runtime·callbackasm1(SB) + MOVD $1817, R12 + B runtime·callbackasm1(SB) + MOVD $1818, R12 + B runtime·callbackasm1(SB) + MOVD $1819, R12 + B runtime·callbackasm1(SB) + MOVD $1820, R12 + B runtime·callbackasm1(SB) + MOVD $1821, R12 + B runtime·callbackasm1(SB) + MOVD $1822, R12 + B runtime·callbackasm1(SB) + MOVD $1823, R12 + B runtime·callbackasm1(SB) + MOVD $1824, R12 + B runtime·callbackasm1(SB) + MOVD $1825, R12 + B runtime·callbackasm1(SB) + MOVD $1826, R12 + B runtime·callbackasm1(SB) + MOVD $1827, R12 + B runtime·callbackasm1(SB) + MOVD $1828, R12 + B runtime·callbackasm1(SB) + MOVD $1829, R12 + B runtime·callbackasm1(SB) + MOVD $1830, R12 + B runtime·callbackasm1(SB) + MOVD $1831, R12 + B runtime·callbackasm1(SB) + MOVD $1832, R12 + B runtime·callbackasm1(SB) + MOVD $1833, R12 + B runtime·callbackasm1(SB) + MOVD $1834, R12 + B runtime·callbackasm1(SB) + MOVD $1835, R12 + B runtime·callbackasm1(SB) + MOVD $1836, R12 + B runtime·callbackasm1(SB) + MOVD $1837, R12 + B runtime·callbackasm1(SB) + MOVD $1838, R12 + B runtime·callbackasm1(SB) + MOVD $1839, R12 + B runtime·callbackasm1(SB) + MOVD $1840, R12 + B runtime·callbackasm1(SB) + MOVD $1841, R12 + B runtime·callbackasm1(SB) + MOVD $1842, R12 + B runtime·callbackasm1(SB) + MOVD $1843, R12 + B runtime·callbackasm1(SB) + MOVD $1844, R12 + B runtime·callbackasm1(SB) + MOVD $1845, R12 + B runtime·callbackasm1(SB) + MOVD $1846, R12 + B runtime·callbackasm1(SB) + MOVD $1847, R12 + B runtime·callbackasm1(SB) + MOVD $1848, R12 + B runtime·callbackasm1(SB) + MOVD $1849, R12 + B runtime·callbackasm1(SB) + MOVD $1850, R12 + B runtime·callbackasm1(SB) + MOVD $1851, R12 + B runtime·callbackasm1(SB) + MOVD $1852, R12 + B runtime·callbackasm1(SB) + MOVD $1853, R12 + B runtime·callbackasm1(SB) + MOVD $1854, R12 + B runtime·callbackasm1(SB) + MOVD $1855, R12 + B runtime·callbackasm1(SB) + MOVD $1856, R12 + B runtime·callbackasm1(SB) + MOVD $1857, R12 + B runtime·callbackasm1(SB) + MOVD $1858, R12 + B runtime·callbackasm1(SB) + MOVD $1859, R12 + B runtime·callbackasm1(SB) + MOVD $1860, R12 + B runtime·callbackasm1(SB) + MOVD $1861, R12 + B runtime·callbackasm1(SB) + MOVD $1862, R12 + B runtime·callbackasm1(SB) + MOVD $1863, R12 + B runtime·callbackasm1(SB) + MOVD $1864, R12 + B runtime·callbackasm1(SB) + MOVD $1865, R12 + B runtime·callbackasm1(SB) + MOVD $1866, R12 + B runtime·callbackasm1(SB) + MOVD $1867, R12 + B runtime·callbackasm1(SB) + MOVD $1868, R12 + B runtime·callbackasm1(SB) + MOVD $1869, R12 + B runtime·callbackasm1(SB) + MOVD $1870, R12 + B runtime·callbackasm1(SB) + MOVD $1871, R12 + B runtime·callbackasm1(SB) + MOVD $1872, R12 + B runtime·callbackasm1(SB) + MOVD $1873, R12 + B runtime·callbackasm1(SB) + MOVD $1874, R12 + B runtime·callbackasm1(SB) + MOVD $1875, R12 + B runtime·callbackasm1(SB) + MOVD $1876, R12 + B runtime·callbackasm1(SB) + MOVD $1877, R12 + B runtime·callbackasm1(SB) + MOVD $1878, R12 + B runtime·callbackasm1(SB) + MOVD $1879, R12 + B runtime·callbackasm1(SB) + MOVD $1880, R12 + B runtime·callbackasm1(SB) + MOVD $1881, R12 + B runtime·callbackasm1(SB) + MOVD $1882, R12 + B runtime·callbackasm1(SB) + MOVD $1883, R12 + B runtime·callbackasm1(SB) + MOVD $1884, R12 + B runtime·callbackasm1(SB) + MOVD $1885, R12 + B runtime·callbackasm1(SB) + MOVD $1886, R12 + B runtime·callbackasm1(SB) + MOVD $1887, R12 + B runtime·callbackasm1(SB) + MOVD $1888, R12 + B runtime·callbackasm1(SB) + MOVD $1889, R12 + B runtime·callbackasm1(SB) + MOVD $1890, R12 + B runtime·callbackasm1(SB) + MOVD $1891, R12 + B runtime·callbackasm1(SB) + MOVD $1892, R12 + B runtime·callbackasm1(SB) + MOVD $1893, R12 + B runtime·callbackasm1(SB) + MOVD $1894, R12 + B runtime·callbackasm1(SB) + MOVD $1895, R12 + B runtime·callbackasm1(SB) + MOVD $1896, R12 + B runtime·callbackasm1(SB) + MOVD $1897, R12 + B runtime·callbackasm1(SB) + MOVD $1898, R12 + B runtime·callbackasm1(SB) + MOVD $1899, R12 + B runtime·callbackasm1(SB) + MOVD $1900, R12 + B runtime·callbackasm1(SB) + MOVD $1901, R12 + B runtime·callbackasm1(SB) + MOVD $1902, R12 + B runtime·callbackasm1(SB) + MOVD $1903, R12 + B runtime·callbackasm1(SB) + MOVD $1904, R12 + B runtime·callbackasm1(SB) + MOVD $1905, R12 + B runtime·callbackasm1(SB) + MOVD $1906, R12 + B runtime·callbackasm1(SB) + MOVD $1907, R12 + B runtime·callbackasm1(SB) + MOVD $1908, R12 + B runtime·callbackasm1(SB) + MOVD $1909, R12 + B runtime·callbackasm1(SB) + MOVD $1910, R12 + B runtime·callbackasm1(SB) + MOVD $1911, R12 + B runtime·callbackasm1(SB) + MOVD $1912, R12 + B runtime·callbackasm1(SB) + MOVD $1913, R12 + B runtime·callbackasm1(SB) + MOVD $1914, R12 + B runtime·callbackasm1(SB) + MOVD $1915, R12 + B runtime·callbackasm1(SB) + MOVD $1916, R12 + B runtime·callbackasm1(SB) + MOVD $1917, R12 + B runtime·callbackasm1(SB) + MOVD $1918, R12 + B runtime·callbackasm1(SB) + MOVD $1919, R12 + B runtime·callbackasm1(SB) + MOVD $1920, R12 + B runtime·callbackasm1(SB) + MOVD $1921, R12 + B runtime·callbackasm1(SB) + MOVD $1922, R12 + B runtime·callbackasm1(SB) + MOVD $1923, R12 + B runtime·callbackasm1(SB) + MOVD $1924, R12 + B runtime·callbackasm1(SB) + MOVD $1925, R12 + B runtime·callbackasm1(SB) + MOVD $1926, R12 + B runtime·callbackasm1(SB) + MOVD $1927, R12 + B runtime·callbackasm1(SB) + MOVD $1928, R12 + B runtime·callbackasm1(SB) + MOVD $1929, R12 + B runtime·callbackasm1(SB) + MOVD $1930, R12 + B runtime·callbackasm1(SB) + MOVD $1931, R12 + B runtime·callbackasm1(SB) + MOVD $1932, R12 + B runtime·callbackasm1(SB) + MOVD $1933, R12 + B runtime·callbackasm1(SB) + MOVD $1934, R12 + B runtime·callbackasm1(SB) + MOVD $1935, R12 + B runtime·callbackasm1(SB) + MOVD $1936, R12 + B runtime·callbackasm1(SB) + MOVD $1937, R12 + B runtime·callbackasm1(SB) + MOVD $1938, R12 + B runtime·callbackasm1(SB) + MOVD $1939, R12 + B runtime·callbackasm1(SB) + MOVD $1940, R12 + B runtime·callbackasm1(SB) + MOVD $1941, R12 + B runtime·callbackasm1(SB) + MOVD $1942, R12 + B runtime·callbackasm1(SB) + MOVD $1943, R12 + B runtime·callbackasm1(SB) + MOVD $1944, R12 + B runtime·callbackasm1(SB) + MOVD $1945, R12 + B runtime·callbackasm1(SB) + MOVD $1946, R12 + B runtime·callbackasm1(SB) + MOVD $1947, R12 + B runtime·callbackasm1(SB) + MOVD $1948, R12 + B runtime·callbackasm1(SB) + MOVD $1949, R12 + B runtime·callbackasm1(SB) + MOVD $1950, R12 + B runtime·callbackasm1(SB) + MOVD $1951, R12 + B runtime·callbackasm1(SB) + MOVD $1952, R12 + B runtime·callbackasm1(SB) + MOVD $1953, R12 + B runtime·callbackasm1(SB) + MOVD $1954, R12 + B runtime·callbackasm1(SB) + MOVD $1955, R12 + B runtime·callbackasm1(SB) + MOVD $1956, R12 + B runtime·callbackasm1(SB) + MOVD $1957, R12 + B runtime·callbackasm1(SB) + MOVD $1958, R12 + B runtime·callbackasm1(SB) + MOVD $1959, R12 + B runtime·callbackasm1(SB) + MOVD $1960, R12 + B runtime·callbackasm1(SB) + MOVD $1961, R12 + B runtime·callbackasm1(SB) + MOVD $1962, R12 + B runtime·callbackasm1(SB) + MOVD $1963, R12 + B runtime·callbackasm1(SB) + MOVD $1964, R12 + B runtime·callbackasm1(SB) + MOVD $1965, R12 + B runtime·callbackasm1(SB) + MOVD $1966, R12 + B runtime·callbackasm1(SB) + MOVD $1967, R12 + B runtime·callbackasm1(SB) + MOVD $1968, R12 + B runtime·callbackasm1(SB) + MOVD $1969, R12 + B runtime·callbackasm1(SB) + MOVD $1970, R12 + B runtime·callbackasm1(SB) + MOVD $1971, R12 + B runtime·callbackasm1(SB) + MOVD $1972, R12 + B runtime·callbackasm1(SB) + MOVD $1973, R12 + B runtime·callbackasm1(SB) + MOVD $1974, R12 + B runtime·callbackasm1(SB) + MOVD $1975, R12 + B runtime·callbackasm1(SB) + MOVD $1976, R12 + B runtime·callbackasm1(SB) + MOVD $1977, R12 + B runtime·callbackasm1(SB) + MOVD $1978, R12 + B runtime·callbackasm1(SB) + MOVD $1979, R12 + B runtime·callbackasm1(SB) + MOVD $1980, R12 + B runtime·callbackasm1(SB) + MOVD $1981, R12 + B runtime·callbackasm1(SB) + MOVD $1982, R12 + B runtime·callbackasm1(SB) + MOVD $1983, R12 + B runtime·callbackasm1(SB) + MOVD $1984, R12 + B runtime·callbackasm1(SB) + MOVD $1985, R12 + B runtime·callbackasm1(SB) + MOVD $1986, R12 + B runtime·callbackasm1(SB) + MOVD $1987, R12 + B runtime·callbackasm1(SB) + MOVD $1988, R12 + B runtime·callbackasm1(SB) + MOVD $1989, R12 + B runtime·callbackasm1(SB) + MOVD $1990, R12 + B runtime·callbackasm1(SB) + MOVD $1991, R12 + B runtime·callbackasm1(SB) + MOVD $1992, R12 + B runtime·callbackasm1(SB) + MOVD $1993, R12 + B runtime·callbackasm1(SB) + MOVD $1994, R12 + B runtime·callbackasm1(SB) + MOVD $1995, R12 + B runtime·callbackasm1(SB) + MOVD $1996, R12 + B runtime·callbackasm1(SB) + MOVD $1997, R12 + B runtime·callbackasm1(SB) + MOVD $1998, R12 + B runtime·callbackasm1(SB) + MOVD $1999, R12 + B runtime·callbackasm1(SB) -- cgit v1.3-5-g9baa From 3527caa7d63eab821c9936383e6c442d7a013de1 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 22 Jan 2021 10:30:10 -0500 Subject: runtime: initial windows/arm64 implementation files This CL adds a few small files - defs, os, and rt0 - to start on windows/arm64 support for the runtime. It also copies sys_windows_arm.s to sys_windows_arm64.s, with the addition of "#ifdef NOT_PORTED" around the entire file. This is meant to make future CLs easier to review, since the general pattern is to translate the 32-bit ARM assembly into 64-bit ARM assembly. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. Change-Id: I922037eb3890e77bac48281ecaa8e489595675be Reviewed-on: https://go-review.googlesource.com/c/go/+/288827 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang Reviewed-by: Alex Brainman Reviewed-by: Jason A. Donenfeld --- src/runtime/defs_windows_arm64.go | 83 ++++++ src/runtime/os_windows_arm64.go | 14 + src/runtime/rt0_windows_arm64.s | 12 + src/runtime/sys_windows_arm64.s | 588 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 697 insertions(+) create mode 100644 src/runtime/defs_windows_arm64.go create mode 100644 src/runtime/os_windows_arm64.go create mode 100644 src/runtime/rt0_windows_arm64.s create mode 100644 src/runtime/sys_windows_arm64.s (limited to 'src/runtime') diff --git a/src/runtime/defs_windows_arm64.go b/src/runtime/defs_windows_arm64.go new file mode 100644 index 0000000000..9ccce46f09 --- /dev/null +++ b/src/runtime/defs_windows_arm64.go @@ -0,0 +1,83 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +// NOTE(rsc): _CONTEXT_CONTROL is actually 0x400001 and should include PC, SP, and LR. +// However, empirically, LR doesn't come along on Windows 10 +// unless you also set _CONTEXT_INTEGER (0x400002). +// Without LR, we skip over the next-to-bottom function in profiles +// when the bottom function is frameless. +// So we set both here, to make a working _CONTEXT_CONTROL. +const _CONTEXT_CONTROL = 0x400003 + +type neon128 struct { + low uint64 + high int64 +} + +// See https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-arm64_nt_context +type context struct { + contextflags uint32 + cpsr uint32 + x [31]uint64 // fp is x[29], lr is x[30] + xsp uint64 + pc uint64 + v [32]neon128 + fpcr uint32 + fpsr uint32 + bcr [8]uint32 + bvr [8]uint64 + wcr [2]uint32 + wvr [2]uint64 +} + +func (c *context) ip() uintptr { return uintptr(c.pc) } +func (c *context) sp() uintptr { return uintptr(c.xsp) } +func (c *context) lr() uintptr { return uintptr(c.x[30]) } + +func (c *context) set_ip(x uintptr) { c.pc = uint64(x) } +func (c *context) set_sp(x uintptr) { c.xsp = uint64(x) } +func (c *context) set_lr(x uintptr) { c.x[30] = uint64(x) } + +func dumpregs(r *context) { + print("r0 ", hex(r.x[0]), "\n") + print("r1 ", hex(r.x[1]), "\n") + print("r2 ", hex(r.x[2]), "\n") + print("r3 ", hex(r.x[3]), "\n") + print("r4 ", hex(r.x[4]), "\n") + print("r5 ", hex(r.x[5]), "\n") + print("r6 ", hex(r.x[6]), "\n") + print("r7 ", hex(r.x[7]), "\n") + print("r8 ", hex(r.x[8]), "\n") + print("r9 ", hex(r.x[9]), "\n") + print("r10 ", hex(r.x[10]), "\n") + print("r11 ", hex(r.x[11]), "\n") + print("r12 ", hex(r.x[12]), "\n") + print("r13 ", hex(r.x[13]), "\n") + print("r14 ", hex(r.x[14]), "\n") + print("r15 ", hex(r.x[15]), "\n") + print("r16 ", hex(r.x[16]), "\n") + print("r17 ", hex(r.x[17]), "\n") + print("r18 ", hex(r.x[18]), "\n") + print("r19 ", hex(r.x[19]), "\n") + print("r20 ", hex(r.x[20]), "\n") + print("r21 ", hex(r.x[21]), "\n") + print("r22 ", hex(r.x[22]), "\n") + print("r23 ", hex(r.x[23]), "\n") + print("r24 ", hex(r.x[24]), "\n") + print("r25 ", hex(r.x[25]), "\n") + print("r26 ", hex(r.x[26]), "\n") + print("r27 ", hex(r.x[27]), "\n") + print("r28 ", hex(r.x[28]), "\n") + print("r29 ", hex(r.x[29]), "\n") + print("lr ", hex(r.x[30]), "\n") + print("sp ", hex(r.xsp), "\n") + print("pc ", hex(r.pc), "\n") + print("cpsr ", hex(r.cpsr), "\n") +} + +func stackcheck() { + // TODO: not implemented on ARM +} diff --git a/src/runtime/os_windows_arm64.go b/src/runtime/os_windows_arm64.go new file mode 100644 index 0000000000..7e413445ba --- /dev/null +++ b/src/runtime/os_windows_arm64.go @@ -0,0 +1,14 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package runtime + +import "unsafe" + +//go:nosplit +func cputicks() int64 { + var counter int64 + stdcall1(_QueryPerformanceCounter, uintptr(unsafe.Pointer(&counter))) + return counter +} diff --git a/src/runtime/rt0_windows_arm64.s b/src/runtime/rt0_windows_arm64.s new file mode 100644 index 0000000000..1e71a068d3 --- /dev/null +++ b/src/runtime/rt0_windows_arm64.s @@ -0,0 +1,12 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "go_asm.h" +#include "go_tls.h" +#include "textflag.h" + +// This is the entry point for the program from the +// kernel for an ordinary -buildmode=exe program. +TEXT _rt0_arm64_windows(SB),NOSPLIT|NOFRAME,$0 + B ·rt0_go(SB) diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s new file mode 100644 index 0000000000..b279f25de8 --- /dev/null +++ b/src/runtime/sys_windows_arm64.s @@ -0,0 +1,588 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "go_asm.h" +#include "go_tls.h" +#include "textflag.h" + +#ifdef NOT_PORTED + +// Note: For system ABI, R0-R3 are args, R4-R11 are callee-save. + +// void runtime·asmstdcall(void *c); +TEXT runtime·asmstdcall(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R4, R5, R14], (R13) // push {r4, r5, lr} + MOVW R0, R4 // put libcall * in r4 + MOVW R13, R5 // save stack pointer in r5 + + // SetLastError(0) + MOVW $0, R0 + MRC 15, 0, R1, C13, C0, 2 + MOVW R0, 0x34(R1) + + MOVW 8(R4), R12 // libcall->args + + // Do we have more than 4 arguments? + MOVW 4(R4), R0 // libcall->n + SUB.S $4, R0, R2 + BLE loadregs + + // Reserve stack space for remaining args + SUB R2<<2, R13 + BIC $0x7, R13 // alignment for ABI + + // R0: count of arguments + // R1: + // R2: loop counter, from 0 to (n-4) + // R3: scratch + // R4: pointer to libcall struct + // R12: libcall->args + MOVW $0, R2 +stackargs: + ADD $4, R2, R3 // r3 = args[4 + i] + MOVW R3<<2(R12), R3 + MOVW R3, R2<<2(R13) // stack[i] = r3 + + ADD $1, R2 // i++ + SUB $4, R0, R3 // while (i < (n - 4)) + CMP R3, R2 + BLT stackargs + +loadregs: + CMP $3, R0 + MOVW.GT 12(R12), R3 + + CMP $2, R0 + MOVW.GT 8(R12), R2 + + CMP $1, R0 + MOVW.GT 4(R12), R1 + + CMP $0, R0 + MOVW.GT 0(R12), R0 + + BIC $0x7, R13 // alignment for ABI + MOVW 0(R4), R12 // branch to libcall->fn + BL (R12) + + MOVW R5, R13 // free stack space + MOVW R0, 12(R4) // save return value to libcall->r1 + MOVW R1, 16(R4) + + // GetLastError + MRC 15, 0, R1, C13, C0, 2 + MOVW 0x34(R1), R0 + MOVW R0, 20(R4) // store in libcall->err + + MOVM.IA.W (R13), [R4, R5, R15] + +TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R4, R14], (R13) // push {r4, lr} + MOVW R13, R4 // save original stack pointer + SUB $8, R13 // space for 2 variables + BIC $0x7, R13 // alignment for ABI + + // stderr + MOVW runtime·_GetStdHandle(SB), R1 + MOVW $-12, R0 + BL (R1) + + MOVW $runtime·badsignalmsg(SB), R1 // lpBuffer + MOVW $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite + MOVW (R2), R2 + ADD $0x4, R13, R3 // lpNumberOfBytesWritten + MOVW $0, R12 // lpOverlapped + MOVW R12, (R13) + + MOVW runtime·_WriteFile(SB), R12 + BL (R12) + + MOVW R4, R13 // restore SP + MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} + +TEXT runtime·getlasterror(SB),NOSPLIT,$0 + MRC 15, 0, R0, C13, C0, 2 + MOVW 0x34(R0), R0 + MOVW R0, ret+0(FP) + RET + +// Called by Windows as a Vectored Exception Handler (VEH). +// First argument is pointer to struct containing +// exception record and context pointers. +// Handler function is stored in R1 +// Return 0 for 'not handled', -1 for handled. +// int32_t sigtramp( +// PEXCEPTION_POINTERS ExceptionInfo, +// func *GoExceptionHandler); +TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R0, R4-R11, R14], (R13) // push {r0, r4-r11, lr} (SP-=40) + SUB $(8+20), R13 // reserve space for g, sp, and + // parameters/retval to go call + + MOVW R0, R6 // Save param0 + MOVW R1, R7 // Save param1 + + BL runtime·load_g(SB) + CMP $0, g // is there a current g? + BL.EQ runtime·badsignal2(SB) + + // save g and SP in case of stack switch + MOVW R13, 24(R13) + MOVW g, 20(R13) + + // do we need to switch to the g0 stack? + MOVW g, R5 // R5 = g + MOVW g_m(R5), R2 // R2 = m + MOVW m_g0(R2), R4 // R4 = g0 + CMP R5, R4 // if curg == g0 + BEQ g0 + + // switch to g0 stack + MOVW R4, g // g = g0 + MOVW (g_sched+gobuf_sp)(g), R3 // R3 = g->gobuf.sp + BL runtime·save_g(SB) + + // make room for sighandler arguments + // and re-save old SP for restoring later. + // (note that the 24(R3) here must match the 24(R13) above.) + SUB $40, R3 + MOVW R13, 24(R3) // save old stack pointer + MOVW R3, R13 // switch stack + +g0: + MOVW 0(R6), R2 // R2 = ExceptionPointers->ExceptionRecord + MOVW 4(R6), R3 // R3 = ExceptionPointers->ContextRecord + + MOVW $0, R4 + MOVW R4, 0(R13) // No saved link register. + MOVW R2, 4(R13) // Move arg0 (ExceptionRecord) into position + MOVW R3, 8(R13) // Move arg1 (ContextRecord) into position + MOVW R5, 12(R13) // Move arg2 (original g) into position + BL (R7) // Call the go routine + MOVW 16(R13), R4 // Fetch return value from stack + + // switch back to original stack and g + MOVW 24(R13), R13 + MOVW 20(R13), g + BL runtime·save_g(SB) + +done: + MOVW R4, R0 // move retval into position + ADD $(8 + 20), R13 // free locals + MOVM.IA.W (R13), [R3, R4-R11, R14] // pop {r3, r4-r11, lr} + + // if return value is CONTINUE_SEARCH, do not set up control + // flow guard workaround + CMP $0, R0 + BEQ return + + // Check if we need to set up the control flow guard workaround. + // On Windows/ARM, the stack pointer must lie within system + // stack limits when we resume from exception. + // Store the resume SP and PC on the g0 stack, + // and return to returntramp on the g0 stack. returntramp + // pops the saved PC and SP from the g0 stack, resuming execution + // at the desired location. + // If returntramp has already been set up by a previous exception + // handler, don't clobber the stored SP and PC on the stack. + MOVW 4(R3), R3 // PEXCEPTION_POINTERS->Context + MOVW context_pc(R3), R2 // load PC from context record + MOVW $returntramp<>(SB), R1 + CMP R1, R2 + B.EQ return // do not clobber saved SP/PC + + // Save resume SP and PC into R0, R1. + MOVW context_spr(R3), R2 + MOVW R2, context_r0(R3) + MOVW context_pc(R3), R2 + MOVW R2, context_r1(R3) + + // Set up context record to return to returntramp on g0 stack + MOVW R12, context_spr(R3) + MOVW $returntramp<>(SB), R2 + MOVW R2, context_pc(R3) + +return: + B (R14) // return + +// Trampoline to resume execution from exception handler. +// This is part of the control flow guard workaround. +// It switches stacks and jumps to the continuation address. +// R0 and R1 are set above at the end of sigtramp<> +// in the context that starts executing at returntramp<>. +TEXT returntramp<>(SB),NOSPLIT|NOFRAME,$0 + // Important: do not smash LR, + // which is set to a live value when handling + // a signal by pushing a call to sigpanic onto the stack. + MOVW R0, R13 + B (R1) + +TEXT runtime·exceptiontramp(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·exceptionhandler(SB), R1 + B sigtramp<>(SB) + +TEXT runtime·firstcontinuetramp(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·firstcontinuehandler(SB), R1 + B sigtramp<>(SB) + +TEXT runtime·lastcontinuetramp(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·lastcontinuehandler(SB), R1 + B sigtramp<>(SB) + +TEXT runtime·ctrlhandler(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·ctrlhandler1(SB), R1 + B runtime·externalthreadhandler(SB) + +TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0 + MOVW $runtime·profileloop1(SB), R1 + B runtime·externalthreadhandler(SB) + +// int32 externalthreadhandler(uint32 arg, int (*func)(uint32)) +// stack layout: +// +----------------+ +// | callee-save | +// | registers | +// +----------------+ +// | m | +// +----------------+ +// 20| g | +// +----------------+ +// 16| func ptr (r1) | +// +----------------+ +// 12| argument (r0) | +//---+----------------+ +// 8 | param1 | (also return value for called Go function) +// +----------------+ +// 4 | param0 | +// +----------------+ +// 0 | slot for LR | +// +----------------+ +// +TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 + MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} + SUB $(m__size + g__size + 20), R13 // space for locals + MOVW R14, 0(R13) // push LR again for anything unwinding the stack + MOVW R0, 12(R13) + MOVW R1, 16(R13) + + // zero out m and g structures + ADD $20, R13, R0 // compute pointer to g + MOVW R0, 4(R13) + MOVW $(m__size + g__size), R0 + MOVW R0, 8(R13) + BL runtime·memclrNoHeapPointers(SB) + + // initialize m and g structures + ADD $20, R13, R2 // R2 = g + ADD $(20 + g__size), R13, R3 // R3 = m + MOVW R2, m_g0(R3) // m->g0 = g + MOVW R3, g_m(R2) // g->m = m + MOVW R2, m_curg(R3) // m->curg = g + + MOVW R2, g + BL runtime·save_g(SB) + + // set up stackguard stuff + MOVW R13, R0 + MOVW R0, g_stack+stack_hi(g) + SUB $(32*1024), R0 + MOVW R0, (g_stack+stack_lo)(g) + MOVW R0, g_stackguard0(g) + MOVW R0, g_stackguard1(g) + + // move argument into position and call function + MOVW 12(R13), R0 + MOVW R0, 4(R13) + MOVW 16(R13), R1 + BL (R1) + + // clear g + MOVW $0, g + BL runtime·save_g(SB) + + MOVW 8(R13), R0 // load return value + ADD $(m__size + g__size + 20), R13 // free locals + MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} + +GLOBL runtime·cbctxts(SB), NOPTR, $4 + +TEXT runtime·callbackasm1(SB),NOSPLIT|NOFRAME,$0 + // On entry, the trampoline in zcallback_windows_arm.s left + // the callback index in R12 (which is volatile in the C ABI). + + // Push callback register arguments r0-r3. We do this first so + // they're contiguous with stack arguments. + MOVM.DB.W [R0-R3], (R13) + // Push C callee-save registers r4-r11 and lr. + MOVM.DB.W [R4-R11, R14], (R13) + SUB $(16 + callbackArgs__size), R13 // space for locals + + // Create a struct callbackArgs on our stack. + MOVW R12, (16+callbackArgs_index)(R13) // callback index + MOVW $(16+callbackArgs__size+4*9)(R13), R0 + MOVW R0, (16+callbackArgs_args)(R13) // address of args vector + MOVW $0, R0 + MOVW R0, (16+callbackArgs_result)(R13) // result + + // Prepare for entry to Go. + BL runtime·load_g(SB) + + // Call cgocallback, which will call callbackWrap(frame). + MOVW $0, R0 + MOVW R0, 12(R13) // context + MOVW $16(R13), R1 // R1 = &callbackArgs{...} + MOVW R1, 8(R13) // frame (address of callbackArgs) + MOVW $·callbackWrap(SB), R1 + MOVW R1, 4(R13) // PC of function to call + BL runtime·cgocallback(SB) + + // Get callback result. + MOVW (16+callbackArgs_result)(R13), R0 + + ADD $(16 + callbackArgs__size), R13 // free locals + MOVM.IA.W (R13), [R4-R11, R12] // pop {r4-r11, lr=>r12} + ADD $(4*4), R13 // skip r0-r3 + B (R12) // return + +// uint32 tstart_stdcall(M *newm); +TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} + + MOVW m_g0(R0), g + MOVW R0, g_m(g) + BL runtime·save_g(SB) + + // Layout new m scheduler stack on os stack. + MOVW R13, R0 + MOVW R0, g_stack+stack_hi(g) + SUB $(64*1024), R0 + MOVW R0, (g_stack+stack_lo)(g) + MOVW R0, g_stackguard0(g) + MOVW R0, g_stackguard1(g) + + BL runtime·emptyfunc(SB) // fault if stack check is wrong + BL runtime·mstart(SB) + + // Exit the thread. + MOVW $0, R0 + MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} + +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g may be nil. +TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0-4 + MOVW dt+0(FP), R0 + MOVM.DB.W [R4, R14], (R13) // push {r4, lr} + MOVW R13, R4 // Save SP + SUB $8, R13 // R13 = R13 - 8 + BIC $0x7, R13 // Align SP for ABI + RSB $0, R0, R3 // R3 = -R0 + MOVW $0, R1 // R1 = FALSE (alertable) + MOVW $-1, R0 // R0 = handle + MOVW R13, R2 // R2 = pTime + MOVW R3, 0(R2) // time_lo + MOVW R0, 4(R2) // time_hi + MOVW runtime·_NtWaitForSingleObject(SB), R3 + BL (R3) + MOVW R4, R13 // Restore SP + MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} + +// Runs on OS stack. +// duration (in -100ns units) is in dt+0(FP). +// g is valid. +// TODO: neeeds to be implemented properly. +TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0-4 + B runtime·abort(SB) + +// Runs on OS stack. +TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R4, R14], (R13) // push {R4, lr} + MOVW R13, R4 + BIC $0x7, R13 // alignment for ABI + MOVW runtime·_SwitchToThread(SB), R0 + BL (R0) + MOVW R4, R13 // restore stack pointer + MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} + +TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 + B runtime·armPublicationBarrier(SB) + +// never called (cgo not supported) +TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 + MOVW $0xabcd, R0 + MOVW R0, (R0) + RET + +// See http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/ +// Must read hi1, then lo, then hi2. The snapshot is valid if hi1 == hi2. +#define _INTERRUPT_TIME 0x7ffe0008 +#define _SYSTEM_TIME 0x7ffe0014 +#define time_lo 0 +#define time_hi1 4 +#define time_hi2 8 + +TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8 + MOVW $0, R0 + MOVB runtime·useQPCTime(SB), R0 + CMP $0, R0 + BNE useQPC + MOVW $_INTERRUPT_TIME, R3 +loop: + MOVW time_hi1(R3), R1 + MOVW time_lo(R3), R0 + MOVW time_hi2(R3), R2 + CMP R1, R2 + BNE loop + + // wintime = R1:R0, multiply by 100 + MOVW $100, R2 + MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 + MULA R1, R2, R4, R4 + + // wintime*100 = R4:R3 + MOVW R3, ret_lo+0(FP) + MOVW R4, ret_hi+4(FP) + RET +useQPC: + B runtime·nanotimeQPC(SB) // tail call + +TEXT time·now(SB),NOSPLIT|NOFRAME,$0-20 + MOVW $0, R0 + MOVB runtime·useQPCTime(SB), R0 + CMP $0, R0 + BNE useQPC + MOVW $_INTERRUPT_TIME, R3 +loop: + MOVW time_hi1(R3), R1 + MOVW time_lo(R3), R0 + MOVW time_hi2(R3), R2 + CMP R1, R2 + BNE loop + + // wintime = R1:R0, multiply by 100 + MOVW $100, R2 + MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 + MULA R1, R2, R4, R4 + + // wintime*100 = R4:R3 + MOVW R3, mono+12(FP) + MOVW R4, mono+16(FP) + + MOVW $_SYSTEM_TIME, R3 +wall: + MOVW time_hi1(R3), R1 + MOVW time_lo(R3), R0 + MOVW time_hi2(R3), R2 + CMP R1, R2 + BNE wall + + // w = R1:R0 in 100ns untis + // convert to Unix epoch (but still 100ns units) + #define delta 116444736000000000 + SUB.S $(delta & 0xFFFFFFFF), R0 + SBC $(delta >> 32), R1 + + // Convert to nSec + MOVW $100, R2 + MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 + MULA R1, R2, R4, R4 + // w = R2:R1 in nSec + MOVW R3, R1 // R4:R3 -> R2:R1 + MOVW R4, R2 + + // multiply nanoseconds by reciprocal of 10**9 (scaled by 2**61) + // to get seconds (96 bit scaled result) + MOVW $0x89705f41, R3 // 2**61 * 10**-9 + MULLU R1,R3,(R6,R5) // R7:R6:R5 = R2:R1 * R3 + MOVW $0,R7 + MULALU R2,R3,(R7,R6) + + // unscale by discarding low 32 bits, shifting the rest by 29 + MOVW R6>>29,R6 // R7:R6 = (R7:R6:R5 >> 61) + ORR R7<<3,R6 + MOVW R7>>29,R7 + + // subtract (10**9 * sec) from nsec to get nanosecond remainder + MOVW $1000000000, R5 // 10**9 + MULLU R6,R5,(R9,R8) // R9:R8 = R7:R6 * R5 + MULA R7,R5,R9,R9 + SUB.S R8,R1 // R2:R1 -= R9:R8 + SBC R9,R2 + + // because reciprocal was a truncated repeating fraction, quotient + // may be slightly too small -- adjust to make remainder < 10**9 + CMP R5,R1 // if remainder > 10**9 + SUB.HS R5,R1 // remainder -= 10**9 + ADD.HS $1,R6 // sec += 1 + + MOVW R6,sec_lo+0(FP) + MOVW R7,sec_hi+4(FP) + MOVW R1,nsec+8(FP) + RET +useQPC: + B runtime·nowQPC(SB) // tail call + +// save_g saves the g register (R10) into thread local memory +// so that we can call externally compiled +// ARM code that will overwrite those registers. +// NOTE: runtime.gogo assumes that R1 is preserved by this function. +// runtime.mcall assumes this function only clobbers R0 and R11. +// Returns with g in R0. +// Save the value in the _TEB->TlsSlots array. +// Effectively implements TlsSetValue(). +// tls_g stores the TLS slot allocated TlsAlloc(). +TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 + MRC 15, 0, R0, C13, C0, 2 + ADD $0xe10, R0 + MOVW $runtime·tls_g(SB), R11 + MOVW (R11), R11 + MOVW g, R11<<2(R0) + MOVW g, R0 // preserve R0 across call to setg<> + RET + +// load_g loads the g register from thread-local memory, +// for use after calling externally compiled +// ARM code that overwrote those registers. +// Get the value from the _TEB->TlsSlots array. +// Effectively implements TlsGetValue(). +TEXT runtime·load_g(SB),NOSPLIT|NOFRAME,$0 + MRC 15, 0, R0, C13, C0, 2 + ADD $0xe10, R0 + MOVW $runtime·tls_g(SB), g + MOVW (g), g + MOVW g<<2(R0), g + RET + +// This is called from rt0_go, which runs on the system stack +// using the initial stack allocated by the OS. +// It calls back into standard C using the BL below. +// To do that, the stack pointer must be 8-byte-aligned. +TEXT runtime·_initcgo(SB),NOSPLIT|NOFRAME,$0 + MOVM.DB.W [R4, R14], (R13) // push {r4, lr} + + // Ensure stack is 8-byte aligned before calling C code + MOVW R13, R4 + BIC $0x7, R13 + + // Allocate a TLS slot to hold g across calls to external code + MOVW $runtime·_TlsAlloc(SB), R0 + MOVW (R0), R0 + BL (R0) + + // Assert that slot is less than 64 so we can use _TEB->TlsSlots + CMP $64, R0 + MOVW $runtime·abort(SB), R1 + BL.GE (R1) + + // Save Slot into tls_g + MOVW $runtime·tls_g(SB), R1 + MOVW R0, (R1) + + MOVW R4, R13 + MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} + +// Holds the TLS Slot, which was allocated by TlsAlloc() +GLOBL runtime·tls_g+0(SB), NOPTR, $4 + +#endif -- cgit v1.3-5-g9baa From c7c6c113be96b7b68f54696d2986f98dc9df64d6 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 1 Feb 2021 15:12:08 -0500 Subject: runtime: convert windows/arm64 assembly The assembly is mostly a straightforward conversion of the equivalent arm assembly. This CL is part of a stack adding windows/arm64 support (#36439), intended to land in the Go 1.17 cycle. Change-Id: I61b15d712ade4d3a7285c7680de8e0987aacba10 Reviewed-on: https://go-review.googlesource.com/c/go/+/288828 Trust: Russ Cox Trust: Jason A. Donenfeld Reviewed-by: Cherry Zhang --- src/runtime/asm_arm64.s | 7 + src/runtime/defs_windows.go | 1 + src/runtime/memclr_arm.s | 1 + src/runtime/memclr_arm64.s | 1 + src/runtime/os_windows.go | 3 + src/runtime/signal_windows.go | 1 + src/runtime/stubs_arm64.go | 2 + src/runtime/sys_windows_arm.s | 18 +- src/runtime/sys_windows_arm64.s | 807 ++++++++++++++++++++-------------------- src/runtime/syscall_windows.go | 1 + src/runtime/tls_arm64.h | 12 +- src/runtime/tls_arm64.s | 8 +- 12 files changed, 441 insertions(+), 421 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index d81759537e..699fc99d58 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -73,6 +73,10 @@ nocgo: BL runtime·check(SB) +#ifdef GOOS_windows + BL runtime·wintls(SB) +#endif + MOVW 8(RSP), R0 // copy argc MOVW R0, -8(RSP) MOVD 16(RSP), R0 // copy argv @@ -1111,6 +1115,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$8 MOVD savedR27-8(SP), R27 RET +TEXT runtime·emptyfunc(SB),0,$0-0 + RET + TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0 MOVD ZR, R0 MOVD (R0), R0 diff --git a/src/runtime/defs_windows.go b/src/runtime/defs_windows.go index 656fd2b8b6..8d4e38120e 100644 --- a/src/runtime/defs_windows.go +++ b/src/runtime/defs_windows.go @@ -28,6 +28,7 @@ const ( _EXCEPTION_ACCESS_VIOLATION = 0xc0000005 _EXCEPTION_BREAKPOINT = 0x80000003 + _EXCEPTION_ILLEGAL_INSTRUCTION = 0xc000001d _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f diff --git a/src/runtime/memclr_arm.s b/src/runtime/memclr_arm.s index f113a1aa2d..f02d058ead 100644 --- a/src/runtime/memclr_arm.s +++ b/src/runtime/memclr_arm.s @@ -33,6 +33,7 @@ // See memclrNoHeapPointers Go doc for important implementation constraints. // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) +// Also called from assembly in sys_windows_arm.s without g (but using Go stack convention). TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8 MOVW ptr+0(FP), TO MOVW n+4(FP), N diff --git a/src/runtime/memclr_arm64.s b/src/runtime/memclr_arm64.s index bef77651e4..c1a0dcef58 100644 --- a/src/runtime/memclr_arm64.s +++ b/src/runtime/memclr_arm64.s @@ -7,6 +7,7 @@ // See memclrNoHeapPointers Go doc for important implementation constraints. // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) +// Also called from assembly in sys_windows_arm64.s without g (but using Go stack convention). TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 MOVD ptr+0(FP), R0 MOVD n+8(FP), R1 diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go index 375c34ed99..f4e21a93ed 100644 --- a/src/runtime/os_windows.go +++ b/src/runtime/os_windows.go @@ -148,6 +148,9 @@ func tstart_stdcall(newm *m) // Called by OS using stdcall ABI. func ctrlhandler() +// Init-time helper +func wintls() + type mOS struct { threadLock mutex // protects "thread" and prevents closing thread uintptr // thread handle diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go index cb1fbe9f81..6215d0ba2d 100644 --- a/src/runtime/signal_windows.go +++ b/src/runtime/signal_windows.go @@ -81,6 +81,7 @@ func isgoexception(info *exceptionrecord, r *context) bool { case _EXCEPTION_FLT_OVERFLOW: case _EXCEPTION_FLT_UNDERFLOW: case _EXCEPTION_BREAKPOINT: + case _EXCEPTION_ILLEGAL_INSTRUCTION: // breakpoint arrives this way on arm64 } return true } diff --git a/src/runtime/stubs_arm64.go b/src/runtime/stubs_arm64.go index 6e6e7df6b8..f5e3bb4854 100644 --- a/src/runtime/stubs_arm64.go +++ b/src/runtime/stubs_arm64.go @@ -12,3 +12,5 @@ func save_g() //go:noescape func asmcgocall_no_g(fn, arg unsafe.Pointer) + +func emptyfunc() diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s index 3f01714c66..cd230ccffd 100644 --- a/src/runtime/sys_windows_arm.s +++ b/src/runtime/sys_windows_arm.s @@ -176,17 +176,17 @@ done: BEQ return // Check if we need to set up the control flow guard workaround. - // On Windows/ARM, the stack pointer must lie within system - // stack limits when we resume from exception. + // On Windows, the stack pointer in the context must lie within + // system stack limits when we resume from exception. // Store the resume SP and PC on the g0 stack, - // and return to returntramp on the g0 stack. returntramp + // and return to sigresume on the g0 stack. sigresume // pops the saved PC and SP from the g0 stack, resuming execution // at the desired location. - // If returntramp has already been set up by a previous exception + // If sigresume has already been set up by a previous exception // handler, don't clobber the stored SP and PC on the stack. MOVW 4(R3), R3 // PEXCEPTION_POINTERS->Context MOVW context_pc(R3), R2 // load PC from context record - MOVW $returntramp<>(SB), R1 + MOVW $sigresume<>(SB), R1 CMP R1, R2 B.EQ return // do not clobber saved SP/PC @@ -196,9 +196,9 @@ done: MOVW context_pc(R3), R2 MOVW R2, context_r1(R3) - // Set up context record to return to returntramp on g0 stack + // Set up context record to return to sigresume on g0 stack MOVW R12, context_spr(R3) - MOVW $returntramp<>(SB), R2 + MOVW $sigresume<>(SB), R2 MOVW R2, context_pc(R3) return: @@ -208,8 +208,8 @@ return: // This is part of the control flow guard workaround. // It switches stacks and jumps to the continuation address. // R0 and R1 are set above at the end of sigtramp<> -// in the context that starts executing at returntramp<>. -TEXT returntramp<>(SB),NOSPLIT|NOFRAME,$0 +// in the context that starts executing at sigresume<>. +TEXT sigresume<>(SB),NOSPLIT|NOFRAME,$0 // Important: do not smash LR, // which is set to a live value when handling // a signal by pushing a call to sigpanic onto the stack. diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s index b279f25de8..53960488f9 100644 --- a/src/runtime/sys_windows_arm64.s +++ b/src/runtime/sys_windows_arm64.s @@ -5,108 +5,150 @@ #include "go_asm.h" #include "go_tls.h" #include "textflag.h" +#include "funcdata.h" -#ifdef NOT_PORTED +// Offsets into Thread Environment Block (pointer in R18) +#define TEB_error 0x68 +#define TEB_TlsSlots 0x1480 -// Note: For system ABI, R0-R3 are args, R4-R11 are callee-save. +// Note: R0-R7 are args, R8 is indirect return value address, +// R9-R15 are caller-save, R19-R29 are callee-save. +// +// load_g and save_g (in tls_arm64.s) clobber R27 (REGTMP) and R0. // void runtime·asmstdcall(void *c); TEXT runtime·asmstdcall(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R4, R5, R14], (R13) // push {r4, r5, lr} - MOVW R0, R4 // put libcall * in r4 - MOVW R13, R5 // save stack pointer in r5 + STP.W (R29, R30), -32(RSP) // allocate C ABI stack frame + STP (R19, R20), 16(RSP) // save old R19, R20 + MOVD R0, R19 // save libcall pointer + MOVD RSP, R20 // save stack pointer // SetLastError(0) - MOVW $0, R0 - MRC 15, 0, R1, C13, C0, 2 - MOVW R0, 0x34(R1) - - MOVW 8(R4), R12 // libcall->args - - // Do we have more than 4 arguments? - MOVW 4(R4), R0 // libcall->n - SUB.S $4, R0, R2 - BLE loadregs + MOVD $0, TEB_error(R18_PLATFORM) + MOVD libcall_args(R19), R12 // libcall->args + + // Do we have more than 8 arguments? + MOVD libcall_n(R19), R0 + CMP $0, R0; BEQ _0args + CMP $1, R0; BEQ _1args + CMP $2, R0; BEQ _2args + CMP $3, R0; BEQ _3args + CMP $4, R0; BEQ _4args + CMP $5, R0; BEQ _5args + CMP $6, R0; BEQ _6args + CMP $7, R0; BEQ _7args + CMP $8, R0; BEQ _8args // Reserve stack space for remaining args - SUB R2<<2, R13 - BIC $0x7, R13 // alignment for ABI - - // R0: count of arguments - // R1: - // R2: loop counter, from 0 to (n-4) - // R3: scratch - // R4: pointer to libcall struct - // R12: libcall->args - MOVW $0, R2 + SUB $8, R0, R2 + ADD $1, R2, R3 // make even number of words for stack alignment + AND $~1, R3 + LSL $3, R3 + SUB R3, RSP + + // R4: size of stack arguments (n-8)*8 + // R5: &args[8] + // R6: loop counter, from 0 to (n-8)*8 + // R7: scratch + // R8: copy of RSP - (R2)(RSP) assembles as (R2)(ZR) + SUB $8, R0, R4 + LSL $3, R4 + ADD $(8*8), R12, R5 + MOVD $0, R6 + MOVD RSP, R8 stackargs: - ADD $4, R2, R3 // r3 = args[4 + i] - MOVW R3<<2(R12), R3 - MOVW R3, R2<<2(R13) // stack[i] = r3 - - ADD $1, R2 // i++ - SUB $4, R0, R3 // while (i < (n - 4)) - CMP R3, R2 - BLT stackargs - -loadregs: - CMP $3, R0 - MOVW.GT 12(R12), R3 - - CMP $2, R0 - MOVW.GT 8(R12), R2 - - CMP $1, R0 - MOVW.GT 4(R12), R1 - - CMP $0, R0 - MOVW.GT 0(R12), R0 - - BIC $0x7, R13 // alignment for ABI - MOVW 0(R4), R12 // branch to libcall->fn + MOVD (R6)(R5), R7 + MOVD R7, (R6)(R8) + ADD $8, R6 + CMP R6, R4 + BNE stackargs + +_8args: + MOVD (7*8)(R12), R7 +_7args: + MOVD (6*8)(R12), R6 +_6args: + MOVD (5*8)(R12), R5 +_5args: + MOVD (4*8)(R12), R4 +_4args: + MOVD (3*8)(R12), R3 +_3args: + MOVD (2*8)(R12), R2 +_2args: + MOVD (1*8)(R12), R1 +_1args: + MOVD (0*8)(R12), R0 +_0args: + + MOVD libcall_fn(R19), R12 // branch to libcall->fn BL (R12) - MOVW R5, R13 // free stack space - MOVW R0, 12(R4) // save return value to libcall->r1 - MOVW R1, 16(R4) + MOVD R20, RSP // free stack space + MOVD R0, libcall_r1(R19) // save return value to libcall->r1 + // TODO(rsc) floating point like amd64 in libcall->r2? // GetLastError - MRC 15, 0, R1, C13, C0, 2 - MOVW 0x34(R1), R0 - MOVW R0, 20(R4) // store in libcall->err + MOVD TEB_error(R18_PLATFORM), R0 + MOVD R0, libcall_err(R19) - MOVM.IA.W (R13), [R4, R5, R15] + // Restore callee-saved registers. + LDP 16(RSP), (R19, R20) + LDP.P 32(RSP), (R29, R30) + RET -TEXT runtime·badsignal2(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R4, R14], (R13) // push {r4, lr} - MOVW R13, R4 // save original stack pointer - SUB $8, R13 // space for 2 variables - BIC $0x7, R13 // alignment for ABI +TEXT runtime·badsignal2(SB),NOSPLIT,$16-0 + NO_LOCAL_POINTERS // stderr - MOVW runtime·_GetStdHandle(SB), R1 - MOVW $-12, R0 + MOVD runtime·_GetStdHandle(SB), R1 + MOVD $-12, R0 + SUB $16, RSP // skip over saved frame pointer below RSP BL (R1) - - MOVW $runtime·badsignalmsg(SB), R1 // lpBuffer - MOVW $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite - MOVW (R2), R2 - ADD $0x4, R13, R3 // lpNumberOfBytesWritten - MOVW $0, R12 // lpOverlapped - MOVW R12, (R13) - - MOVW runtime·_WriteFile(SB), R12 + ADD $16, RSP + + // handle in R0 already + MOVD $runtime·badsignalmsg(SB), R1 // lpBuffer + MOVD $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite + MOVD (R2), R2 + MOVD R13, R3 // lpNumberOfBytesWritten + MOVD $0, R4 // lpOverlapped + MOVD runtime·_WriteFile(SB), R12 + SUB $16, RSP // skip over saved frame pointer below RSP BL (R12) + ADD $16, RSP - MOVW R4, R13 // restore SP - MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} + RET -TEXT runtime·getlasterror(SB),NOSPLIT,$0 - MRC 15, 0, R0, C13, C0, 2 - MOVW 0x34(R0), R0 - MOVW R0, ret+0(FP) +TEXT runtime·getlasterror(SB),NOSPLIT|NOFRAME,$0 + MOVD TEB_error(R18_PLATFORM), R0 + MOVD R0, ret+0(FP) RET +#define SAVE_R19_TO_R28(offset) \ + MOVD R19, savedR19+((offset)+0*8)(SP); \ + MOVD R20, savedR20+((offset)+1*8)(SP); \ + MOVD R21, savedR21+((offset)+2*8)(SP); \ + MOVD R22, savedR22+((offset)+3*8)(SP); \ + MOVD R23, savedR23+((offset)+4*8)(SP); \ + MOVD R24, savedR24+((offset)+5*8)(SP); \ + MOVD R25, savedR25+((offset)+6*8)(SP); \ + MOVD R26, savedR26+((offset)+7*8)(SP); \ + MOVD R27, savedR27+((offset)+8*8)(SP); \ + MOVD g, savedR28+((offset)+9*8)(SP); + +#define RESTORE_R19_TO_R28(offset) \ + MOVD savedR19+((offset)+0*8)(SP), R19; \ + MOVD savedR20+((offset)+1*8)(SP), R20; \ + MOVD savedR21+((offset)+2*8)(SP), R21; \ + MOVD savedR22+((offset)+3*8)(SP), R22; \ + MOVD savedR23+((offset)+4*8)(SP), R23; \ + MOVD savedR24+((offset)+5*8)(SP), R24; \ + MOVD savedR25+((offset)+6*8)(SP), R25; \ + MOVD savedR26+((offset)+7*8)(SP), R26; \ + MOVD savedR27+((offset)+8*8)(SP), R27; \ + MOVD savedR28+((offset)+9*8)(SP), g; /* R28 */ + // Called by Windows as a Vectored Exception Handler (VEH). // First argument is pointer to struct containing // exception record and context pointers. @@ -116,61 +158,83 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0 // PEXCEPTION_POINTERS ExceptionInfo, // func *GoExceptionHandler); TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R0, R4-R11, R14], (R13) // push {r0, r4-r11, lr} (SP-=40) - SUB $(8+20), R13 // reserve space for g, sp, and - // parameters/retval to go call + // Save R0, R1 (args) as well as LR, R27, R28 (callee-save). + MOVD R0, R5 + MOVD R1, R6 + MOVD LR, R7 + MOVD R27, R16 // saved R27 (callee-save) + MOVD g, R17 // saved R28 (callee-save from Windows, not really g) + + BL runtime·load_g(SB) // smashes R0, R27, R28 (g) + CMP $0, g // is there a current g? + BNE 2(PC) + BL runtime·badsignal2(SB) + + // Do we need to switch to the g0 stack? + MOVD g, R3 // R3 = oldg (for sigtramp_g0) + MOVD g_m(g), R2 // R2 = m + MOVD m_g0(R2), R2 // R2 = g0 + CMP g, R2 // if curg == g0 + BNE switch + + // No: on g0 stack already, tail call to sigtramp_g0. + // Restore all the callee-saves so sigtramp_g0 can return to our caller. + // We also pass R2 = g0, R3 = oldg, both set above. + MOVD R5, R0 + MOVD R6, R1 + MOVD R7, LR + MOVD R16, R27 // restore R27 + MOVD R17, g // restore R28 + B sigtramp_g0<>(SB) + +switch: + // switch to g0 stack (but do not update g - that's sigtramp_g0's job) + MOVD RSP, R8 + MOVD (g_sched+gobuf_sp)(R2), R4 // R4 = g->gobuf.sp + SUB $(6*8), R4 // alloc space for saves - 2 words below SP for frame pointer, 3 for us to use, 1 for alignment + MOVD R4, RSP // switch to g0 stack + + MOVD $0, (0*8)(RSP) // fake saved LR + MOVD R7, (1*8)(RSP) // saved LR + MOVD R8, (2*8)(RSP) // saved SP + + MOVD R5, R0 // original args + MOVD R6, R1 // original args + MOVD R16, R27 + MOVD R17, g // R28 + BL sigtramp_g0<>(SB) + + // switch back to original stack; g already updated + MOVD (1*8)(RSP), R7 // saved LR + MOVD (2*8)(RSP), R8 // saved SP + MOVD R7, LR + MOVD R8, RSP + RET - MOVW R0, R6 // Save param0 - MOVW R1, R7 // Save param1 +// sigtramp_g0 is running on the g0 stack, with R2 = g0, R3 = oldg. +// But g itself is not set - that's R28, a callee-save register, +// and it still holds the value from the Windows DLL caller. +TEXT sigtramp_g0<>(SB),NOSPLIT,$128 + NO_LOCAL_POINTERS - BL runtime·load_g(SB) - CMP $0, g // is there a current g? - BL.EQ runtime·badsignal2(SB) - - // save g and SP in case of stack switch - MOVW R13, 24(R13) - MOVW g, 20(R13) - - // do we need to switch to the g0 stack? - MOVW g, R5 // R5 = g - MOVW g_m(R5), R2 // R2 = m - MOVW m_g0(R2), R4 // R4 = g0 - CMP R5, R4 // if curg == g0 - BEQ g0 - - // switch to g0 stack - MOVW R4, g // g = g0 - MOVW (g_sched+gobuf_sp)(g), R3 // R3 = g->gobuf.sp - BL runtime·save_g(SB) - - // make room for sighandler arguments - // and re-save old SP for restoring later. - // (note that the 24(R3) here must match the 24(R13) above.) - SUB $40, R3 - MOVW R13, 24(R3) // save old stack pointer - MOVW R3, R13 // switch stack - -g0: - MOVW 0(R6), R2 // R2 = ExceptionPointers->ExceptionRecord - MOVW 4(R6), R3 // R3 = ExceptionPointers->ContextRecord - - MOVW $0, R4 - MOVW R4, 0(R13) // No saved link register. - MOVW R2, 4(R13) // Move arg0 (ExceptionRecord) into position - MOVW R3, 8(R13) // Move arg1 (ContextRecord) into position - MOVW R5, 12(R13) // Move arg2 (original g) into position - BL (R7) // Call the go routine - MOVW 16(R13), R4 // Fetch return value from stack - - // switch back to original stack and g - MOVW 24(R13), R13 - MOVW 20(R13), g - BL runtime·save_g(SB) - -done: - MOVW R4, R0 // move retval into position - ADD $(8 + 20), R13 // free locals - MOVM.IA.W (R13), [R3, R4-R11, R14] // pop {r3, r4-r11, lr} + // Push C callee-save registers R19-R28. LR, FP already saved. + SAVE_R19_TO_R28(-10*8) + + MOVD 0(R0), R5 // R5 = ExceptionPointers->ExceptionRecord + MOVD 8(R0), R6 // R6 = ExceptionPointers->ContextRecord + MOVD R6, context-(11*8)(SP) + + MOVD R2, g // g0 + BL runtime·save_g(SB) // smashes R0 + + MOVD R5, (1*8)(RSP) // arg0 (ExceptionRecord) + MOVD R6, (2*8)(RSP) // arg1 (ContextRecord) + MOVD R3, (3*8)(RSP) // arg2 (original g) + MOVD R3, oldg-(12*8)(SP) + BL (R1) + MOVD oldg-(12*8)(SP), g + BL runtime·save_g(SB) // smashes R0 + MOVW (4*8)(RSP), R0 // return value (0 or -1) // if return value is CONTINUE_SEARCH, do not set up control // flow guard workaround @@ -178,240 +242,232 @@ done: BEQ return // Check if we need to set up the control flow guard workaround. - // On Windows/ARM, the stack pointer must lie within system - // stack limits when we resume from exception. - // Store the resume SP and PC on the g0 stack, - // and return to returntramp on the g0 stack. returntramp - // pops the saved PC and SP from the g0 stack, resuming execution - // at the desired location. - // If returntramp has already been set up by a previous exception - // handler, don't clobber the stored SP and PC on the stack. - MOVW 4(R3), R3 // PEXCEPTION_POINTERS->Context - MOVW context_pc(R3), R2 // load PC from context record - MOVW $returntramp<>(SB), R1 + // On Windows, the stack pointer in the context must lie within + // system stack limits when we resume from exception. + // Store the resume SP and PC in alternate registers + // and return to sigresume on the g0 stack. + // sigresume makes no use of the stack at all, + // loading SP from R0 and jumping to R1. + // Note that smashing R0 and R1 is only safe because we know sigpanic + // will not actually return to the original frame, so the registers + // are effectively dead. But this does mean we can't use the + // same mechanism for async preemption. + MOVD context-(11*8)(SP), R6 + MOVD context_pc(R6), R2 // load PC from context record + MOVD $sigresume<>(SB), R1 + CMP R1, R2 - B.EQ return // do not clobber saved SP/PC + BEQ return // do not clobber saved SP/PC // Save resume SP and PC into R0, R1. - MOVW context_spr(R3), R2 - MOVW R2, context_r0(R3) - MOVW context_pc(R3), R2 - MOVW R2, context_r1(R3) + MOVD context_xsp(R6), R2 + MOVD R2, (context_x+0*8)(R6) + MOVD context_pc(R6), R2 + MOVD R2, (context_x+1*8)(R6) - // Set up context record to return to returntramp on g0 stack - MOVW R12, context_spr(R3) - MOVW $returntramp<>(SB), R2 - MOVW R2, context_pc(R3) + // Set up context record to return to sigresume on g0 stack + MOVD RSP, R2 + MOVD R2, context_xsp(R6) + MOVD $sigresume<>(SB), R2 + MOVD R2, context_pc(R6) return: - B (R14) // return + RESTORE_R19_TO_R28(-10*8) // smashes g + RET // Trampoline to resume execution from exception handler. // This is part of the control flow guard workaround. // It switches stacks and jumps to the continuation address. // R0 and R1 are set above at the end of sigtramp<> -// in the context that starts executing at returntramp<>. -TEXT returntramp<>(SB),NOSPLIT|NOFRAME,$0 +// in the context that starts executing at sigresume<>. +TEXT sigresume<>(SB),NOSPLIT|NOFRAME,$0 // Important: do not smash LR, // which is set to a live value when handling // a signal by pushing a call to sigpanic onto the stack. - MOVW R0, R13 + MOVD R0, RSP B (R1) TEXT runtime·exceptiontramp(SB),NOSPLIT|NOFRAME,$0 - MOVW $runtime·exceptionhandler(SB), R1 + MOVD $runtime·exceptionhandler(SB), R1 B sigtramp<>(SB) TEXT runtime·firstcontinuetramp(SB),NOSPLIT|NOFRAME,$0 - MOVW $runtime·firstcontinuehandler(SB), R1 + MOVD $runtime·firstcontinuehandler(SB), R1 B sigtramp<>(SB) TEXT runtime·lastcontinuetramp(SB),NOSPLIT|NOFRAME,$0 - MOVW $runtime·lastcontinuehandler(SB), R1 + MOVD $runtime·lastcontinuehandler(SB), R1 B sigtramp<>(SB) TEXT runtime·ctrlhandler(SB),NOSPLIT|NOFRAME,$0 - MOVW $runtime·ctrlhandler1(SB), R1 + MOVD $runtime·ctrlhandler1(SB), R1 B runtime·externalthreadhandler(SB) TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0 - MOVW $runtime·profileloop1(SB), R1 + MOVD $runtime·profileloop1(SB), R1 B runtime·externalthreadhandler(SB) -// int32 externalthreadhandler(uint32 arg, int (*func)(uint32)) -// stack layout: -// +----------------+ -// | callee-save | -// | registers | -// +----------------+ -// | m | -// +----------------+ -// 20| g | -// +----------------+ -// 16| func ptr (r1) | -// +----------------+ -// 12| argument (r0) | -//---+----------------+ -// 8 | param1 | (also return value for called Go function) -// +----------------+ -// 4 | param0 | -// +----------------+ -// 0 | slot for LR | -// +----------------+ -// -TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0 - MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} - SUB $(m__size + g__size + 20), R13 // space for locals - MOVW R14, 0(R13) // push LR again for anything unwinding the stack - MOVW R0, 12(R13) - MOVW R1, 16(R13) - - // zero out m and g structures - ADD $20, R13, R0 // compute pointer to g - MOVW R0, 4(R13) - MOVW $(m__size + g__size), R0 - MOVW R0, 8(R13) +// externalthreadhander called with R0 = uint32 arg, R1 = Go function f. +// Need to call f(arg), which returns a uint32, and return it in R0. +TEXT runtime·externalthreadhandler(SB),NOSPLIT|TOPFRAME,$96-0 + NO_LOCAL_POINTERS + + // Push C callee-save registers R19-R28. LR, FP already saved. + SAVE_R19_TO_R28(-10*8) + + // Allocate space for args, saved R0+R1, g, and m structures. + // Hide from nosplit check. + #define extra ((64+g__size+m__size+15)&~15) + SUB $extra, RSP, R2 // hide from nosplit overflow check + MOVD R2, RSP + + // Save R0 and R1 (our args). + MOVD R0, 32(RSP) + MOVD R1, 40(RSP) + + // Zero out m and g structures. + MOVD $64(RSP), R0 + MOVD R0, 8(RSP) + MOVD $(m__size + g__size), R0 + MOVD R0, 16(RSP) + MOVD $0, 0(RSP) // not-saved LR BL runtime·memclrNoHeapPointers(SB) - // initialize m and g structures - ADD $20, R13, R2 // R2 = g - ADD $(20 + g__size), R13, R3 // R3 = m - MOVW R2, m_g0(R3) // m->g0 = g - MOVW R3, g_m(R2) // g->m = m - MOVW R2, m_curg(R3) // m->curg = g - - MOVW R2, g + // Initialize m and g structures. + MOVD $64(RSP), g + MOVD $g__size(g), R3 // m + MOVD R3, g_m(g) // g->m = m + MOVD g, m_g0(R3) // m->g0 = g + MOVD g, m_curg(R3) // m->curg = g + MOVD RSP, R0 + MOVD R0, g_stack+stack_hi(g) + SUB $(32*1024), R0 + MOVD R0, (g_stack+stack_lo)(g) + MOVD R0, g_stackguard0(g) + MOVD R0, g_stackguard1(g) BL runtime·save_g(SB) - // set up stackguard stuff - MOVW R13, R0 - MOVW R0, g_stack+stack_hi(g) - SUB $(32*1024), R0 - MOVW R0, (g_stack+stack_lo)(g) - MOVW R0, g_stackguard0(g) - MOVW R0, g_stackguard1(g) - - // move argument into position and call function - MOVW 12(R13), R0 - MOVW R0, 4(R13) - MOVW 16(R13), R1 + // Call function. + MOVD 32(RSP), R0 + MOVD 40(RSP), R1 + MOVW R0, 8(RSP) BL (R1) - // clear g - MOVW $0, g + // Clear g. + MOVD $0, g BL runtime·save_g(SB) - MOVW 8(R13), R0 // load return value - ADD $(m__size + g__size + 20), R13 // free locals - MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} + // Load return value (save_g would have smashed) + MOVW (2*8)(RSP), R0 + + ADD $extra, RSP, R2 + MOVD R2, RSP + #undef extra + + RESTORE_R19_TO_R28(-10*8) + RET GLOBL runtime·cbctxts(SB), NOPTR, $4 -TEXT runtime·callbackasm1(SB),NOSPLIT|NOFRAME,$0 - // On entry, the trampoline in zcallback_windows_arm.s left +TEXT runtime·callbackasm1(SB),NOSPLIT,$208-0 + NO_LOCAL_POINTERS + + // On entry, the trampoline in zcallback_windows_arm64.s left // the callback index in R12 (which is volatile in the C ABI). - // Push callback register arguments r0-r3. We do this first so - // they're contiguous with stack arguments. - MOVM.DB.W [R0-R3], (R13) - // Push C callee-save registers r4-r11 and lr. - MOVM.DB.W [R4-R11, R14], (R13) - SUB $(16 + callbackArgs__size), R13 // space for locals + // Save callback register arguments R0-R7. + // We do this at the top of the frame so they're contiguous with stack arguments. + MOVD R0, arg0-(8*8)(SP) + MOVD R1, arg1-(7*8)(SP) + MOVD R2, arg2-(6*8)(SP) + MOVD R3, arg3-(5*8)(SP) + MOVD R4, arg4-(4*8)(SP) + MOVD R5, arg5-(3*8)(SP) + MOVD R6, arg6-(2*8)(SP) + MOVD R7, arg7-(1*8)(SP) + + // Push C callee-save registers R19-R28. + // LR, FP already saved. + SAVE_R19_TO_R28(-18*8) // Create a struct callbackArgs on our stack. - MOVW R12, (16+callbackArgs_index)(R13) // callback index - MOVW $(16+callbackArgs__size+4*9)(R13), R0 - MOVW R0, (16+callbackArgs_args)(R13) // address of args vector - MOVW $0, R0 - MOVW R0, (16+callbackArgs_result)(R13) // result - - // Prepare for entry to Go. - BL runtime·load_g(SB) + MOVD $cbargs-(18*8+callbackArgs__size)(SP), R13 + MOVD R12, callbackArgs_index(R13) // callback index + MOVD $arg0-(8*8)(SP), R0 + MOVD R0, callbackArgs_args(R13) // address of args vector + MOVD $0, R0 + MOVD R0, callbackArgs_result(R13) // result // Call cgocallback, which will call callbackWrap(frame). - MOVW $0, R0 - MOVW R0, 12(R13) // context - MOVW $16(R13), R1 // R1 = &callbackArgs{...} - MOVW R1, 8(R13) // frame (address of callbackArgs) - MOVW $·callbackWrap(SB), R1 - MOVW R1, 4(R13) // PC of function to call + MOVD $·callbackWrap(SB), R0 // PC of function to call + MOVD R13, R1 // frame (&callbackArgs{...}) + MOVD $0, R2 // context + MOVD R0, (1*8)(RSP) + MOVD R1, (2*8)(RSP) + MOVD R2, (3*8)(RSP) BL runtime·cgocallback(SB) // Get callback result. - MOVW (16+callbackArgs_result)(R13), R0 + MOVD $cbargs-(18*8+callbackArgs__size)(SP), R13 + MOVD callbackArgs_result(R13), R0 - ADD $(16 + callbackArgs__size), R13 // free locals - MOVM.IA.W (R13), [R4-R11, R12] // pop {r4-r11, lr=>r12} - ADD $(4*4), R13 // skip r0-r3 - B (R12) // return + RESTORE_R19_TO_R28(-18*8) + + RET // uint32 tstart_stdcall(M *newm); -TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr} +TEXT runtime·tstart_stdcall(SB),NOSPLIT,$96-0 + SAVE_R19_TO_R28(-10*8) - MOVW m_g0(R0), g - MOVW R0, g_m(g) + MOVD m_g0(R0), g + MOVD R0, g_m(g) BL runtime·save_g(SB) - // Layout new m scheduler stack on os stack. - MOVW R13, R0 - MOVW R0, g_stack+stack_hi(g) + // Set up stack guards for OS stack. + MOVD RSP, R0 + MOVD R0, g_stack+stack_hi(g) SUB $(64*1024), R0 - MOVW R0, (g_stack+stack_lo)(g) - MOVW R0, g_stackguard0(g) - MOVW R0, g_stackguard1(g) + MOVD R0, (g_stack+stack_lo)(g) + MOVD R0, g_stackguard0(g) + MOVD R0, g_stackguard1(g) BL runtime·emptyfunc(SB) // fault if stack check is wrong BL runtime·mstart(SB) + RESTORE_R19_TO_R28(-10*8) + // Exit the thread. - MOVW $0, R0 - MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc} + MOVD $0, R0 + RET // Runs on OS stack. // duration (in -100ns units) is in dt+0(FP). // g may be nil. -TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0-4 +TEXT runtime·usleep2(SB),NOSPLIT,$32-4 MOVW dt+0(FP), R0 - MOVM.DB.W [R4, R14], (R13) // push {r4, lr} - MOVW R13, R4 // Save SP - SUB $8, R13 // R13 = R13 - 8 - BIC $0x7, R13 // Align SP for ABI - RSB $0, R0, R3 // R3 = -R0 - MOVW $0, R1 // R1 = FALSE (alertable) - MOVW $-1, R0 // R0 = handle - MOVW R13, R2 // R2 = pTime - MOVW R3, 0(R2) // time_lo - MOVW R0, 4(R2) // time_hi - MOVW runtime·_NtWaitForSingleObject(SB), R3 + MOVD $16(RSP), R2 // R2 = pTime + MOVD R0, 0(R2) // *pTime = -dt + MOVD $-1, R0 // R0 = handle + MOVD $0, R1 // R1 = FALSE (alertable) + MOVD runtime·_NtWaitForSingleObject(SB), R3 + SUB $16, RSP // skip over saved frame pointer below RSP BL (R3) - MOVW R4, R13 // Restore SP - MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} + ADD $16, RSP + RET // Runs on OS stack. // duration (in -100ns units) is in dt+0(FP). // g is valid. // TODO: neeeds to be implemented properly. -TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0-4 +TEXT runtime·usleep2HighRes(SB),NOSPLIT,$0-4 B runtime·abort(SB) // Runs on OS stack. -TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R4, R14], (R13) // push {R4, lr} - MOVW R13, R4 - BIC $0x7, R13 // alignment for ABI - MOVW runtime·_SwitchToThread(SB), R0 +TEXT runtime·switchtothread(SB),NOSPLIT,$16-0 + MOVD runtime·_SwitchToThread(SB), R0 + SUB $16, RSP // skip over saved frame pointer below RSP BL (R0) - MOVW R4, R13 // restore stack pointer - MOVM.IA.W (R13), [R4, R15] // pop {R4, pc} - -TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 - B runtime·armPublicationBarrier(SB) - -// never called (cgo not supported) -TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 - MOVW $0xabcd, R0 - MOVW R0, (R0) + ADD $16, RSP RET // See http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/ @@ -423,166 +479,101 @@ TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 #define time_hi2 8 TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8 - MOVW $0, R0 MOVB runtime·useQPCTime(SB), R0 CMP $0, R0 BNE useQPC - MOVW $_INTERRUPT_TIME, R3 + MOVD $_INTERRUPT_TIME, R3 loop: - MOVW time_hi1(R3), R1 - MOVW time_lo(R3), R0 - MOVW time_hi2(R3), R2 + MOVWU time_hi1(R3), R1 + MOVWU time_lo(R3), R0 + MOVWU time_hi2(R3), R2 CMP R1, R2 BNE loop // wintime = R1:R0, multiply by 100 - MOVW $100, R2 - MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 - MULA R1, R2, R4, R4 - - // wintime*100 = R4:R3 - MOVW R3, ret_lo+0(FP) - MOVW R4, ret_hi+4(FP) + ORR R1<<32, R0 + MOVD $100, R1 + MUL R1, R0 + MOVD R0, ret+0(FP) RET useQPC: B runtime·nanotimeQPC(SB) // tail call -TEXT time·now(SB),NOSPLIT|NOFRAME,$0-20 - MOVW $0, R0 +TEXT time·now(SB),NOSPLIT|NOFRAME,$0-24 MOVB runtime·useQPCTime(SB), R0 CMP $0, R0 BNE useQPC - MOVW $_INTERRUPT_TIME, R3 + MOVD $_INTERRUPT_TIME, R3 loop: - MOVW time_hi1(R3), R1 - MOVW time_lo(R3), R0 - MOVW time_hi2(R3), R2 + MOVWU time_hi1(R3), R1 + MOVWU time_lo(R3), R0 + MOVWU time_hi2(R3), R2 CMP R1, R2 BNE loop // wintime = R1:R0, multiply by 100 - MOVW $100, R2 - MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 - MULA R1, R2, R4, R4 - - // wintime*100 = R4:R3 - MOVW R3, mono+12(FP) - MOVW R4, mono+16(FP) + ORR R1<<32, R0 + MOVD $100, R1 + MUL R1, R0 + MOVD R0, mono+16(FP) - MOVW $_SYSTEM_TIME, R3 + MOVD $_SYSTEM_TIME, R3 wall: - MOVW time_hi1(R3), R1 - MOVW time_lo(R3), R0 - MOVW time_hi2(R3), R2 + MOVWU time_hi1(R3), R1 + MOVWU time_lo(R3), R0 + MOVWU time_hi2(R3), R2 CMP R1, R2 BNE wall - // w = R1:R0 in 100ns untis + // w = R1:R0 in 100ns units // convert to Unix epoch (but still 100ns units) #define delta 116444736000000000 - SUB.S $(delta & 0xFFFFFFFF), R0 - SBC $(delta >> 32), R1 + ORR R1<<32, R0 + SUB $delta, R0 // Convert to nSec - MOVW $100, R2 - MULLU R0, R2, (R4, R3) // R4:R3 = R1:R0 * R2 - MULA R1, R2, R4, R4 - // w = R2:R1 in nSec - MOVW R3, R1 // R4:R3 -> R2:R1 - MOVW R4, R2 - - // multiply nanoseconds by reciprocal of 10**9 (scaled by 2**61) - // to get seconds (96 bit scaled result) - MOVW $0x89705f41, R3 // 2**61 * 10**-9 - MULLU R1,R3,(R6,R5) // R7:R6:R5 = R2:R1 * R3 - MOVW $0,R7 - MULALU R2,R3,(R7,R6) - - // unscale by discarding low 32 bits, shifting the rest by 29 - MOVW R6>>29,R6 // R7:R6 = (R7:R6:R5 >> 61) - ORR R7<<3,R6 - MOVW R7>>29,R7 - - // subtract (10**9 * sec) from nsec to get nanosecond remainder - MOVW $1000000000, R5 // 10**9 - MULLU R6,R5,(R9,R8) // R9:R8 = R7:R6 * R5 - MULA R7,R5,R9,R9 - SUB.S R8,R1 // R2:R1 -= R9:R8 - SBC R9,R2 - - // because reciprocal was a truncated repeating fraction, quotient - // may be slightly too small -- adjust to make remainder < 10**9 - CMP R5,R1 // if remainder > 10**9 - SUB.HS R5,R1 // remainder -= 10**9 - ADD.HS $1,R6 // sec += 1 - - MOVW R6,sec_lo+0(FP) - MOVW R7,sec_hi+4(FP) - MOVW R1,nsec+8(FP) + MOVD $100, R1 + MUL R1, R0 + + // Code stolen from compiler output for: + // + // var x uint64 + // func f() (sec uint64, nsec uint32) { return x / 1000000000, uint32(x % 100000000) } + // + LSR $1, R0, R1 + MOVD $-8543223759426509416, R2 + UMULH R2, R1, R1 + LSR $28, R1, R1 + MOVD R1, sec+0(FP) + MOVD $-6067343680855748867, R1 + UMULH R0, R1, R1 + LSR $26, R1, R1 + MOVD $100000000, R2 + MSUB R1, R0, R2, R0 + MOVW R0, nsec+8(FP) RET useQPC: B runtime·nowQPC(SB) // tail call -// save_g saves the g register (R10) into thread local memory -// so that we can call externally compiled -// ARM code that will overwrite those registers. -// NOTE: runtime.gogo assumes that R1 is preserved by this function. -// runtime.mcall assumes this function only clobbers R0 and R11. -// Returns with g in R0. -// Save the value in the _TEB->TlsSlots array. -// Effectively implements TlsSetValue(). -// tls_g stores the TLS slot allocated TlsAlloc(). -TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 - MRC 15, 0, R0, C13, C0, 2 - ADD $0xe10, R0 - MOVW $runtime·tls_g(SB), R11 - MOVW (R11), R11 - MOVW g, R11<<2(R0) - MOVW g, R0 // preserve R0 across call to setg<> - RET - -// load_g loads the g register from thread-local memory, -// for use after calling externally compiled -// ARM code that overwrote those registers. -// Get the value from the _TEB->TlsSlots array. -// Effectively implements TlsGetValue(). -TEXT runtime·load_g(SB),NOSPLIT|NOFRAME,$0 - MRC 15, 0, R0, C13, C0, 2 - ADD $0xe10, R0 - MOVW $runtime·tls_g(SB), g - MOVW (g), g - MOVW g<<2(R0), g - RET - // This is called from rt0_go, which runs on the system stack // using the initial stack allocated by the OS. // It calls back into standard C using the BL below. -// To do that, the stack pointer must be 8-byte-aligned. -TEXT runtime·_initcgo(SB),NOSPLIT|NOFRAME,$0 - MOVM.DB.W [R4, R14], (R13) // push {r4, lr} - - // Ensure stack is 8-byte aligned before calling C code - MOVW R13, R4 - BIC $0x7, R13 - +TEXT runtime·wintls(SB),NOSPLIT,$0 // Allocate a TLS slot to hold g across calls to external code - MOVW $runtime·_TlsAlloc(SB), R0 - MOVW (R0), R0 + MOVD runtime·_TlsAlloc(SB), R0 + SUB $16, RSP // skip over saved frame pointer below RSP BL (R0) + ADD $16, RSP // Assert that slot is less than 64 so we can use _TEB->TlsSlots CMP $64, R0 - MOVW $runtime·abort(SB), R1 - BL.GE (R1) - - // Save Slot into tls_g - MOVW $runtime·tls_g(SB), R1 - MOVW R0, (R1) - - MOVW R4, R13 - MOVM.IA.W (R13), [R4, R15] // pop {r4, pc} - -// Holds the TLS Slot, which was allocated by TlsAlloc() -GLOBL runtime·tls_g+0(SB), NOPTR, $4 + BLT ok + MOVD $runtime·abort(SB), R1 + BL (R1) +ok: -#endif + // Save offset from R18 into tls_g. + LSL $3, R1 + ADD $TEB_TlsSlots, R1 + MOVD R1, runtime·tls_g(SB) + RET diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go index 666ec5f69e..7cf9318bdb 100644 --- a/src/runtime/syscall_windows.go +++ b/src/runtime/syscall_windows.go @@ -148,6 +148,7 @@ func compileCallback(fn eface, cdecl bool) (code uintptr) { } // cdecl, stdcall, fastcall, and arm pad arguments to word size. + // TODO(rsc): On arm and arm64 do we need to skip the caller's saved LR? src += sys.PtrSize // The Go ABI packs arguments. dst += t.size diff --git a/src/runtime/tls_arm64.h b/src/runtime/tls_arm64.h index 0804fa3502..fe5e4cee12 100644 --- a/src/runtime/tls_arm64.h +++ b/src/runtime/tls_arm64.h @@ -41,8 +41,16 @@ #define MRS_TPIDR_R0 WORD $0xd53bd040 // MRS TPIDR_EL0, R0 #endif +#ifdef GOOS_windows +#define TLS_windows +#endif +#ifdef TLS_windows +#define TLSG_IS_VARIABLE +#define MRS_TPIDR_R0 MOVD R18_PLATFORM, R0 +#endif + // Define something that will break the build if // the GOOS is unknown. -#ifndef TPIDR -#define MRS_TPIDR_R0 TPIDR_UNKNOWN +#ifndef MRS_TPIDR_R0 +#define MRS_TPIDR_R0 unknown_TLS_implementation_in_tls_arm64_h #endif diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s index 085012f791..52b3e8f222 100644 --- a/src/runtime/tls_arm64.s +++ b/src/runtime/tls_arm64.s @@ -9,11 +9,13 @@ #include "tls_arm64.h" TEXT runtime·load_g(SB),NOSPLIT,$0 -#ifndef TLS_darwin +#ifndef GOOS_darwin #ifndef GOOS_openbsd +#ifndef GOOS_windows MOVB runtime·iscgo(SB), R0 CBZ R0, nocgo #endif +#endif #endif MRS_TPIDR_R0 @@ -28,11 +30,13 @@ nocgo: RET TEXT runtime·save_g(SB),NOSPLIT,$0 -#ifndef TLS_darwin +#ifndef GOOS_darwin #ifndef GOOS_openbsd +#ifndef GOOS_windows MOVB runtime·iscgo(SB), R0 CBZ R0, nocgo #endif +#endif #endif MRS_TPIDR_R0 -- cgit v1.3-5-g9baa From b110a43628526787f73db44e11829520d92e5b2b Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 15 Feb 2021 11:26:58 -0500 Subject: runtime: delete gosave (dead code) Change-Id: Ie811526534df8622d89c5b1b81dbe19ece1c962b Reviewed-on: https://go-review.googlesource.com/c/go/+/292110 Trust: Russ Cox Reviewed-by: Cherry Zhang Reviewed-by: Ian Lance Taylor --- src/runtime/proc.go | 2 +- src/runtime/stack.go | 2 +- src/runtime/stubs.go | 1 + src/runtime/sys_wasm.go | 2 +- src/runtime/sys_x86.go | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/proc.go b/src/runtime/proc.go index ccfe085691..dbb430fd25 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -3482,7 +3482,7 @@ func save(pc, sp uintptr) { // This is called only from the go syscall library and cgocall, // not from the low-level system calls used by the runtime. // -// Entersyscall cannot split the stack: the gosave must +// Entersyscall cannot split the stack: the save must // make g->sched refer to the caller's stack segment, because // entersyscall is going to return immediately after. // diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 8c90e7b46f..d971e5e26f 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -1089,7 +1089,7 @@ func nilfunc() { } // adjust Gobuf as if it executed a call to fn -// and then did an immediate gosave. +// and then stopped before the first instruction in fn. func gostartcallfn(gobuf *gobuf, fv *funcval) { var fn unsafe.Pointer if fv != nil { diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index c0cc95ec65..b9b313a711 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -169,6 +169,7 @@ func noescape(p unsafe.Pointer) unsafe.Pointer { // This in turn calls cgocallbackg, which is where we'll find // pointer-declared arguments. func cgocallback(fn, frame, ctxt uintptr) + func gogo(buf *gobuf) //go:noescape diff --git a/src/runtime/sys_wasm.go b/src/runtime/sys_wasm.go index 3ed621f92e..057ed4ccd9 100644 --- a/src/runtime/sys_wasm.go +++ b/src/runtime/sys_wasm.go @@ -27,7 +27,7 @@ func wasmTruncU() func wasmExit(code int32) // adjust Gobuf as it if executed a call to fn with context ctxt -// and then did an immediate gosave. +// and then stopped before the first instruction in fn. func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { sp := buf.sp sp -= sys.PtrSize diff --git a/src/runtime/sys_x86.go b/src/runtime/sys_x86.go index 5b7a666679..8f21585d28 100644 --- a/src/runtime/sys_x86.go +++ b/src/runtime/sys_x86.go @@ -12,7 +12,7 @@ import ( ) // adjust Gobuf as if it executed a call to fn with context ctxt -// and then did an immediate gosave. +// and then stopped before the first instruction in fn. func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) { sp := buf.sp sp -= sys.PtrSize -- cgit v1.3-5-g9baa From b445d6ea34661328a7310beda285c64d6823624d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 15 Feb 2021 17:02:30 -0500 Subject: runtime/pprof: expect tests to pass on macOS macOS tests have been disabled since CL 12429045 (Aug 2013). At the time, macOS required a kernel patch to get a working profiler (https://research.swtch.com/macpprof), which we didn't want to require, of course. macOS has improved - it no longer requires the kernel patch - but we never updated the list of exceptions. As far as I can tell, the builders have no problem passing the pprof test now. (It is possible that the iOS builders have trouble, but that is now a different GOOS.) Remove the exception for macOS. The test should now pass. Fixes #6047. Change-Id: Iab49036cacc1025e56f515bd19d084390c2f5357 Reviewed-on: https://go-review.googlesource.com/c/go/+/292229 Trust: Russ Cox Reviewed-by: Cherry Zhang --- src/runtime/pprof/pprof_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index f7c1349bc6..d7571953a9 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -279,7 +279,7 @@ func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []stri broken := false switch runtime.GOOS { - case "darwin", "ios", "dragonfly", "netbsd", "illumos", "solaris": + case "ios", "dragonfly", "netbsd", "illumos", "solaris": broken = true case "openbsd": if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { -- cgit v1.3-5-g9baa From 7764ee5614df2228e03326487af7670c7c5d268a Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 19 Feb 2021 14:31:57 +0800 Subject: runtime: fix invalid nil g check for for mips64x In CL 292109 we removed unnecessary writes to gp.sched.g but put wrong register to save g (R4 saves pointer to g) on mips64x Change-Id: I9777846a7b0a46e1af83dcfc73b74649e0dba3c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/293989 TryBot-Result: Go Bot Reviewed-by: Joel Sing Trust: Meng Zhuo Run-TryBot: Meng Zhuo --- src/runtime/asm_mips64x.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s index af27b9b555..c123e96a71 100644 --- a/src/runtime/asm_mips64x.s +++ b/src/runtime/asm_mips64x.s @@ -98,11 +98,11 @@ TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0 TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8 MOVV buf+0(FP), R3 MOVV gobuf_g(R3), R4 - MOVV 0(R4), R5 // make sure g != nil + MOVV 0(R4), R0 // make sure g != nil JMP gogo<>(SB) TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0 - MOVV R5, g + MOVV R4, g JAL runtime·save_g(SB) MOVV 0(g), R2 -- cgit v1.3-5-g9baa