aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-07-20 11:48:43 -0400
committerMichael Pratt <mpratt@google.com>2022-08-02 18:51:42 +0000
commitb486518964c051afa03c92c30500f4154b4a4dd5 (patch)
treedcc2bbc3d3c257ef9a4b3e4df99cb01d5b90ba6f
parent54a0ab3f7b240dcd6829d636cff3a40d19d5b266 (diff)
downloadgo-b486518964c051afa03c92c30500f4154b4a4dd5.tar.gz
go-b486518964c051afa03c92c30500f4154b4a4dd5.zip
runtime: tricky replacements of _g_ in os3_solaris.go
The argument to semacreate is always getg().m. Change-Id: I4c4104cd6b57ab6b9ed0b7d11b8089bcc9fdd621 Reviewed-on: https://go-review.googlesource.com/c/go/+/418583 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--src/runtime/os3_solaris.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go
index 8c85b71532..76cf59772b 100644
--- a/src/runtime/os3_solaris.go
+++ b/src/runtime/os3_solaris.go
@@ -308,18 +308,17 @@ func semacreate(mp *m) {
}
var sem *semt
- _g_ := getg()
// Call libc's malloc rather than malloc. This will
// allocate space on the C heap. We can't call malloc
// here because it could cause a deadlock.
- _g_.m.libcall.fn = uintptr(unsafe.Pointer(&libc_malloc))
- _g_.m.libcall.n = 1
- _g_.m.scratch = mscratch{}
- _g_.m.scratch.v[0] = unsafe.Sizeof(*sem)
- _g_.m.libcall.args = uintptr(unsafe.Pointer(&_g_.m.scratch))
- asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&_g_.m.libcall))
- sem = (*semt)(unsafe.Pointer(_g_.m.libcall.r1))
+ mp.libcall.fn = uintptr(unsafe.Pointer(&libc_malloc))
+ mp.libcall.n = 1
+ mp.scratch = mscratch{}
+ mp.scratch.v[0] = unsafe.Sizeof(*sem)
+ mp.libcall.args = uintptr(unsafe.Pointer(&mp.scratch))
+ asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&mp.libcall))
+ sem = (*semt)(unsafe.Pointer(mp.libcall.r1))
if sem_init(sem, 0, 0) != 0 {
throw("sem_init")
}