1
0
mirror of https://github.com/golang/go synced 2024-10-03 08:11:27 -06:00
Commit Graph

55 Commits

Author SHA1 Message Date
Russ Cox
81041369b2 runtime: fix build
On systems where the mmap succeeds
(e.g., sysctl -w vm.mmap_min_addr=0)
it changes the signal code delivered for a
nil fault from ``page not mapped'' to
``invalid permissions for page.''

TBR=r
CC=golang-dev
https://golang.org/cl/2294041
2010-09-28 20:50:00 -04:00
Russ Cox
649aab835f runtime: add mmap of null page just in case
R=r, iant, robert.swiecki, rsc1
CC=golang-dev
https://golang.org/cl/1904044
2010-09-28 20:30:01 -04:00
Russ Cox
929fdd860b runtime: correct stats in SysFree
R=r
CC=golang-dev
https://golang.org/cl/2254047
2010-09-27 12:50:01 -04:00
Russ Cox
befecf6b59 runtime: fix crash trace on amd64
g is not in r15 anymore.
now it's in a per-thread memory segment,
which is valid even inside a signal handler,
so we can just refer to g directly.

Fixes #1082.

R=r
CC=golang-dev
https://golang.org/cl/2149045
2010-09-11 00:26:56 -04:00
Rob Pike
66f676b8ef arm: fix a couple of build bugs.
tests have not been run yet

R=stephenm
CC=golang-dev
https://golang.org/cl/2165046
2010-09-09 23:31:33 -07:00
Russ Cox
636342292c runtime: fix linux/amd64 build: wrong name for munmap
TBR=r
CC=golang-dev
https://golang.org/cl/2140043
2010-09-07 13:17:10 -04:00
Russ Cox
d4cc557b0d runtime: use manual stack for garbage collection
Old code was using recursion to traverse object graph.
New code uses an explicit stack, cutting the per-pointer
footprint to two words during the recursion and avoiding
the standard allocator and stack splitting code.

in test/garbage:

Reduces parser runtime by 2-3%
Reduces Peano runtime by 40%
Increases tree runtime by 4-5%

R=r
CC=golang-dev
https://golang.org/cl/2150042
2010-09-07 09:57:22 -04:00
Russ Cox
e473f42b2d amd64: use segment memory for thread-local storage
Returns R14 and R15 to the available register pool.
Plays more nicely with ELF ABI C code.
In particular, our signal handlers will no longer crash
when a signal arrives during execution of a cgo C call.

Fixes #720.

R=ken2, r
CC=golang-dev
https://golang.org/cl/1847051
2010-08-04 17:50:22 -07:00
Russ Cox
68b0a87966 runtime: do not fall through in SIGBUS/SIGSEGV
Faults beyond the first page are not expected
and should fail loudly.  They are not subject to recover.

R=r
CC=golang-dev
https://golang.org/cl/1915042
2010-07-30 11:32:55 -07:00
Russ Cox
2d6ae385e1 linux/386: use Xen-friendly ELF TLS instruction sequence
Fixes #465.

R=iant
CC=golang-dev
https://golang.org/cl/1665051
2010-07-17 16:54:03 -07:00
Ian Lance Taylor
807605d0fc Only catch all signals if os/signal package imported.
Fixes #776.

R=rsc
CC=golang-dev
https://golang.org/cl/1745041
2010-06-28 17:14:17 -07:00
Russ Cox
53a529ab2b runtime: fix 386 signal handler bug
Cannot assume that g == m->curg at time of signal.
Must save actual g and restore.

Fixes flaky crashes with messages like

throw: malloc mlookup
throw: malloc/free - deadlock
throw: unwindstack on self
throw: free mlookup

(and probably others) when running cgo.

R=iant
CC=golang-dev
https://golang.org/cl/1648043
2010-06-12 10:48:04 -07:00
Russ Cox
4843b130bb runtime: avoid allocation for fixed strings
R=r
CC=golang-dev
https://golang.org/cl/1083041
2010-05-19 21:33:31 -07:00
Russ Cox
c3e54f0988 runtime: better trace for fault due to nil pointer call
R=r
CC=golang-dev
https://golang.org/cl/854048
2010-04-13 22:31:47 -07:00
Ian Lance Taylor
a4f8d36ba5 Run initcgo for all amd64 targets, not just GNU/Linux.
This is required to make cgo export work on Darwin.  Note that
this corrects the stack alignment when calling initcgo to that
required by gcc on amd64.

R=rsc
CC=golang-dev
https://golang.org/cl/907041
2010-04-09 14:15:15 -07:00
Russ Cox
5963dbac08 runtime: turn divide by zero, nil dereference into panics
tested on linux/amd64, linux/386, linux/arm, darwin/amd64, darwin/386.
freebsd untested; will finish in a separate CL.

for now all the panics are errorStrings.
richer structures can be added as necessary
once the mechanism is shaked out.

