1
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
11
static void* threadentry(void*);
12
static void (*setmg_gcc)(void*, void*);
15
x_cgo_init(G *g, void (*setmg)(void*, void*))
21
pthread_attr_init(&attr);
22
pthread_attr_getstacksize(&attr, &size);
23
g->stackguard = (uintptr)&attr - size + 4096;
24
pthread_attr_destroy(&attr);
29
_cgo_sys_thread_start(ThreadStart *ts)
38
sigprocmask(SIG_SETMASK, &ign, &oset);
40
pthread_attr_init(&attr);
41
pthread_attr_getstacksize(&attr, &size);
43
ts->g->stackguard = size;
44
err = pthread_create(&p, &attr, threadentry, ts);
46
sigprocmask(SIG_SETMASK, &oset, nil);
49
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
59
ts = *(ThreadStart*)v;
62
ts.g->stackbase = (uintptr)&ts;
65
* _cgo_sys_thread_start set stackguard to stack size;
66
* change to actual guard pointer.
68
ts.g->stackguard = (uintptr)&ts - ts.g->stackguard + 4096;
73
setmg_gcc((void*)ts.m, (void*)ts.g);
75
crosscall_amd64(ts.fn);