]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist, pkg/runtime: Plan 9, 64-bit: Get PID from TLS; remove use of `_tos'.
authorAkshat Kumar <seed@mail.nanosouffle.net>
Mon, 24 Sep 2012 16:24:45 +0000 (12:24 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 24 Sep 2012 16:24:45 +0000 (12:24 -0400)
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

src/cmd/dist/buildruntime.c
src/pkg/runtime/defs_plan9_amd64.h
src/pkg/runtime/rt0_plan9_amd64.s
src/pkg/runtime/sys_plan9_amd64.s

index d3ab197461f015a69a17c6dae6ad6bd746933645..f22174e792af90176e8da694b0bdb42f75f38710 100644 (file)
@@ -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"
index 8c324ea584d9144d2f9afbd6b446f14effb40bbd..d5d19f8be32d6cb015e9b11c45dad79477655f52 100644 (file)
@@ -1,3 +1,2 @@
 // nothing to see here
-#define tos_pid 64
 #define PAGESIZE 0x200000ULL
index 499413a831d63126812bafc3eff9169a6a187cf4..2b1fa2ae1dd032ad33721674a7b2e167fe1c448c 100644 (file)
@@ -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
index cc343d170a2be97add46d02ec082db94e7c88f96..f376620924c4acfb2760b785ac8804f53f6949a3 100644 (file)
@@ -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