R=r
CC=golang-dev
https://golang.org/cl/906041
2010-04-08 18:15:30 -07:00
Russ Cox
d89b357f76 runtime: handle malloc > 2GB correctly
R=ken2
CC=golang-dev
https://golang.org/cl/821048
2010-04-05 17:26:59 -07:00
Russ Cox
6c196015e0 runtime: various arm fixes
* correct symbol table size
  * do not reorder functions in output
  * traceback
  * signal handling
  * use same code for go + defer
  * handle leaf functions in symbol table

R=kaib, dpx
CC=golang-dev
https://golang.org/cl/884041
2010-04-05 12:51:09 -07:00
Christopher Wedgwood
d166d1629a runtime: Remove unused runtime.write from linux/amd64
Also minor reformatting.

R=rsc
CC=golang-dev
https://golang.org/cl/845041
2010-03-29 22:51:39 -07:00
Russ Cox
8ba5c5593f runtime: work around Linux kernel bug in futex
Fixes #420.

R=r
CC=golang-dev
https://golang.org/cl/218065
2010-02-22 20:45:36 -08:00
Russ Cox
66cdc699b2 arm: fix build on android
R=kaib
CC=golang-dev
https://golang.org/cl/206059
2010-02-10 15:01:02 -08:00
Russ Cox
62d627f0bc runtime: allow arbitrary return type in SetFinalizer.
finalize chan, to free OS X semaphore inside Lock.
os: finalize File, to close fd.

Fixes #503.

R=ken2
CC=golang-dev
https://golang.org/cl/204065
2010-02-08 21:41:54 -08:00
Russ Cox
e4f06812c5 runtime: instrument malloc + garbage collector.
add simple garbage collection benchmark.

R=iant
CC=golang-dev
https://golang.org/cl/204053
2010-02-08 14:32:22 -08:00
Christopher Wedgwood
43d2e59a81 os/signal: send SIGCHLDs to Incoming
R=rsc
CC=golang-dev
https://golang.org/cl/199082
2010-02-03 23:24:28 -08:00
Russ Cox
718be3215f in C and asm, replace pkg·name with ·name
(eliminate assumption of package global name space,
make code easier to move between packages).

R=r
CC=golang-dev
https://golang.org/cl/194072
2010-01-25 18:52:55 -08:00
Devon H. O'Dell
1564b984a5 runtime: GS already set up by setldt in Linux/386; remove duplicate
R=rsc
CC=golang-dev
https://golang.org/cl/186146
2010-01-13 17:50:12 -08:00
Russ Cox
12518e441b runtime cleanup.
* move memory code into $GOOS-specific directory.
  * allow printing of static strings < 256 bytes.
    (dynamic strings will bump maxstring as they are allocated.)
  * use cgo2c for runtime.mal.

R=r, dho
CC=golang-dev
https://golang.org/cl/186143
2010-01-13 17:50:02 -08:00
Hector Chu
6bfe5f55f4 Ported runtime to Windows.
R=rsc
CC=golang-dev
https://golang.org/cl/176066
2010-01-06 17:58:55 -08:00
Russ Cox
08579c26dd runtime: if os/signal is not in use, crash on
most signals, so that ordinary programs
	can be killed, for example.

Fixes #434.

R=dsymonds1
CC=golang-dev, hoisie
https://golang.org/cl/180064
2009-12-16 20:20:50 -08:00
David Symonds
b5866494ea os/signal: new package
Fixes #71.

R=rsc, r
https://golang.org/cl/162056
2009-12-15 18:21:29 -08:00
Devon H. O'Dell
5a4a08fab8 Fix stack on FreeBSD / add stack check across the board
FreeBSD was passing stk as the new thread's stack base, while
stk is the top of the stack in go. The added check should cause
a trap if this ever comes up in any new ports, or regresses
in current ones.

R=rsc
CC=golang-dev
https://golang.org/cl/167055
2009-12-08 18:19:30 -08:00
William Josephson
4c0f262a2d Remove unnecessary execute bits.
R=rsc
https://golang.org/cl/156077
2009-11-18 09:19:29 -08:00
Russ Cox
a65bf95dd8 syscall: use correct pointer in recvfrom/sendto.
linux/386 stack trace: use 32-bit hex.

Fixes #159.

R=r
https://golang.org/cl/154178
2009-11-17 08:39:04 -08:00
Devon H. O'Dell
0489a260da FreeBSD-specific porting work.
cgo/libmach remain unimplemented. However, compilers, runtime,
and packages are 100%. I still need to go through and implement
missing syscalls (at least make sure they're all listed), but
for all shipped functionality, this is done. Ship! ;)

