Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16)

Side by Side Diff: src/runtime/os_darwin.c

Issue 152570049: [dev.power64] code review 152570049: all: merge default into dev.power64 (Closed)
Patch Set: diff -r 36f7fc9495481ed67a159eea0eb2fac35b7c46a5 https://code.google.com/p/go Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/mprof.go ('k') | src/runtime/os_darwin.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "runtime.h" 5 #include "runtime.h"
6 #include "defs_GOOS_GOARCH.h" 6 #include "defs_GOOS_GOARCH.h"
7 #include "os_GOOS.h" 7 #include "os_GOOS.h"
8 #include "signal_unix.h" 8 #include "signal_unix.h"
9 #include "stack.h" 9 #include "stack.h"
10 #include "textflag.h" 10 #include "textflag.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 mp->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K 137 mp->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K
138 mp->gsignal->m = mp; 138 mp->gsignal->m = mp;
139 } 139 }
140 140
141 // Called to initialize a new m (including the bootstrap m). 141 // Called to initialize a new m (including the bootstrap m).
142 // Called on the new thread, can not allocate memory. 142 // Called on the new thread, can not allocate memory.
143 void 143 void
144 runtime·minit(void) 144 runtime·minit(void)
145 { 145 {
146 // Initialize signal handling. 146 // Initialize signal handling.
147 » runtime·signalstack((byte*)g->m->gsignal->stackguard - StackGuard, 32*10 24); 147 » runtime·signalstack((byte*)g->m->gsignal->stack.lo, 32*1024);
148 148
149 runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil); 149 runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil);
150 } 150 }
151 151
152 // Called from dropm to undo the effect of an minit. 152 // Called from dropm to undo the effect of an minit.
153 void 153 void
154 runtime·unminit(void) 154 runtime·unminit(void)
155 { 155 {
156 runtime·signalstack(nil, 0); 156 runtime·signalstack(nil, 0);
157 } 157 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 // program is about to die, but better to be clean. 491 // program is about to die, but better to be clean.
492 mach_semrelease_errno = r; 492 mach_semrelease_errno = r;
493 fn = mach_semrelease_fail; 493 fn = mach_semrelease_fail;
494 if(g == g->m->curg) 494 if(g == g->m->curg)
495 runtime·onM(&fn); 495 runtime·onM(&fn);
496 else 496 else
497 fn(); 497 fn();
498 } 498 }
499 } 499 }
500 500
501 void
502 runtime·sigpanic(void)
503 {
504 if(!runtime·canpanic(g))
505 runtime·throw("unexpected signal during runtime execution");
506
507 switch(g->sig) {
508 case SIGBUS:
509 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000 || g->panic onfault) {
510 if(g->sigpc == 0)
511 runtime·panicstring("call of nil func value");
512 runtime·panicstring("invalid memory address or nil point er dereference");
513 }
514 runtime·printf("unexpected fault address %p\n", g->sigcode1);
515 runtime·throw("fault");
516 case SIGSEGV:
517 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode 0 == SEGV_ACCERR) && g->sigcode1 < 0x1000 || g->paniconfault) {
518 if(g->sigpc == 0)
519 runtime·panicstring("call of nil func value");
520 runtime·panicstring("invalid memory address or nil point er dereference");
521 }
522 runtime·printf("unexpected fault address %p\n", g->sigcode1);
523 runtime·throw("fault");
524 case SIGFPE:
525 switch(g->sigcode0) {
526 case FPE_INTDIV:
527 runtime·panicstring("integer divide by zero");
528 case FPE_INTOVF:
529 runtime·panicstring("integer overflow");
530 }
531 runtime·panicstring("floating point error");
532 }
533 runtime·panicstring(runtime·sigtab[g->sig].name);
534 }
535
536 #pragma textflag NOSPLIT 501 #pragma textflag NOSPLIT
537 void 502 void
538 runtime·osyield(void) 503 runtime·osyield(void)
539 { 504 {
540 runtime·usleep(1); 505 runtime·usleep(1);
541 } 506 }
542 507
543 uintptr 508 uintptr
544 runtime·memlimit(void) 509 runtime·memlimit(void)
545 { 510 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 if(p == nil) 551 if(p == nil)
587 st.ss_flags = SS_DISABLE; 552 st.ss_flags = SS_DISABLE;
588 runtime·sigaltstack(&st, nil); 553 runtime·sigaltstack(&st, nil);
589 } 554 }
590 555
591 void 556 void
592 runtime·unblocksignals(void) 557 runtime·unblocksignals(void)
593 { 558 {
594 runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil); 559 runtime·sigprocmask(SIG_SETMASK, &sigset_none, nil);
595 } 560 }
561
562 #pragma textflag NOSPLIT
563 int8*
564 runtime·signame(int32 sig)
565 {
566 return runtime·sigtab[sig].name;
567 }
OLDNEW
« no previous file with comments | « src/runtime/mprof.go ('k') | src/runtime/os_darwin.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b