51#if defined(__FreeBSD__)
71 const auto stack_size = 2 * SIGSTKSZ;
72 static uint8_t *fatal_sig_stack =
new uint8_t[stack_size];
74#if defined(__FreeBSD__) && (__FreeBSD_version < 1100097)
75 stack.ss_sp = (
char *)fatal_sig_stack;
77 stack.ss_sp = fatal_sig_stack;
79 stack.ss_size = stack_size;
82 return sigaltstack(&
stack, NULL) == 0;
87 int flags = SA_RESTART,
88 struct sigaction *old_sa = NULL)
92 memset(&
sa, 0,
sizeof(
sa));
93 sigemptyset(&
sa.sa_mask);
94 sa.sa_handler = handler;
97 if (sigaction(signal, &
sa, old_sa) == -1)
98 panic(
"Failed to setup handler for signal %i\n", signal);
107 STATIC_ERR(
"For more info on how to address this issue, please visit "
108 "https://www.gem5.org/documentation/general_docs/common-errors/ \n\n");
109 pthread_kill(pthread_self(), signo);
113 STATIC_ERR(
"Failed to execute default signal handler!\n");
153 ccprintf(std::cerr,
"Program aborted at tick %llu\n",
167 STATIC_ERR(
"gem5 has encountered a segmentation fault!\n\n");
192 signal(SIGFPE, SIG_IGN);
208 SA_RESETHAND | SA_NODEFER | SA_ONSTACK);
210 warn(
"Failed to setup stack for SIGSEGV handler, "
211 "using default signal handler.\n");
This file defines flags used to handle asynchronous simulator events.
#define STATIC_ERR(m)
Statically allocate a string and write it to STDERR.
Queue of events sorted in time order.
virtual void wakeup(Tick when=(Tick) -1)
Function to signal that the event loop should be woken up because an event has been scheduled by an a...
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
static void installSignalHandler(int signal, void(*handler)(int sigtype), int flags=SA_RESTART, struct sigaction *old_sa=NULL)
volatile bool async_event
Some asynchronous event has happened.
static void raiseFatalSignal(int signo)
volatile bool async_statdump
Async request to dump stats.
void dumpStatsHandler(int sigtype)
Stats signal handler.
static void ioHandler(int sigtype)
void print_backtrace()
Print a gem5 post-mortem report.
void dumprstStatsHandler(int sigtype)
static bool setupAltStack()
static void segvHandler(int sigtype)
Segmentation fault signal handler.
void exitNowHandler(int sigtype)
Exit signal handler.
volatile bool async_io
Async I/O request (SIGIO).
volatile bool async_exit
Async request to exit simulator.
volatile bool async_statreset
Async request to reset stats.
EventQueue * curEventQueue()
struct sigaction old_int_sa
EventQueue * getEventQueue(uint32_t index)
Function for returning eventq queue for the provided index.
void ccprintf(cp::Print &print)
void abortHandler(int sigtype)
Abort signal handler.