summaryrefslogtreecommitdiff
path: root/src/runtime/cgo/callbacks.c
Commit message (Collapse)AuthorAgeFilesLines
* [dev.cc] runtime/cgo: convert from C to GoRuss Cox2014-11-111-83/+0
| | | | | | | | | | | | | The conversion was done with an automated tool and then modified only as necessary to make it compile and run. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://codereview.appspot.com/168500043
* runtime: add load_g call in arm callback.Keith Randall2014-09-251-2/+2
| | | | | | | | | Need to restore the g register. Somehow this line vaporized from CL 144130043. Also cgo_topofstack -> _cgo_topofstack, that vaporized also. TBR=rsc CC=golang-codereviews https://codereview.appspot.com/150940044
* cgo: adjust return value location to account for stack copies.Keith Randall2014-09-251-0/+3
| | | | | | | | | | | | | | | | During a cgo call, the stack can be copied. This copy invalidates the pointer that cgo has into the return value area. To fix this problem, pass the address of the location containing the stack top value (which is in the G struct). For cgo functions which return values, read the stktop before and after the cgo call to compute the adjustment necessary to write the return value. Fixes issue 8771 LGTM=iant, rsc R=iant, rsc, khr CC=golang-codereviews https://codereview.appspot.com/144130043
* liblink, runtime: diagnose and fix C code running on Go stackRuss Cox2014-09-081-26/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL contains compiler+runtime changes that detect C code running on Go (not g0, not gsignal) stacks, and it contains corrections for what it detected. The detection works by changing the C prologue to use a different stack guard word in the G than Go prologue does. On the g0 and gsignal stacks, that stack guard word is set to the usual stack guard value. But on ordinary Go stacks, that stack guard word is set to ^0, which will make any stack split check fail. The C prologue then calls morestackc instead of morestack, and morestackc aborts the program with a message about running C code on a Go stack. This check catches all C code running on the Go stack except NOSPLIT code. The NOSPLIT code is allowed, so the check is complete. Since it is a dynamic check, the code must execute to be caught. But unlike the static checks we've been using in cmd/ld, the dynamic check works with function pointers and other indirect calls. For example it caught sigpanic being pushed onto Go stacks in the signal handlers. Fixes issue 8667. LGTM=khr, iant R=golang-codereviews, khr, iant CC=golang-codereviews, r https://codereview.appspot.com/133700043
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+102
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.