summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/darwin
AgeCommit message (Collapse)AuthorFilesLines
2011-04-28Imported Upstream version 2011.04.27upstream/2011.04.27Ondřej Surý6-0/+42
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý8-45/+160
2011-04-20Imported Upstream version 2011.03.07.1upstream/2011.03.07.1Ondřej Surý5-35/+36
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý7-32/+24
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý14-306/+404
2010-06-28Only catch all signals if os/signal package imported.Ian Lance Taylor2-2/+6
Fixes issue 776. R=rsc CC=golang-dev http://codereview.appspot.com/1745041
2010-06-14runtime: correct fault for 16-bit divide on LeopardRuss Cox2-2/+6
R=r CC=golang-dev http://codereview.appspot.com/1703041
2010-06-12runtime: fix 386 signal handler bugRuss Cox1-4/+8
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 http://codereview.appspot.com/1648043
2010-05-19runtime: avoid allocation for fixed stringsRuss Cox2-2/+2
R=r CC=golang-dev http://codereview.appspot.com/1083041
2010-05-03runtime: update godefs usage comment for GOARCH=386 GOOS={darwin,freebsd}Giles Lean2-2/+2
When trying to regenerate src/pkg/runtime/darwin/386/defs.h on a 64 bit capable Snow Leopard (OS X 10.6.3) system I needed to add -f -m32 to godefs, as this OS and hardware combination defaults to 64 bit compilation. For safety, make the same change to the 32 bit FreeBSD instructions in .../freebsd/defs.c. (Tested OK and no problems introduced.) R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/1052042 Committer: Russ Cox <rsc@golang.org>
2010-04-28darwin: bsdthread_create can fail; print good errorRuss Cox4-6/+11
Fixes issue 549. R=adg CC=golang-dev http://codereview.appspot.com/1019042
2010-04-13runtime: better trace for fault due to nil pointer callRuss Cox2-7/+23
R=r CC=golang-dev http://codereview.appspot.com/854048
2010-04-08runtime: turn divide by zero, nil dereference into panicsRuss Cox8-15/+236
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 http://codereview.appspot.com/906041
2010-04-08runtime: work around kernel bug in Snow Leopard signal handlingRuss Cox2-63/+22
Could not take a signal on threads other than the main thread. If you look at the spinning binary with dtrace, you can see a fault happening over and over: $ dtrace -n ' fbt::user_trap:entry /execname=="boot32" && self->count < 10/ { self->count++; printf("%s %x %x %x %x", probefunc, arg1, arg2, arg3, arg4); stack(); tracemem(arg4, 256); }' dtrace: description 'fbt::user_trap:entry ' matched 1 probe CPU ID FUNCTION:NAME 1 17015 user_trap:entry user_trap 0 10 79af0a0 79af0a0 mach_kernel`lo_alltraps+0x12a 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: 0e 00 00 00 37 00 00 00 00 00 00 00 1f 00 00 00 ....7........... 10: 1f 00 00 00 a8 33 00 00 00 00 00 01 00 00 00 00 .....3.......... 20: 98 ba dc fe 07 09 00 00 00 00 00 00 98 ba dc fe ................ 30: 06 00 00 00 0d 00 00 00 34 00 00 00 9e 1c 00 00 ........4....... 40: 17 00 00 00 00 02 00 00 ac 30 00 00 1f 00 00 00 .........0...... 50: 00 00 00 00 00 00 00 00 0d 00 00 00 e0 e6 29 00 ..............). 60: 34 00 00 00 00 00 00 00 9e 1c 00 00 00 00 00 00 4............... 70: 17 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 ................ 80: ac 30 00 00 00 00 00 00 1f 00 00 00 00 00 00 00 .0.............. 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ a0: 48 00 00 00 10 00 00 00 85 00 00 00 a0 f2 29 00 H.............). b0: 69 01 00 02 00 00 00 00 e6 93 04 82 ff 7f 00 00 i............... c0: 2f 00 00 00 00 00 00 00 06 02 00 00 00 00 00 00 /............... d0: 78 ee 42 01 01 00 00 00 1f 00 00 00 00 00 00 00 x.B............. e0: 00 ed 9a 07 00 00 00 00 00 00 00 00 00 00 00 00 ................ f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ... The memory dump shows a 32-bit exception frame: x86_saved_state32 gs = 0x37 fs = 0 es = 0x1f ds = 0x1f edi = 0x33a8 esi = 0x01000000 ebp = 0 cr2 = 0xfedcba98 ebx = 0x0907 edx = 0 ecx = 0xfedcba98 eax = 0x06 trapno = 0x0d err = 0x34 eip = 0x1c9e cs = 0x17 efl = 0x0200 uesp = 0x30ac ss = 0x1f The cr2 of 0xfedcba98 is the address that the new thread read to cause the fault, but note that the trap is now a GP fault with error code 0x34, meaning it's moved past the cr2 problem and on to an invaild segment selector. The 0x34 is suspiciously similar to the 0x37 in gs, and sure enough, OS X forces gs to have that value in the signal handler, and if your thread hasn't set up that segment (known as USER_CTHREAD), you'll fault on the IRET into the signal handler and never be able to handle a signal. The kernel bug is that it forces segment 0x37 without making sure it is a valid segment. Leopard also forced 0x37 but had the courtesy to set it up first. Since OS X requires us to set up that segment (using the thread_fast_set_cthread_self system call), we might as well use it instead of the more complicated i386_set_ldt call to set up our per-OS thread storage. Also add some more zeros to bsdthread_register for new arguments in Snow Leopard (apparently unnecessary, but being careful). Fixes issue 510. R=r CC=golang-dev http://codereview.appspot.com/824046
2010-04-05runtime: handle malloc > 2GB correctlyRuss Cox1-5/+5
R=ken2 CC=golang-dev http://codereview.appspot.com/821048
2010-04-05runtime: various arm fixesRuss Cox3-24/+2
* 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 http://codereview.appspot.com/884041
2010-02-08runtime: allow arbitrary return type in SetFinalizer.Russ Cox1-4/+8
finalize chan, to free OS X semaphore inside Lock. os: finalize File, to close fd. Fixes issue 503. R=ken2 CC=golang-dev http://codereview.appspot.com/204065
2010-02-08runtime: instrument malloc + garbage collector.Russ Cox2-1/+28
add simple garbage collection benchmark. R=iant CC=golang-dev http://codereview.appspot.com/204053
2010-02-03os/signal: send SIGCHLDs to IncomingChristopher Wedgwood1-1/+1
R=rsc CC=golang-dev http://codereview.appspot.com/199082 Committer: Russ Cox <rsc@golang.org>
2010-01-25in C and asm, replace pkg·name with ·nameRuss Cox3-13/+13
(eliminate assumption of package global name space, make code easier to move between packages). R=r CC=golang-dev http://codereview.appspot.com/194072
2010-01-19runtime: wait to allocate mach semaphores backing Locks until neededRuss Cox1-12/+18
need better management of mach semaphores eventually but this avoids allocating them for uncontended Locks. R=r CC=agl1, golang-dev http://codereview.appspot.com/190079
2010-01-13runtime cleanup.Russ Cox1-0/+28
* 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 http://codereview.appspot.com/186143
2010-01-06Ported runtime to Windows.Hector Chu2-21/+9
R=rsc CC=golang-dev http://codereview.appspot.com/176066 Committer: Russ Cox <rsc@golang.org>
2009-12-16runtime: if os/signal is not in use, crash onRuss Cox3-18/+20
most signals, so that ordinary programs can be killed, for example. Fixes issue 434. R=dsymonds1 CC=golang-dev, hoisie http://codereview.appspot.com/180064
2009-12-15os/signal: new packageDavid Symonds3-21/+51
Fixes issue 71. R=rsc, r http://codereview.appspot.com/162056 Committer: Russ Cox <rsc@golang.org>
2009-12-08runtime: start new darwin/amd64 threads on correct stack,Russ Cox1-11/+13
then enable stack check. R=r http://codereview.appspot.com/165100
2009-12-08Fix stack on FreeBSD / add stack check across the boardDevon H. O'Dell1-0/+1
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 http://codereview.appspot.com/167055 Committer: Russ Cox <rsc@golang.org>
2009-11-19runtime: mask signals during signal handler on OS XRuss Cox2-2/+2
Fixes issue 265. R=r CC=golang-dev http://codereview.appspot.com/157084
2009-11-18runtime: fix bug on darwin/amd64 - bad g in bsdthread_startRuss Cox1-2/+2
R=r http://codereview.appspot.com/157077
2009-11-18Remove unnecessary execute bits.William Josephson1-0/+0
R=rsc http://codereview.appspot.com/156077 Committer: Russ Cox <rsc@golang.org>
2009-11-17runtime: two trivial but important bug fixesRuss Cox1-1/+1
R=r http://codereview.appspot.com/156059
2009-11-17FreeBSD-specific porting work.Devon H. O'Dell1-0/+1
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 http://codereview.appspot.com/152142 Committer: Russ Cox <rsc@golang.org>
2009-11-16runtime: make signal handler work on 386Russ Cox2-7/+18
R=r http://codereview.appspot.com/154171
2009-10-15rename sys functions to runtime,Russ Cox3-13/+13
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-038c, 8l dynamic loading support.Russ Cox2-16/+32
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-09-22changes to accommodate nacl:Russ Cox1-0/+6
* 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-21convert 386 to use %gs instead of %fs for extern register.Russ Cox1-1/+1
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-07-27fix bug in CL 30057: missed if+continue in one place.Russ Cox1-0/+2
R=gri DELTA=2 (2 added, 0 deleted, 0 changed) OCL=32214 CL=32223
2009-06-17update 386 to new runtime (CL 30381)Russ Cox2-11/+18
R=r DELTA=298 (119 added, 81 deleted, 98 changed) OCL=30427 CL=30443
2009-06-17runtime: stack growth adjustments, cleanupRuss Cox1-49/+13
* keep coherent SP/PC in gobuf (i.e., SP that would be in use at that PC) * gogocall replaces setspgoto, should work better in presence of link registers * delete unused system calls only amd64; 386 is now broken R=r DELTA=548 (183 added, 183 deleted, 182 changed) OCL=30381 CL=30442
2009-06-09mv src/lib to src/pkgRob Pike12-0/+1861
tests: all.bash passes, gobuild still works, godoc still works. R=rsc OCL=30096 CL=30102