1
0
mirror of https://github.com/golang/go synced 2024-11-19 22:04:44 -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:
Akshat Kumar 2012-09-24 12:24:45 -04:00 committed by Russ Cox
parent 8696b08446
commit e42788628a
4 changed files with 8 additions and 6 deletions

View File

@ -145,6 +145,12 @@ static struct {
"#define g(r) 0(r)\n" "#define g(r) 0(r)\n"
"#define m(r) 8(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", "", {"amd64", "",
"// The offsets 0 and 8 are known to:\n" "// The offsets 0 and 8 are known to:\n"
"// ../../cmd/6l/pass.c:/D_GS\n" "// ../../cmd/6l/pass.c:/D_GS\n"

View File

@ -1,3 +1,2 @@
// nothing to see here // nothing to see here
#define tos_pid 64
#define PAGESIZE 0x200000ULL #define PAGESIZE 0x200000ULL

View File

@ -3,11 +3,9 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
TEXT _rt0_amd64_plan9(SB),7, $0 TEXT _rt0_amd64_plan9(SB),7, $0
MOVQ AX, _tos(SB)
MOVQ $_rt0_amd64(SB), AX MOVQ $_rt0_amd64(SB), AX
MOVQ SP, DI MOVQ SP, DI
JMP AX JMP AX
DATA runtime·isplan9(SB)/4, $1 DATA runtime·isplan9(SB)/4, $1
GLOBL runtime·isplan9(SB), $4 GLOBL runtime·isplan9(SB), $4
GLOBL _tos(SB), $8

View File

@ -105,9 +105,8 @@ TEXT runtime·rfork(SB),7,$0
MOVQ DX, g(AX) MOVQ DX, g(AX)
MOVQ BX, m(AX) MOVQ BX, m(AX)
// Initialize AX from _tos->pid // Initialize AX from pid in TLS.
MOVQ _tos(SB), AX MOVQ procid(AX), AX
MOVQ tos_pid(AX), AX
MOVQ AX, m_procid(BX) // save pid as m->procid MOVQ AX, m_procid(BX) // save pid as m->procid
CALL runtime·stackcheck(SB) // smashes AX, CX CALL runtime·stackcheck(SB) // smashes AX, CX