init_signals.cc (11800:54436a1784dc) init_signals.cc (12203:4fa428be5f7e)
1/*
2 * Copyright (c) 2012, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 36 unchanged lines hidden (view full) ---

45
46#include <sys/types.h>
47#include <unistd.h>
48
49#include <csignal>
50#include <iostream>
51#include <string>
52
1/*
2 * Copyright (c) 2012, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 36 unchanged lines hidden (view full) ---

45
46#include <sys/types.h>
47#include <unistd.h>
48
49#include <csignal>
50#include <iostream>
51#include <string>
52
53#if defined(__FreeBSD__)
54#include <sys/param.h>
55
56#endif
57
53#include "base/atomicio.hh"
54#include "base/cprintf.hh"
55#include "base/misc.hh"
56#include "sim/async.hh"
57#include "sim/backtrace.hh"
58#include "sim/core.hh"
59#include "sim/eventq.hh"
60
61using namespace std;
62
63// Use an separate stack for fatal signal handlers
64static uint8_t fatalSigStack[2 * SIGSTKSZ];
65
66static bool
67setupAltStack()
68{
69 stack_t stack;
58#include "base/atomicio.hh"
59#include "base/cprintf.hh"
60#include "base/misc.hh"
61#include "sim/async.hh"
62#include "sim/backtrace.hh"
63#include "sim/core.hh"
64#include "sim/eventq.hh"
65
66using namespace std;
67
68// Use an separate stack for fatal signal handlers
69static uint8_t fatalSigStack[2 * SIGSTKSZ];
70
71static bool
72setupAltStack()
73{
74 stack_t stack;
75#if defined(__FreeBSD__) && (__FreeBSD_version < 1100097)
76 stack.ss_sp = (char *)fatalSigStack;
77#else
70 stack.ss_sp = fatalSigStack;
78 stack.ss_sp = fatalSigStack;
79#endif
71 stack.ss_size = sizeof(fatalSigStack);
72 stack.ss_flags = 0;
73
74 return sigaltstack(&stack, NULL) == 0;
75}
76
77static void
78installSignalHandler(int signal, void (*handler)(int sigtype),

--- 131 unchanged lines hidden ---
80 stack.ss_size = sizeof(fatalSigStack);
81 stack.ss_flags = 0;
82
83 return sigaltstack(&stack, NULL) == 0;
84}
85
86static void
87installSignalHandler(int signal, void (*handler)(int sigtype),

--- 131 unchanged lines hidden ---