R=rsc, VenkateshSrinivas
https://golang.org/cl/152142
2009-11-17 08:20:58 -08:00
Adam Langley
3f7a32405d runtime: warn about SELinux based mmap failures on Linux.
SELinux will cause mmap to fail when we request w+x memory unless the
user has configured their policies. We have a warning in make.bash,
but it's quite likely that the policy will be reset at some point and
then all their binaries start failing.

This patch prints a warning on Linux when mmap fails with EACCES.

R=rsc
CC=golang-dev
https://golang.org/cl/152086
2009-11-13 10:08:51 -08:00
Kai Backman
6dbd142951 add cache flushing call after generating closure.
go/test: passes 88% (306/347)

R=rsc
https://golang.org/cl/152089
2009-11-11 23:23:11 -08:00
Kai Backman
52c549fc9b make 5g executables run on android/arm hardware. change OABI
usage to EABI.

        go/test: passes 85% (296/347) on random android phone.

R=rsc
http://go/go-review/1024003
2009-11-05 22:53:08 -08:00
Kai Backman
770b872752 clone and futex
go/test: passes 99% (343/347)

R=rsc
http://go/go-review/1016004
2009-10-29 21:21:14 -07:00
Ian Lance Taylor
f529224039 Get the right sigaction struct for the 386 rt_sigaction system
call.  This uses the header files from a 32-bit Ubuntu Hardy
system.

The use of _LOOSE_KERNEL_NAMES seems right.  The
-D__ARCH_SI_UID_T works around a bug which appears to be fixed
in later Linux versions.

R=rsc
http://go/go-review/1013015
2009-10-26 22:49:08 -07:00
Kai Backman
6f91ba1b0f proper syscall convention for arm
R=rsc
http://go/go-review/1015009
2009-10-25 11:51:16 -07:00
Ian Lance Taylor
fd5fa4b301 Fix the sigaction declaration to match the system for Linux.
I don't know whether Darwin needs a change here.

R=rsc
http://go/go-review/1013010
2009-10-22 23:51:54 -07:00
Ian Lance Taylor
057f7d5b07 s/pc/PC/ in traceback output to match amd64.
test/run expects to see "PC".

R=rsc
http://go/go-review/1015002
2009-10-22 23:38:34 -07:00
Russ Cox
22a5c78f44 rename sys functions to runtime,
because they are in package runtime.

another step to enforcing package boundaries.

R=r
DELTA=732  (114 added, 93 deleted, 525 changed)
OCL=35811
CL=35824
2009-10-15 23:10:49 -07:00
Russ Cox
133a158bd8 8c, 8l dynamic loading support.
better mach binaries.
cgo working on darwin+linux amd64+386.
eliminated context switches - pi is 30x faster.
add libcgo to build.

on snow leopard:
  - non-cgo binaries work; all tests pass.
  - cgo binaries work on amd64 but not 386.

R=r
DELTA=2031  (1316 added, 626 deleted, 89 changed)
OCL=35264
CL=35304
2009-10-03 10:37:12 -07:00
Russ Cox
e67a5084b8 cgo working on linux/386
R=r
DELTA=70  (47 added, 4 deleted, 19 changed)
OCL=35167
CL=35171
2009-09-30 13:47:15 -07:00
Russ Cox
1b14bdbf1c changes to accommodate nacl:
* change ldt0setup to set GS itself; nacl won't let us do it.
  * change breakpoint to INT $3 so 8l can translate to HLT for nacl.
  * panic if closure is needed on nacl.
  * do not try to access symbol table on nacl.
  * mmap in 64kB chunks.

nacl support:
  * system calls, threading, locks.

R=r
DELTA=365  (357 added, 5 deleted, 3 changed)
OCL=34880
CL=34906
2009-09-22 16:28:32 -07:00
Russ Cox
bbcb91a3a7 convert 386 to use %gs instead of %fs for extern register.
required for nacl and may be nicer for ffi,
because %gs is the standard register for thread-local storage.

R=ken
OCL=34861
CL=34866
2009-09-21 15:46:50 -07:00
Kai Backman
46e392e01c changed 5c calling convention to use stack exclusively for in
params. a number of fixes to assembly routines that assumed R0
had the first arg. one stack offset fix, arm pushes the link
register on stack top.

go/test: passes 65% (235/364) tests

R=rsc
APPROVED=rsc
DELTA=20  (11 added, 0 deleted, 9 changed)
OCL=34809
CL=34812
2009-09-18 16:45:41 -07:00
Russ Cox
fdc4b4a47f start of FFI support, and a demo.
R=r
DELTA=494  (492 added, 0 deleted, 2 changed)
OCL=33784
CL=33810
2009-08-24 17:30:00 -07:00
Russ Cox
1f177cd8b2 linker work
* use //ffi comments in package import data
    to generate relocation entries and library loads.
  * call initffi in rt0.s if present

R=r
DELTA=117  (91 added, 3 deleted, 23 changed)
OCL=33739
CL=33750
2009-08-24 10:19:31 -07:00