aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/internal/syscall
AgeCommit message (Collapse)Author
2024-02-21runtime: migrate internal/syscall to internal/runtimeAndy Pan
For #65355 Change-Id: I5fefe30dcb520159de565e61dafc74a740fc8730 Reviewed-on: https://go-review.googlesource.com/c/go/+/559715 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-20runtime/internal/syscall: merge duplicate constantsAndy Pan
Change-Id: Ifdc6e22d52317cdb90a607ac4d72437d4d6b33e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/564716 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-20runtime: use eventfd as the event wait/notify mechanism for epollAndy Pan
Fixes #65443 Change-Id: I9ad4689b36e87ee930d35a38322a8797896483b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/560615 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-11-21runtime/internal/syscall: use ABIInternal for Syscall6 on loong64Guoqi Chen
Updates #40724 Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn> Change-Id: Ifcc2de35a797fd987a10f564206b14b54d736d1d Reviewed-on: https://go-review.googlesource.com/c/go/+/521789 Auto-Submit: David Chase <drchase@google.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-20runtime: consolidate on a single closeonexec definitionIan Lance Taylor
Now that we implement fcntl on all Unix systems, we can write closeonexec that uses it. This lets us remove a bunch of assembler code. Change-Id: If35591df535ccfc67292086a9492f0a8920e3681 Reviewed-on: https://go-review.googlesource.com/c/go/+/496081 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-24syscall, runtime/internal/syscall: zero r2 before mips linux syscallsRongrong
All mips variant perform syscalls similarly. R2 (v0) holds r1 and R3 (v1) holds r2 of a syscall. The latter is only used by 2-ret syscalls. A 1-ret syscall would not touch R3 but keeps it as is, making r2 be a random value. Always reset it to 0 before SYSCALL to fix the issue. Fixes #56426 Change-Id: Ie49965c0c3c224c4a895703ac659205cd040ff56 Reviewed-on: https://go-review.googlesource.com/c/go/+/452975 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Meng Zhuo <mzh@golangcn.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Meng Zhuo <mzh@golangcn.org>
2022-10-26runtime/internal/syscall: use ABIInternal for Syscall6 on riscv64Wayne Zuo
Change-Id: Iceed0f55038c87f261b60309e025132142946364 Reviewed-on: https://go-review.googlesource.com/c/go/+/443557 Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org>
2022-10-25runtime/internal/syscall: convert PPC64 Syscall6 to ABIInternalPaul E. Murphy
This avoids a lot of stacking. Change-Id: If5c5cf33335ffdcb7eecbd3f2db7858a415d817d Reviewed-on: https://go-review.googlesource.com/c/go/+/443736 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2022-10-07runtime: move epoll syscalls to runtime/internal/syscallAndrew Pogrebnoy
This change moves Linux epoll's syscalls implementation to the "runtime/internal/syscall" package. The intention in this CL was to minimise behavioural changes but make the code more generalised. This also will allow adding new syscalls (like epoll_pwait2) without the need to implement assembly stubs for each arch. It also drops epoll_create as not all architectures provide this call. epoll_create1 was added to the kernel in version 2.6.27 and Go requires Linux kernel version 2.6.32 or later since Go 1.18. So it is safe to always use epoll_create1. This is a resubmit as the previous CL 421994 was reverted due to test failures after the merge with the master. The issue was fixed in CL 438615 For #53824 For #51087 Change-Id: I1bd0f23a85b4f9b80178c5dd36fd3e95ff4f9648 Reviewed-on: https://go-review.googlesource.com/c/go/+/440115 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
2022-09-30Revert "runtime: move epoll syscalls to runtime/internal/syscall"Michael Pratt
This reverts CL 421994. Reason for revert: breaks runtime.TestCheckPtr2 For #53824 For #51087 Change-Id: I044ea4d6efdffe0a4b7fb0d2bb3717d9f391fc59 Reviewed-on: https://go-review.googlesource.com/c/go/+/437295 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-30runtime: move epoll syscalls to runtime/internal/syscallAndrew Pogrebnoy
This change moves Linux epoll's syscalls implementation to the "runtime/internal/syscall" package. The intention in this CL was to minimise behavioural changes but make the code more generalised. This also will allow adding new syscalls (like epoll_pwait2) without the need to implement assembly stubs for each arch. It also drops epoll_create as not all architectures provide this call. epoll_create1 was added to the kernel in version 2.6.27 and Go requires Linux kernel version 2.6.32 or later since Go 1.18. So it is safe to always use epoll_create1. For #53824 For #51087 Change-Id: I9a6a26b7f2075a38e041de1bab4691da0ecb94fc Reviewed-on: https://go-review.googlesource.com/c/go/+/421994 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2022-06-15syscall, runtime/internal/syscall: always zero the higher bits of return ↵Guoqi Chen
value on linux/loong64 All loong64 syscalls return values only via R4/A0, and R5/A1 may contain unrelated content. Always zero the second return value. Change-Id: I62af59369bece5bd8028b937c74f4694150f7a55 Reviewed-on: https://go-review.googlesource.com/c/go/+/411615 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Austin Clements <austin@google.com>
2022-05-26runtime/internal/syscall: use correct result names for loong64Ian Lance Taylor
Fixes "GOARCH=loong64 go vet runtime/internal/syscall" Change-Id: I5879eec3ff07b0c69a5a8ac8e854733261e98fbf Reviewed-on: https://go-review.googlesource.com/c/go/+/408695 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2022-05-19runtime: implement syscalls for runtime bootstrap on linux/loong64Xiaodong Liu
Contributors to the loong64 port are: Weining Lu <luweining@loongson.cn> Lei Wang <wanglei@loongson.cn> Lingqin Gong <gonglingqin@loongson.cn> Xiaolin Zhao <zhaoxiaolin@loongson.cn> Meidan Li <limeidan@loongson.cn> Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Qiyuan Pu <puqiyuan@loongson.cn> Guoqi Chen <chenguoqi@loongson.cn> This port has been updated to Go 1.15.6: https://github.com/loongson/go Updates #46229 Change-Id: I848608267932717895d5cff9e33040029c3f3c4b Reviewed-on: https://go-review.googlesource.com/c/go/+/368080 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2022-04-22runtime/internal/syscall: use ABIInternal for Syscall6 on amd64Michael Pratt
This is an exact copy of CL 401096 after fixing #52472 in CL 401654. For #51087 For #52472 Change-Id: Ib3c914949a15517aacdca2d72e69e1c7b217e430 Reviewed-on: https://go-review.googlesource.com/c/go/+/401656 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-04-21Revert "runtime/internal/syscall: use ABIInternal for Syscall6 on amd64"Michael Pratt
This reverts CL 401096. Grandparent CL 388477 breaks cmd/go TestScript/cover_pkgall_runtime. For #51087. For #52472. Change-Id: Ie82fe5f50975f66eb91fb0d01cd8bbbd0265eb4e Reviewed-on: https://go-review.googlesource.com/c/go/+/401634 Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-21runtime/internal/syscall: use ABIInternal for Syscall6 on amd64Michael Pratt
For #51087. Change-Id: I25971760b63ec0d23d0f011521dd197d81a38976 Reviewed-on: https://go-review.googlesource.com/c/go/+/401096 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-21runtime/internal/syscall, syscall: replace RawSyscall6 with runtime ↵Michael Pratt
implementation on linux For #51087 Change-Id: I75a1bdeb5089454595f5ca04765a9c6e45cf9bd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/388475 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-03syscall, runtime/internal/syscall: always return 0 in r2 on ppc64{,le} linux ↵Paul E. Murphy
syscalls Both endians perform syscalls similarly. Only CR0S0 and R3 hold the resultant status of a syscall. A random value may be stored into the second return value (r2) result in some cases. Always set it to zero. Fixes #51192 Change-Id: Ida6a5692578d2cdadf3099af28478b3bc364f623 Reviewed-on: https://go-review.googlesource.com/c/go/+/385796 Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Trust: Paul Murphy <murp@ibm.com>
2022-02-15runtime/internal/syscall: new package for linuxMichael Pratt
Add a generic syscall package for use by the runtime. Eventually we'd like to clean up system calls in the runtime to use more code generation and be moved out of the main runtime package. The implementations of the assembly functions are based on copies of syscall.RawSyscall6, modified slightly for more consistency between arches. e.g., renamed trap to num, always set syscall num register first. For now, this package is just the bare minimum needed for doAllThreadsSyscall to make an arbitrary syscall. For #51087. For #50113. Change-Id: Ibecb5e6303279ce15286759e1cd6a2ddc52f7c72 Reviewed-on: https://go-review.googlesource.com/c/go/+/383999 Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>