aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_arm64.go
AgeCommit message (Collapse)Author
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-19runtime: document, clean up internal/sysRuss Cox
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 <rsc@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-06cmd/internal/obj, runtime: preempt & restart some instruction sequencesCherry Zhang
On some architectures, for async preemption the injected call needs to clobber a register (usually REGTMP) in order to return to the preempted function. As a consequence, the PC ranges where REGTMP is live are not preemptible. The uses of REGTMP are usually generated by the assembler, where it needs to load or materialize a large constant or offset that doesn't fit into the instruction. In those cases, REGTMP is not live at the start of the instruction sequence. Instead of giving up preemption in those cases, we could preempt it and restart the sequence when resuming the execution. Basically, this is like reissuing an interrupted instruction, except that here the "instruction" is a Prog that consists of multiple machine instructions. For this to work, we need to generate PC data to mark the start of the Prog. Currently this is only done for ARM64. TODO: the split-stack function prologue is currently not async preemptible. We could use this mechanism, preempt it and restart at the function entry. Change-Id: I37cb282f8e606e7ab6f67b3edfdc6063097b4bd1 Reviewed-on: https://go-review.googlesource.com/c/go/+/208126 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2020-04-16runtime: clean up now unused pushCallSupportedJoel Sing
All platforms now support pushCall, hence remove the now unnecessary pushCallSupported flag/guard. Change-Id: I99e4be73839da68a742f3c239bae9ce2f8764624 Reviewed-on: https://go-review.googlesource.com/c/go/+/228497 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-11-12runtime: enable async preemption on darwin/arm64Cherry Zhang
The problem should be fixed by the previous CL. Reenable async preemption on darwin/arm64. Updates #35439. Change-Id: I93e8c4702b4d8fe6abaa6fc9c27def5c8aed1b59 Reviewed-on: https://go-review.googlesource.com/c/go/+/206419 Reviewed-by: Keith Randall <khr@golang.org>
2019-11-07runtime: disable async preemption on darwin/arm(64) for nowCherry Zhang
Enabling async preemption on darwin/arm and darwin/arm64 causes the builder to fail, e.g. https://build.golang.org/log/03f727b8f91b0c75bf54ff508d7d2f00b5cad4bf Due to the limited resource, I haven't been able to get access on those devices to debug. Disable async preemption for now. Updates #35439. Change-Id: I5a31ad6962c2bae8e6e9b8303c494610a8a4e50a Reviewed-on: https://go-review.googlesource.com/c/go/+/205842 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-07runtime: add async preemption support on ARM64Cherry Zhang
This CL adds support of call injection and async preemption on ARM64. There seems no way to return from the injected call without clobbering *any* register. So we have to clobber one, which is chosen to be REGTMP. Previous CLs have marked code sequences that use REGTMP async-nonpreemtible. Change-Id: Ieca4e3ba5557adf3d0f5d923bce5f1769b58e30b Reviewed-on: https://go-review.googlesource.com/c/go/+/203461 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2019-11-02runtime: support for injecting calls at signals on x86Austin Clements
This adds a sigctxt.pushCall method that pushes a call at the signaled site. We'll use this to inject asynchronous preemptions and in some places we use it to clean up preparePanic. For the moment this only works on 386 and amd64. We stub it out on other platforms and will avoid calling the stubbed version. For #10958, #24543. Change-Id: I49e0e853f935d32dd67a70c6cafbae44ee68af8e Reviewed-on: https://go-review.googlesource.com/c/go/+/201758 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-25runtime: add support for freebsd/arm64Tobias Klauser
Based on work by Mikaël Urankar (@MikaelUrankar), Shigeru YAMAMOTO (@bsd-hacker) and @myfreeweb. Updates #24715 Change-Id: If3189a693ca0aa627029e22b0f91534bcf322bc0 Reviewed-on: https://go-review.googlesource.com/c/go/+/198544 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26runtime: add support for openbsd/arm64Joel Sing
Updates #31656 Change-Id: I0b7486f7381fd8bd16a76278c0e9ec9763671fcc Reviewed-on: https://go-review.googlesource.com/c/go/+/174119 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-20all: add start of netbsd/arm64 supportMaya Rashish
This works well enough to run some code natively on arm64, but not well enough for more complicated code. I've been suggested to start a pull request anyway. Updates #30824 Change-Id: Ib4f63e0e8a9edfc862cf65b5f1b0fbf9a8a1628e GitHub-Last-Rev: b01b105e0446e349c8d9895d3ac6918fa0cdc48c GitHub-Pull-Request: golang/go#29398 Reviewed-on: https://go-review.googlesource.com/c/go/+/155739 Run-TryBot: Benny Siegert <bsiegert@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2018-02-13runtime: refactor test for pushing sigpanic frameAustin Clements
This logic is duplicated in all of the preparePanic functions. Pull it out into one architecture-independent function. Change-Id: I7ef4e78e3eda0b7be1a480fb5245fc7424fb2b4e Reviewed-on: https://go-review.googlesource.com/91255 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-06runtime: avoid repeated findmoduledatap callsAustin Clements
Currently almost every function that deals with a *_func has to first look up the *moduledata for the module containing the function's entry point. This means we almost always do at least two identical module lookups whenever we deal with a *_func (one to get the *_func and another to get something from its module data) and sometimes several more. Fix this by making findfunc return a new funcInfo type that embeds *_func, but also includes the *moduledata, and making all of the functions that currently take a *_func instead take a funcInfo and use the already-found *moduledata. This transformation is trivial for the most part, since the *_func type is usually inferred. The annoying part is that we can no longer use nil to indicate failure, so this introduces a funcInfo.valid() method and replaces nil checks with calls to valid. Change-Id: I9b8075ef1c31185c1943596d96dec45c7ab5100f Reviewed-on: https://go-review.googlesource.com/37331 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2016-10-11runtime: record current PC for SIGPROF on non-Go threadIan Lance Taylor
If we get a SIGPROF on a non-Go thread, and the program has not called runtime.SetCgoTraceback so we have no way to collect a stack trace, then record a profile that is just the PC where the signal occurred. That will at least point the user to the right area. Retrieving the PC from the sigctxt in a signal handler on a non-G thread required marking a number of trivial sigctxt methods as nosplit, and, for extra safety, nowritebarrierrec. The test shows that the existing test CgoPprofThread test does not test the stack trace, just the profile signal. Leaving that for later. Change-Id: I8f8f3ff09ac099fc9d9df94b5a9d210ffc20c4ab Reviewed-on: https://go-review.googlesource.com/30252 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2016-09-25runtime: merge Unix sighandler functionsIan Lance Taylor
Replace all the Unix sighandler functions with a single instance. Push the relatively small amount of processor-specific code into five methods on sigctxt: sigpc, sigsp, siglr, fault, preparePanic. (Some processors already had a fault method.) Change-Id: Ib459412ff8f7e0f5ad06bfd43eb827c8b196fc32 Reviewed-on: https://go-review.googlesource.com/29752 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-07runtime: eliminate unnecessary type conversionsMatthew Dempsky
Automated refactoring produced using github.com/mdempsky/unconvert. Change-Id: Iacf871a4f221ef17f48999a464ab2858b2bbaa90 Reviewed-on: https://go-review.googlesource.com/20071 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-08runtime: allow signal.Ignore of user-generated throwing signalsRuss Cox
Today, signal.Ignore(syscall.SIGTRAP) does nothing while signal.Notify(make(chan os.Signal), syscall.SIGTRAP) correctly discards user-generated SIGTRAPs. The same applies to any signal that we throw on. Make signal.Ignore work for these signals. Fixes #12906. Change-Id: Iba244813051e0ce23fa32fbad3e3fa596a941094 Reviewed-on: https://go-review.googlesource.com/18348 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-05runtime: fix exit status when killed by signalIan Lance Taylor
Previously, when a program died because of a SIGHUP, SIGINT, or SIGTERM signal it would exit with status 2. This CL fixes the runtime to exit with a status indicating that the program was killed by a signal. Change-Id: Ic2982a2562857edfdccaf68856e0e4df532af136 Reviewed-on: https://go-review.googlesource.com/18156 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2015-11-24runtime: recursively disallow write barriers in sighandlerAustin Clements
sighandler may run during STW, so write barriers are not allowed. Change-Id: Icdf46be10ea296fd87e73ab56ebb718c5d3c97ac Reviewed-on: https://go-review.googlesource.com/17007 Reviewed-by: Russ Cox <rsc@golang.org>
2015-11-12runtime: break out system-specific constants into package sysMichael Matloob
runtime/internal/sys will hold system-, architecture- and config- specific constants. Updates #11647 Change-Id: I6db29c312556087a42e8d2bdd9af40d157c56b54 Reviewed-on: https://go-review.googlesource.com/16817 Reviewed-by: Russ Cox <rsc@golang.org>
2015-10-30runtime: introduce GOTRACEBACK=single, now the defaultRuss Cox
Abandon (but still support) the old numbering system. GOTRACEBACK=none is old 0 GOTRACEBACK=single is the new behavior GOTRACEBACK=all is old 1 GOTRACEBACK=system is old 2 GOTRACEBACK=crash is unchanged See doc comment change in runtime1.go for details. Filed #13107 to decide whether to change default back to GOTRACEBACK=all for Go 1.6 release. If you run into programs where printing only the current goroutine omits needed information, please add details in a comment on that issue. Fixes #12366. Change-Id: I82ca8b99b5d86dceb3f7102d38d2659d45dbe0db Reviewed-on: https://go-review.googlesource.com/16512 Reviewed-by: Austin Clements <austin@google.com>
2015-07-27runtime: log all thread stack traces during GODEBUG=crash on UnixIan Lance Taylor
This extends https://golang.org/cl/2811, which only applied to Darwin and GNU/Linux, to all Unix systems. Fixes #9591. Change-Id: Iec3fb438564ba2924b15b447c0480f87c0bfd009 Reviewed-on: https://go-review.googlesource.com/12661 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-14runtime: fix build on non-x86 machinesRuss Cox
Fixes #11656 (again). Change-Id: I170ff10bfbdb0f34e57c11de42b6ee5291837813 Reviewed-on: https://go-review.googlesource.com/12142 Reviewed-by: Russ Cox <rsc@golang.org>
2015-04-20runtime: replace func-based write barrier skipping with type-basedRuss Cox
This CL revises CL 7504 to use explicitly uintptr types for the struct fields that are going to be updated sometimes without write barriers. The result is that the fields are now updated *always* without write barriers. This approach has two important properties: 1) Now the GC never looks at the field, so if the missing reference could cause a problem, it will do so all the time, not just when the write barrier is missed at just the right moment. 2) Now a write barrier never happens for the field, avoiding the (correct) detection of inconsistent write barriers when GODEBUG=wbshadow=1. Change-Id: Iebd3962c727c0046495cc08914a8dc0808460e0e Reviewed-on: https://go-review.googlesource.com/9019 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-16runtime: darwin/arm64 supportShenghou Ma
Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f03 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/8782 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-26runtime: remove write barrier on G in sighandlerAustin Clements
sighandler may run during a stop-the-world without a P, so it's not allowed to have write barriers. Fix the G write to disable the write barrier (this is safe because the G is reachable from allgs) and mark the function nowritebarrier. Change-Id: I907f05d3829e24eeb15fa4d020598af36710e87e Reviewed-on: https://go-review.googlesource.com/8020 Reviewed-by: Rick Hudson <rlh@golang.org>
2015-03-16runtime: add support for linux/arm64Aram Hăvărneanu
Change-Id: Ibda6a5bedaff57fd161d63fc04ad260931d34413 Reviewed-on: https://go-review.googlesource.com/7142 Reviewed-by: Russ Cox <rsc@golang.org>