summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/cgo/gcc_linux_386.c
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-05-14 18:39:35 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-05-14 18:39:35 +0200
commitefcc50dfdc94c82ee0292bf71992ecb7c0123061 (patch)
tree17dca99d1dc7fc4e9fe49c2cf6a99d337d4c039f /src/pkg/runtime/cgo/gcc_linux_386.c
parent04b08da9af0c450d645ab7389d1467308cfc2db8 (diff)
downloadgolang-efcc50dfdc94c82ee0292bf71992ecb7c0123061.tar.gz
Imported Upstream version 1.1upstream/1.1
Diffstat (limited to 'src/pkg/runtime/cgo/gcc_linux_386.c')
-rw-r--r--src/pkg/runtime/cgo/gcc_linux_386.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/pkg/runtime/cgo/gcc_linux_386.c b/src/pkg/runtime/cgo/gcc_linux_386.c
index 9357a63f7..c25c7b70f 100644
--- a/src/pkg/runtime/cgo/gcc_linux_386.c
+++ b/src/pkg/runtime/cgo/gcc_linux_386.c
@@ -8,13 +8,15 @@
#include "libcgo.h"
static void *threadentry(void*);
+static void (*setmg_gcc)(void*, void*);
void
-x_cgo_init(G *g)
+x_cgo_init(G *g, void (*setmg)(void*, void*))
{
pthread_attr_t attr;
size_t size;
+ setmg_gcc = setmg;
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
g->stackguard = (uintptr)&attr - size + 4096;
@@ -69,18 +71,9 @@ threadentry(void *v)
ts.g->stackguard = (uintptr)&ts - ts.g->stackguard + 4096;
/*
- * Set specific keys. On Linux/ELF, the thread local storage
- * is just before %gs:0. Our dynamic 8.out's reserve 8 bytes
- * for the two words g and m at %gs:-8 and %gs:-4.
- * Xen requires us to access those words indirect from %gs:0
- * which points at itself.
+ * Set specific keys.
*/
- asm volatile (
- "movl %%gs:0, %%eax\n" // MOVL 0(GS), tmp
- "movl %0, -8(%%eax)\n" // MOVL g, -8(GS)
- "movl %1, -4(%%eax)\n" // MOVL m, -4(GS)
- :: "r"(ts.g), "r"(ts.m) : "%eax"
- );
+ setmg_gcc((void*)ts.m, (void*)ts.g);
crosscall_386(ts.fn);
return nil;