runtime: save g to TLS more aggressively

This is one of those "how did this ever work?" bugs.
The current build failures are happening because
a fault comes up while executing on m->curg on a
system-created thread using an m obtained from needm,
but TLS is set to m->g0, not m->curg. On fault,
sigtramp starts executing, assumes r10 (g) might be
incorrect, reloads it from TLS, and gets m->g0, not
m->curg. Then sighandler dutifully pushes a call to
sigpanic onto the stack and returns to it.
We're now executing on the m->curg stack but with
g=m->g0. Sigpanic does a stack split check, sees that
the SP is not in range (50% chance depending on relative
ordering of m->g0's and m->curg's stacks), and then
calls morestack. Morestack sees that g=m->g0 and
crashes the program.

The fix is to replace every change of g in asm_arm.s
with a call to a function that both updates g and
saves the updated g to TLS.

Why did it start happening? That's unclear.
Unfortunately there were other bugs in the initial
checkin that mask exactly which of a sequence of
CLs started the behavior where sigpanic would end
up tripping the stack split.

Fixes arm build.
Fixes issue 8675.

LGTM=iant
R=golang-codereviews, iant
CC=dave, golang-codereviews, khr, minux, r
https://codereview.appspot.com/135570043
net/http/httptest: fix deadlock in TestIssue7264

I am seeing deadlocks waiting on <-inHandler.
It seems to me that there is no guarantee that the
handler actually runs, if the client does

        write header
        close connection

fast enough. The server might see the EOF on the
connection before it manages to invoke the handler.

This change fixes the deadlock, but it may make
the test not actually test anything. Not sure.

LGTM=bradfitz
R=bradfitz, dvyukov
CC=golang-codereviews
https://codereview.appspot.com/140970043
runtime: fix semacquire->acquireSudog->malloc->gogc->semacquire loop

This is what broke the build at
http://build.golang.org/log/d9c6d334be16cbab85e99fddc6b4ba034319bd4e

LGTM=iant
R=golang-codereviews, iant
CC=dvyukov, golang-codereviews, khr, r
https://codereview.appspot.com/135580043
net/http/httptest: delete TestIssue7264

Now it's failing on Windows:

panic: httptest: failed to listen on a port: listen tcp 127.0.0.1:0:
listen: An operation on a socket could not be performed because the
system lacked sufficient buffer space or because a queue was full.

Since we can't seem to understand what the test is trying to test,
and because it is causing problems on multiple systems,
delete it.

Fixes issue 7264.

TBR=bradfitz
CC=brainman, golang-codereviews
https://codereview.appspot.com/141210043
runtime: implement time.now in assembly on plan9, solaris, windows

These all used a C implementation that contained 64-bit divide by 1000000000.
On 32-bit systems that ends up in the 64-bit C divide support, which makes
other calls and ends up using a fair amount of stack. We could convert them
to Go but then they'd still end up in software 64-bit divide code. That would
be okay, because Go code can split the stack, but it's still unnecessary.

Write time·now in assembly, just like on all the other systems, and use the
actual hardware support for 64/32 -> 64/32 division. This cuts the software
routines out entirely.

The actual code to do the division is copied and pasted from the sys_darwin_*.s files.

LGTM=alex.brainman
R=golang-codereviews, alex.brainman
CC=aram, golang-codereviews, iant, khr, r
https://codereview.appspot.com/136300043
net/http: add Transport.DialTLS hook

Per discussions out of https://codereview.appspot.com/128930043/
and golang-nuts threads and with agl.

Fixes Issue 8522

LGTM=agl, adg
R=agl, c, adg
CC=c, golang-codereviews
https://codereview.appspot.com/137940043
doc: add a few http items to go1.4.txt

CC=golang-codereviews
https://codereview.appspot.com/132670045
build: adjustments for move from src/pkg to src

This CL adjusts code referring to src/pkg to refer to src.

Immediately after submitting this CL, I will submit
a change doing 'hg mv src/pkg/* src'.
That change will be too large to review with Rietveld
but will contain only the 'hg mv'.

This CL will break the build.
The followup 'hg mv' will fix it.

For more about the move, see golang.org/s/go14nopkg.

LGTM=r
R=r
CC=golang-codereviews
https://codereview.appspot.com/134570043
build: move package sources from src/pkg to src

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.
build: more adjustments for move from src/pkg to src

These were missed in CL 134570043.

Fixes nacl, solaris builds.

TBR=r
CC=golang-codereviews
https://codereview.appspot.com/136320043
doc/go1.4.txt: src/pkg directory is gone.

CC=golang-codereviews
https://codereview.appspot.com/139310043
cmd/gc: fix undefined behaviour warning in subr.c

Fixes warning

/home/dfc/go/src/cmd/gc/subr.c:3469:8: runtime error: negation of -9223372036854775808 cannot be represented in type 'int64' (aka 'long'); cast to an unsigned type to negate this value to itself

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/141220043
cmd/cc: fix undefined behaviour warning in bv.c

Fixes warning

# _/home/dfc/go/misc/cgo/test/backdoor
/home/dfc/go/src/cmd/cc/bv.c:43:11: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

LGTM=rsc
R=rsc
CC=golang-codereviews
https://codereview.appspot.com/136330043