mirror of
https://github.com/golang/go
synced 2024-11-19 21:04:43 -07:00
cmd/dist, pkg/runtime: Plan 9, 64-bit: Get PID from TLS; remove use of `_tos'.
Using offsets from Tos is cumbersome and we've had problems in the past. Since it's only being used to grab the PID, we'll just get that from the default TLS instead. R=rsc, rminnich, npe CC=golang-dev https://golang.org/cl/6543049
This commit is contained in:
parent
8696b08446
commit
e42788628a
6
src/cmd/dist/buildruntime.c
vendored
6
src/cmd/dist/buildruntime.c
vendored
@ -145,6 +145,12 @@ static struct {
|
||||
"#define g(r) 0(r)\n"
|
||||
"#define m(r) 8(r)\n"
|
||||
},
|
||||
{"amd64", "plan9",
|
||||
"#define get_tls(r)\n"
|
||||
"#define g(r) 0(GS)\n"
|
||||
"#define m(r) 8(GS)\n"
|
||||
"#define procid(r) 16(GS)\n"
|
||||
},
|
||||
{"amd64", "",
|
||||
"// The offsets 0 and 8 are known to:\n"
|
||||
"// ../../cmd/6l/pass.c:/D_GS\n"
|
||||
|
@ -1,3 +1,2 @@
|
||||
// nothing to see here
|
||||
#define tos_pid 64
|
||||
#define PAGESIZE 0x200000ULL
|
||||
|
@ -3,11 +3,9 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
TEXT _rt0_amd64_plan9(SB),7, $0
|
||||
MOVQ AX, _tos(SB)
|
||||
MOVQ $_rt0_amd64(SB), AX
|
||||
MOVQ SP, DI
|
||||
JMP AX
|
||||
|
||||
DATA runtime·isplan9(SB)/4, $1
|
||||
GLOBL runtime·isplan9(SB), $4
|
||||
GLOBL _tos(SB), $8
|
||||
|
@ -105,9 +105,8 @@ TEXT runtime·rfork(SB),7,$0
|
||||
MOVQ DX, g(AX)
|
||||
MOVQ BX, m(AX)
|
||||
|
||||
// Initialize AX from _tos->pid
|
||||
MOVQ _tos(SB), AX
|
||||
MOVQ tos_pid(AX), AX
|
||||
// Initialize AX from pid in TLS.
|
||||
MOVQ procid(AX), AX
|
||||
MOVQ AX, m_procid(BX) // save pid as m->procid
|
||||
|
||||
CALL runtime·stackcheck(SB) // smashes AX, CX
|
||||
|
Loading…
Reference in New Issue
Block a user