summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2011-01-06 11:36:47 -0500
committerAnthony Martin <ality@pbrane.org>2011-01-06 11:36:47 -0500
commit662401560fc7a35740efa6466d93a39f9dffb8bd (patch)
treef859a5510a75e87a3ab638b3abbc06c1f308f603
parent1a82d45af7e87f5a5b1243698d725a0c74167451 (diff)
downloadgo-662401560fc7a35740efa6466d93a39f9dffb8bd.tar.gz
runtime/cgo: fix stackguard on FreeBSD/amd64
A cursory reading of the cgo code suggests this should be necessary, though I don't have access to a FreeBSD machine for testing. R=rsc, adg CC=golang-dev http://codereview.appspot.com/3746047 Committer: Russ Cox <rsc@golang.org>
-rw-r--r--src/pkg/runtime/cgo/freebsd_amd64.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/cgo/freebsd_amd64.c b/src/pkg/runtime/cgo/freebsd_amd64.c
index a02fbf151..fe6ce391f 100644
--- a/src/pkg/runtime/cgo/freebsd_amd64.c
+++ b/src/pkg/runtime/cgo/freebsd_amd64.c
@@ -38,6 +38,12 @@ threadentry(void *v)
ts.g->stackbase = (uintptr)&ts;
/*
+ * libcgo_sys_thread_start set stackguard to stack size;
+ * change to actual guard pointer.
+ */
+ ts.g->stackguard = (uintptr)&ts - ts.g->stackguard + 4096;
+
+ /*
* Set specific keys. On FreeBSD/ELF, the thread local storage
* is just before %fs:0. Our dynamic 6.out's reserve 16 bytes
* for the two words g and m at %fs:-16 and %fs:-8.