Commit e4278862 authored by Akshat Kumar's avatar Akshat Kumar Committed by Russ Cox

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
parent 8696b084
...@@ -145,6 +145,12 @@ static struct { ...@@ -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"
......
// nothing to see here // nothing to see here
#define tos_pid 64
#define PAGESIZE 0x200000ULL #define PAGESIZE 0x200000ULL
...@@ -3,11 +3,9 @@ ...@@ -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
...@@ -105,9 +105,8 @@ TEXT runtime·rfork(SB),7,$0 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment