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

Side by Side Diff: src/runtime/os_linux.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/os_freebsd.go ('k') | src/runtime/os_linux.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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 mp->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K 235 mp->gsignal = runtime·malg(32*1024); // OS X wants >=8K, Linux >=2K
236 mp->gsignal->m = mp; 236 mp->gsignal->m = mp;
237 } 237 }
238 238
239 // Called to initialize a new m (including the bootstrap m). 239 // Called to initialize a new m (including the bootstrap m).
240 // Called on the new thread, can not allocate memory. 240 // Called on the new thread, can not allocate memory.
241 void 241 void
242 runtime·minit(void) 242 runtime·minit(void)
243 { 243 {
244 // Initialize signal handling. 244 // Initialize signal handling.
245 » runtime·signalstack((byte*)g->m->gsignal->stackguard - StackGuard, 32*10 24); 245 » runtime·signalstack((byte*)g->m->gsignal->stack.lo, 32*1024);
246 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof(Sigset)); 246 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof(Sigset));
247 } 247 }
248 248
249 // Called from dropm to undo the effect of an minit. 249 // Called from dropm to undo the effect of an minit.
250 void 250 void
251 runtime·unminit(void) 251 runtime·unminit(void)
252 { 252 {
253 runtime·signalstack(nil, 0); 253 runtime·signalstack(nil, 0);
254 } 254 }
255 255
256 void
257 runtime·sigpanic(void)
258 {
259 if(!runtime·canpanic(g))
260 runtime·throw("unexpected signal during runtime execution");
261
262 switch(g->sig) {
263 case SIGBUS:
264 if(g->sigcode0 == BUS_ADRERR && g->sigcode1 < 0x1000 || g->panic onfault) {
265 if(g->sigpc == 0)
266 runtime·panicstring("call of nil func value");
267 runtime·panicstring("invalid memory address or nil point er dereference");
268 }
269 runtime·printf("unexpected fault address %p\n", g->sigcode1);
270 runtime·throw("fault");
271 case SIGSEGV:
272 if((g->sigcode0 == 0 || g->sigcode0 == SEGV_MAPERR || g->sigcode 0 == SEGV_ACCERR) && g->sigcode1 < 0x1000 || g->paniconfault) {
273 if(g->sigpc == 0)
274 runtime·panicstring("call of nil func value");
275 runtime·panicstring("invalid memory address or nil point er dereference");
276 }
277 runtime·printf("unexpected fault address %p\n", g->sigcode1);
278 runtime·throw("fault");
279 case SIGFPE:
280 switch(g->sigcode0) {
281 case FPE_INTDIV:
282 runtime·panicstring("integer divide by zero");
283 case FPE_INTOVF:
284 runtime·panicstring("integer overflow");
285 }
286 runtime·panicstring("floating point error");
287 }
288 runtime·panicstring(runtime·sigtab[g->sig].name);
289 }
290
291 uintptr 256 uintptr
292 runtime·memlimit(void) 257 runtime·memlimit(void)
293 { 258 {
294 Rlimit rl; 259 Rlimit rl;
295 extern byte runtime·text[], runtime·end[]; 260 extern byte runtime·text[], runtime·end[];
296 uintptr used; 261 uintptr used;
297 262
298 if(runtime·getrlimit(RLIMIT_AS, &rl) != 0) 263 if(runtime·getrlimit(RLIMIT_AS, &rl) != 0)
299 return 0; 264 return 0;
300 if(rl.rlim_cur >= 0x7fffffff) 265 if(rl.rlim_cur >= 0x7fffffff)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if(p == nil) 343 if(p == nil)
379 st.ss_flags = SS_DISABLE; 344 st.ss_flags = SS_DISABLE;
380 runtime·sigaltstack(&st, nil); 345 runtime·sigaltstack(&st, nil);
381 } 346 }
382 347
383 void 348 void
384 runtime·unblocksignals(void) 349 runtime·unblocksignals(void)
385 { 350 {
386 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none ); 351 runtime·rtsigprocmask(SIG_SETMASK, &sigset_none, nil, sizeof sigset_none );
387 } 352 }
353
354 #pragma textflag NOSPLIT
355 int8*
356 runtime·signame(int32 sig)
357 {
358 return runtime·sigtab[sig].name;
359 }
OLDNEW
« no previous file with comments | « src/runtime/os_freebsd.go ('k') | src/runtime/os_linux.go » ('j') | no next file with comments »

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