summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/cgo/windows_386.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/cgo/windows_386.c')
-rwxr-xr-xsrc/pkg/runtime/cgo/windows_386.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pkg/runtime/cgo/windows_386.c b/src/pkg/runtime/cgo/windows_386.c
index 5f5235bd2..f39309cb1 100755
--- a/src/pkg/runtime/cgo/windows_386.c
+++ b/src/pkg/runtime/cgo/windows_386.c
@@ -30,6 +30,7 @@ static void*
threadentry(void *v)
{
ThreadStart ts;
+ void *tls0;
ts = *(ThreadStart*)v;
free(v);
@@ -45,13 +46,17 @@ threadentry(void *v)
/*
* Set specific keys in thread local storage.
*/
+ tls0 = (void*)LocalAlloc(LPTR, 32);
asm volatile (
- "MOVL %%fs:0x2c, %%eax\n" // MOVL 0x24(FS), tmp
- "movl %0, 0(%%eax)\n" // MOVL g, 0(FS)
- "movl %1, 4(%%eax)\n" // MOVL m, 4(FS)
- :: "r"(ts.g), "r"(ts.m) : "%eax"
+ "movl %0, %%fs:0x2c\n" // MOVL tls0, 0x2c(FS)
+ "movl %%fs:0x2c, %%eax\n" // MOVL 0x2c(FS), tmp
+ "movl %1, 0(%%eax)\n" // MOVL g, 0(FS)
+ "movl %2, 4(%%eax)\n" // MOVL m, 4(FS)
+ :: "r"(tls0), "r"(ts.g), "r"(ts.m) : "%eax"
);
crosscall_386(ts.fn);
+
+ LocalFree(tls0);
return nil;
}