#endif
/*
- * void crosscall_386(void (*fn)(void))
+ * void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g)
*
- * Calling into the 8c tool chain, where all registers are caller save.
+ * Calling into the gc tool chain, where all registers are caller save.
* Called from standard x86 ABI, where %ebp, %ebx, %esi,
* and %edi are callee-save, so they must be saved explicitly.
*/
-.globl EXT(crosscall_386)
-EXT(crosscall_386):
+.globl EXT(crosscall1)
+EXT(crosscall1):
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %esi
pushl %edi
+ movl 16(%ebp), %eax /* g */
+ pushl %eax
+ movl 12(%ebp), %eax /* setg_gcc */
+ call *%eax
+ popl %eax
+
movl 8(%ebp), %eax /* fn */
call *%eax
}
}
+extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
static void*
threadentry(void *v)
{
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_386(ts.fn);
+ crosscall1(ts.fn, setg_gcc, ts.g);
return nil;
}
}
}
+extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
static void*
threadentry(void *v)
{
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_386(ts.fn);
+ crosscall1(ts.fn, setg_gcc, ts.g);
return nil;
}
}
}
+extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
static void*
threadentry(void *v)
{
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
// On NetBSD, a new thread inherits the signal stack of the
// creating thread. That confuses minit, so we remove that
// signal stack here before calling the regular mstart. It's
ss.ss_flags = SS_DISABLE;
sigaltstack(&ss, nil);
- crosscall_386(ts.fn);
+ crosscall1(ts.fn, setg_gcc, ts.g);
return nil;
}
}
}
+extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
static void*
threadentry(void *v)
{
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_386(ts.fn);
+ crosscall1(ts.fn, setg_gcc, ts.g);
return nil;
}
#include "libcgo_windows.h"
static void threadentry(void*);
+static void (*setg_gcc)(void*);
static DWORD *tls_g;
void
x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase)
{
+ setg_gcc = setg;
tls_g = (DWORD *)tlsg;
}
-
void
_cgo_sys_thread_start(ThreadStart *ts)
{
_cgo_beginthread(threadentry, ts);
}
+extern void crosscall1(void (*fn)(void), void (*setg_gcc)(void*), void *g);
static void
threadentry(void *v)
{
:: "r"(ts.tls), "r"(*tls_g), "r"(ts.g) : "%eax"
);
- crosscall_386(ts.fn);
+ crosscall1(ts.fn, setg_gcc, ts.g);
}
*/
uintptr_t _cgo_wait_runtime_init_done(void);
-/*
- * Call fn in the 8c world.
- */
-void crosscall_386(void (*fn)(void));
-
/*
* Prints error then calls abort. For linux and android.
*/