aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_openbsd_arm.s
AgeCommit message (Collapse)Author
2021-05-09runtime,syscall: convert syscall on openbsd/arm to libcJoel Sing
Convert the syscall package on openbsd/arm to use libc rather than performing direct system calls. Updates #36435 Change-Id: Iff3a91c959292cbf4e0a09c7fd34efc8e88ff83f Reviewed-on: https://go-review.googlesource.com/c/go/+/315793 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-09runtime: switch runtime to libc for openbsd/armJoel Sing
Use libc rather than performing direct system calls for the runtime on openbsd/arm. Updates #36435 Change-Id: If64a96a61c80b9748792f8a85a8f16ed6ebca91f Reviewed-on: https://go-review.googlesource.com/c/go/+/315792 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-09runtime: switch openbsd/arm locking to libcJoel Sing
Switch openbsd/arm to locking via libc, rather than performing direct system calls. Update #36435 Change-Id: I190abb1aa544d2cb406fe412960ec106c9716f87 Reviewed-on: https://go-review.googlesource.com/c/go/+/315791 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-05-09runtime: switch openbsd/arm to pthreadsJoel Sing
This switches openbsd/arm to thread creation via pthreads, rather than doing direct system calls. Update #36435 Change-Id: Ia8749e3723a9967905c33b6d93dfd9be797a486c Reviewed-on: https://go-review.googlesource.com/c/go/+/315790 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-04-29runtime: rename walltime1 to walltimeIan Lance Taylor
Change-Id: Iec9de5ca56eb68d524bbaa0668515dbd09ad38a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/314770 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2020-05-26runtime, syscall: correct openbsd/arm and openbsd/arm64 syscalls for OpenBSD 6.7Joel Sing
Add two no op instructions following svc on openbsd/arm64 and swi on openbsd/arm. All except some of the most recent arm64 processors have a speculative execution flaw that occurs across a syscall boundary, which cannot be mitigated in the kernel. In order to protect against this leak a speculation barrier needs to be placed after an svc or swi instruction. In order to avoid the performance impact of these instructions, the OpenBSD 6.7 kernel returns execution two instructions past the svc or swi call. For now two hardware no ops are added, which allows syscalls to work with both 6.6 and 6.7. These should be replaced with real speculation barriers once OpenBSD 6.8 is released. Updates #36435 Change-Id: I06153cb0998199242cca8761450e53599c3e7de4 Reviewed-on: https://go-review.googlesource.com/c/go/+/234381 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-26runtime: save/restore callee-save registers in arm's sigtrampBen Shi
ARM's R4-R8 & R10-R11 are callee-save registers, and R9 may be callee-save or not. This CL saves them at the beginning of sigtramp and restores them in the end. fixes #32738 Change-Id: Ib7eb80836bc074e2e6a46ae4602ba8a3b96c5456 Reviewed-on: https://go-review.googlesource.com/c/go/+/183777 Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-26runtime: M-targeted signals for BSDsAustin Clements
For these, we split up the existing runtime.raise assembly implementation into its constituent "get thread ID" and "signal thread" parts. This lets us implement signalM and reimplement raise in pure Go. (NetBSD conveniently already had lwp_self.) We also change minit to store the procid directly, rather than depending on newosproc to do so. This is because newosproc isn't called for the bootstrap M, but we need a procid for every M. This is also simpler overall. For #10958, #24543. Change-Id: Ie5f1fcada6a33046375066bcbe054d1f784d39c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/201402 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-22runtime: correctly negate errno value for *BSD ARMIan Lance Taylor
Fixes #35037 Change-Id: I0b9bcd001556cd409994d83dabcdd6e32b001d28 Reviewed-on: https://go-review.googlesource.com/c/go/+/202441 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-21runtime: change read and write to return negative errno valueIan Lance Taylor
The internal read and write functions used to return -1 on error; change them to return a negative errno value instead. This will be used by later CLs in this series. For most targets this is a simplification, although for ones that call into libc it is a complication. Updates #27707 Change-Id: Id02bf9487f03e7e88e4f2b85e899e986738697ad Reviewed-on: https://go-review.googlesource.com/c/go/+/171823 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-20runtime: define nonblockingPipeIan Lance Taylor
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-04runtime: wrap nanotime, walltime, and writeAustin Clements
In preparation for general faketime support, this renames the existing nanotime, walltime, and write functions to nanotime1, walltime1, and write1 and wraps them with trivial Go functions. This will let us inject different implementations on all platforms when faketime is enabled. Updates #30439. Change-Id: Ice5ccc513a32a6d89ea051638676d3ee05b00418 Reviewed-on: https://go-review.googlesource.com/c/go/+/192738 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@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>
2018-12-18runtime,cmd/dist,cmd/link: add cgo support on openbsd/armJoel Sing
Add support for cgo on openbsd/arm.The gcc shipped with base OpenBSD armv7 is old/inadequate, so use clang by default. Change-Id: I945a26d369378952d357727718e69249411e1127 Reviewed-on: https://go-review.googlesource.com/c/154381 Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-18runtime: use MADV_FREE on Linux if availableTobias Klauser
On Linux, sysUnused currently uses madvise(MADV_DONTNEED) to signal the kernel that a range of allocated memory contains unneeded data. After a successful call, the range (but not the data it contained before the call to madvise) is still available but the first access to that range will unconditionally incur a page fault (needed to 0-fill the range). A faster alternative is MADV_FREE, available since Linux 4.5. The mechanism is very similar, but the page fault will only be incurred if the kernel, between the call to madvise and the first access, decides to reuse that memory for something else. In sysUnused, test whether MADV_FREE is supported and fall back to MADV_DONTNEED in case it isn't. This requires making the return value of the madvise syscall available to the caller, so change runtime.madvise to return it. Fixes #23687 Change-Id: I962c3429000dd9f4a00846461ad128b71201bb04 Reviewed-on: https://go-review.googlesource.com/135395 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-04-05runtime: fix/improve exitThread on openbsdJoel Sing
OpenBSD's __threxit syscall takes a pointer to a 32-bit value that will be zeroed immediately before the thread exits. Make use of this instead of zeroing freeWait from the exitThread assembly and using hacks like switching to a static stack, so this works on 386. Change-Id: I3ec5ead82b6496404834d148f713794d5d9da723 Reviewed-on: https://go-review.googlesource.com/105055 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-12runtime, sync/atomic: use NOFRAME on armAustin Clements
This replaces frame size -4 with the NOFRAME flag in arm assembly. This was automated with: sed -i -e 's/\(^TEXT.*[A-Z]\),\( *\)\$-4/\1|NOFRAME,\2$0/' $(find -name '*_arm.s') Plus three manual comment changes found by: grep '\$-4' $(find -name '*_arm.s') The go binary is identical before and after this change. Change-Id: I0310384d1a584118c41d1cd3a042bb8ea7227ef9 Reviewed-on: https://go-review.googlesource.com/92042 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-10-18runtime: separate error result for mmapAustin Clements
Currently mmap returns an unsafe.Pointer that encodes OS errors as values less than 4096. In practice this is okay, but it borders on being really unsafe: for example, the value has to be checked immediately after return and if stack copying were ever to observe such a value, it would panic. It's also not remotely idiomatic. Fix this by making mmap return a separate pointer value and error, like a normal Go function. Updates #22218. Change-Id: Iefd965095ffc82cc91118872753a5d39d785c3a6 Reviewed-on: https://go-review.googlesource.com/71270 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-16runtime: fix use of STREX in various exitThread implementationsIan Lance Taylor
STREX does not permit using the same register for the value to store and the place where the result is returned. Also the code was wrong anyhow if the first store failed. Fixes #22248 Change-Id: I96013497410058514ffcb771c76c86faa1ec559b Reviewed-on: https://go-review.googlesource.com/70911 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-10-11runtime: make it possible to exit Go-created threadsAustin Clements
Currently, threads created by the runtime exist until the whole program exits. For #14592 and #20395, we want to be able to exit and clean up threads created by the runtime. This commit implements that mechanism. The main difficulty is how to clean up the g0 stack. In cgo mode and on Solaris and Windows where the OS manages thread stacks, we simply arrange to return from mstart and let the system clean up the thread. If the runtime allocated the g0 stack, then we use a new exitThread syscall wrapper that arranges to clear a flag in the M once the stack can safely be reaped and call the thread termination syscall. exitThread is based on the existing exit1 wrapper, which was always meant to terminate the calling thread. However, exit1 has never been used since it was introduced 9 years ago, so it was broken on several platforms. exitThread also has the additional complication of having to flag that the stack is unused, which requires some tricks on platforms that use the stack for syscalls. This still leaves the problem of how to reap the unused g0 stacks. For this, we move the M from allm to a new freem list as part of the M exiting. Later, allocm scans the freem list, finds Ms that are marked as done with their stack, removes these from the list and frees their g0 stacks. This also allows these Ms to be garbage collected. This CL does not yet use any of this functionality. Follow-up CLs will. Likewise, there are no new tests in this CL because we'll need follow-up functionality to test it. Change-Id: Ic851ee74227b6d39c6fc1219fc71b45d3004bc63 Reviewed-on: https://go-review.googlesource.com/46037 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2017-02-03time: record monotonic clock reading in time.Now, for more accurate comparisonsRuss Cox
See https://golang.org/design/12914-monotonic for details. Fixes #12914. Change-Id: I80edc2e6c012b4ace7161c84cf067d444381a009 Reviewed-on: https://go-review.googlesource.com/36255 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Caleb Spare <cespare@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-12-12runtime, syscall: update openbsd for changes to syskillJoel Sing
Change the openbsd runtime to use the current sys_kill and sys_thrkill system calls. Prior to OpenBSD 5.9 the sys_kill system call could be used with both processes and threads. In OpenBSD 5.9 this functionality was split into a sys_kill system call for processes (with a new syscall number) and a sys_thrkill system call for threads. The original/legacy system call was retained in OpenBSD 5.9 and OpenBSD 6.0, however has been removed and will not exist in the upcoming OpenBSD 6.1 release. Note: This change is needed to make Go work on OpenBSD 6.1 (to be released in May 2017) and should be included in the Go 1.8 release. This change also drops support for OpenBSD 5.8, which is already an unsupported OpenBSD release. Change-Id: I525ed9b57c66c0c6f438dfa32feb29c7eefc72b0 Reviewed-on: https://go-review.googlesource.com/34093 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-24runtime: unify some signal handling functionsIan Lance Taylor
Unify the OS-specific versions of msigsave, msigrestore, sigblock, updatesigmask, and unblocksig into single versions in signal_unix.go. To do this, make sigprocmask work the same way on all systems, which required adding a definition of sigprocmask for linux and openbsd. Also add a single OS-specific function sigmaskToSigset. Change-Id: I7cbf75131dddb57eeefe648ef845b0791404f785 Reviewed-on: https://go-review.googlesource.com/29689 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-08-25all: fix assembly vet issuesJosh Bleecher Snyder
Add missing function prototypes. Fix function prototypes. Use FP references instead of SP references. Fix variable names. Update comments. Clean up whitespace. (Not for vet.) All fairly minor fixes to make vet happy. Updates #11041 Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c Reviewed-on: https://go-review.googlesource.com/27713 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-22runtime: ignore closeonexec ret val on openbsd/armJosh Bleecher Snyder
Fixes #16641 Updates #11041 Change-Id: I087208a486f535d74135591b2c9a73168cf80e1a Reviewed-on: https://go-review.googlesource.com/27490 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-24runtime: adjust gsignal stack to current signal stackIan Lance Taylor
If non-Go code calls sigaltstack before a signal is received, use sigaltstack to determine the current signal stack and set the gsignal stack to use it. This makes the Go runtime more robust in the face of non-Go code. We still can't handle a disabled signal stack or a signal triggered with SA_ONSTACK clear, but we now give clear errors for those cases. Fixes #7227. Update #9896. Change-Id: Icb1607e01fd6461019b6d77d940e59b3aed4d258 Reviewed-on: https://go-review.googlesource.com/18102 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-11-10runtime: break atomics out into package runtime/internal/atomicMichael Matloob
This change breaks out most of the atomics functions in the runtime into package runtime/internal/atomic. It adds some basic support in the toolchain for runtime packages, and also modifies linux/arm atomics to remove the dependency on the runtime's mutex. The mutexes have been replaced with spinlocks. all trybots are happy! In addition to the trybots, I've tested on the darwin/arm64 builder, on the darwin/arm builder, and on a ppc64le machine. Change-Id: I6698c8e3cf3834f55ce5824059f44d00dc8e3c2f Reviewed-on: https://go-review.googlesource.com/14204 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-07-30runtime: replace divide with multiply in runtime.usleep on armRuss Cox
We want to adjust the DIV calling convention to use m, and usleep can be called without an m, so switch to a multiplication by the reciprocal (and test). Step toward a fix for #6699 and #10486. Change-Id: Iccf76a18432d835e48ec64a2fa34a0e4d6d4b955 Reviewed-on: https://go-review.googlesource.com/12898 Reviewed-by: Ian Lance Taylor <iant@golang.org>
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-06-19runtime: ensure GC sees type-safe memory on weak machinesAustin Clements
Currently its possible for the garbage collector to observe uninitialized memory or stale heap bitmap bits on weakly ordered architectures such as ARM and PPC. On such architectures, the stores that zero newly allocated memory and initialize its heap bitmap may move after a store in user code that makes the allocated object observable by the garbage collector. To fix this, add a "publication barrier" (also known as an "export barrier") before returning from mallocgc. This is a store/store barrier that ensures any write done by user code that makes the returned object observable to the garbage collector will be ordered after the initialization performed by mallocgc. No barrier is necessary on the reading side because of the data dependency between loading the pointer and loading the contents of the object. Fixes one of the issues raised in #9984. Change-Id: Ia3d96ad9c5fc7f4d342f5e05ec0ceae700cd17c8 Reviewed-on: https://go-review.googlesource.com/11083 Reviewed-by: Rick Hudson <rlh@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Martin Capitanio <capnm9@gmail.com> Reviewed-by: Russ Cox <rsc@golang.org>
2015-04-14runtime: rename close to closefdDavid Crawshaw
Avoids shadowing the builtin channel close function. Change-Id: I7a729b0937c8248fe27222be61318a88db995eee Reviewed-on: https://go-review.googlesource.com/8898 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-03-21runtime: fix return values for open/read/write/close on openbsd/armJoel Sing
Change-Id: I5b057d16eed1b364e608ff0fd74de323da6492bc Reviewed-on: https://go-review.googlesource.com/7679 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15runtime: add support for openbsd/armJoel Sing
Change-Id: I2bc101aa19172e705ee4de5f3c73a8b4bbf4fa6f Reviewed-on: https://go-review.googlesource.com/4912 Reviewed-by: Minux Ma <minux@golang.org>