]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: more build fixing
authorRuss Cox <rsc@golang.org>
Fri, 1 Mar 2013 14:24:17 +0000 (09:24 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 1 Mar 2013 14:24:17 +0000 (09:24 -0500)
Move the mstartfn into its own field.
Simpler, more likely to be correct.

R=golang-dev, devon.odell
CC=golang-dev
https://golang.org/cl/7414046

src/pkg/runtime/runtime.h
src/pkg/runtime/sys_freebsd_386.s
src/pkg/runtime/sys_freebsd_amd64.s
src/pkg/runtime/sys_windows_386.s
src/pkg/runtime/sys_windows_amd64.s
src/pkg/runtime/thread_freebsd.c
src/pkg/runtime/thread_windows.c

index 665f15e9241d7a3731464cb0777fd38ec3ec605b..4440808319687f4edaee33ec31b14056d474c458 100644 (file)
@@ -265,7 +265,8 @@ struct      M
        uintptr cret;           // return value from C
        uint64  procid;         // for debuggers, but offset not hard-coded
        G*      gsignal;        // signal-handling G
-       uint64  tls[4];         // thread-local storage (for x86 extern register)
+       uintptr tls[4];         // thread-local storage (for x86 extern register)
+       void    (*mstartfn)(void);
        G*      curg;           // current running goroutine
        P*      p;              // attached P for executing Go code (nil if not executing Go code)
        P*      nextp;
index f779c666e70eb3dbd2a6ee77979409f268e54d3a..0b472e30749961b33bdc550ccc62e88c6ba1cc63 100644 (file)
@@ -39,9 +39,10 @@ TEXT runtime·thr_start(SB),7,$0
        MOVL    AX, m(CX)
        CALL    runtime·stackcheck(SB)         // smashes AX
 
-       // newosproc left the function we should call in mp->tls[2] for us.
+       // newosproc left the function we should call in mp->mstartfn.
        get_tls(CX)
-       MOVQ    8(CX), AX
+       MOVL    m(CX), AX
+       MOVL    m_mstartfn(AX), AX
        CALL    AX
 
        MOVL    0, AX                   // crash (not reached)
index 94f37021c538000f1f1b36a7de52b33cdbe891cf..218851b78212333e1f48df28d19ef529d3504022 100644 (file)
@@ -34,16 +34,16 @@ TEXT runtime·thr_start(SB),7,$0
 
        // set up m, g
        get_tls(CX)
-       MOVQ    8(CX), AX
        MOVQ    R13, m(CX)
        MOVQ    m_g0(R13), DI
        MOVQ    DI, g(CX)
 
        CALL runtime·stackcheck(SB)
        
-       // newosproc left the function we should call in mp->tls[2] for us.
+       // newosproc left the function we should call in mp->mstartfn.
        get_tls(CX)
-       MOVQ    16(CX), AX
+       MOVQ    m(CX), AX
+       MOVQ    m_mstartfn(AX), AX
        CALL    AX
 
        MOVQ 0, AX                      // crash (not reached)
index 4cb725e197e6d048f5fe09f023b779e2443ec3c9..2c3c5d465c9db0513b5ba1f78dcf54ada82b3fe6 100644 (file)
@@ -260,9 +260,10 @@ TEXT runtime·tstart(SB),7,$0
 
        CALL    runtime·stackcheck(SB) // clobbers AX,CX
 
-       // start function is in tls[2]
+       // newosproc left the function we should call in mp->mstartfn.
        get_tls(CX)
-       MOVL    8(CX), AX
+       MOVL    m(CX), AX
+       MOVL    m_mstartfn(AX), AX
        CALL    AX
 
        RET
index 94e5d79917ac75277664cc4543ff59865cfdc46a..dc9c94ae4c1119950c7bb82ebfe1e1c5891e3a3a 100644 (file)
@@ -330,9 +330,9 @@ TEXT runtime·tstart_stdcall(SB),7,$0
 
        CALL    runtime·stackcheck(SB) // clobbers AX,CX
 
-       // start function is in tls[2]
        get_tls(CX)
-       MOVQ    16(CX), AX
+       MOVQ    m(CX), AX
+       MOVQ    m_mstartfn(AX), AX
        CALL    AX
 
        XORL    AX, AX                  // return 0 == success
index 06edc22fe1e5e10ec58dc27dd953044b72c8e459..aae52ea379c5bb48a1e8e240269ed9ddc9c4d54f 100644 (file)
@@ -104,7 +104,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
        param.tls_size = sizeof mp->tls;
 
        mp->tls[0] = mp->id;    // so 386 asm can find it
-       mp->tls[2] = (uintptr)fn;
+       mp->mstartfn = fn;
 
        runtime·thr_new(&param, sizeof param);
        runtime·sigprocmask(&oset, nil);
index 5ff35b811ed06593815126f0a20625ffbf1219e5..06326c2187a646771c119f3e41d878e7ce3521ef 100644 (file)
@@ -197,7 +197,7 @@ runtime·newosproc(M *mp, G *gp, void *stk, void (*fn)(void))
        if(gp != mp->g0)
                runtime·throw("invalid newosproc gp");
 
-       mp->tls[2] = (uintptr)fn;
+       mp->mstartfn = fn;
 
        thandle = runtime·stdcall(runtime·CreateThread, 6,
                nil, (uintptr)0x20000, runtime·tstart_stdcall, mp,