1 /* src/vm/jit/x86_64/freebsd/md-os.c - machine dependent x86_64 FreeBSD functions
3 Copyright (C) 2007, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 #include "threads/thread.hpp"
34 #include "vm/signallocal.hpp"
36 #include "vm/jit/asmpart.h"
37 #include "vm/jit/stacktrace.hpp"
40 /* md_signal_handler_sigsegv ***************************************************
42 NullPointerException signal handler for hardware null pointer
45 *******************************************************************************/
47 void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p)
55 _uc = (ucontext_t *) _p;
56 _mc = &_uc->uc_mcontext;
58 sp = (u1 *) _mc->mc_rsp;
59 xpc = (u1 *) _mc->mc_rip;
60 ra = xpc; /* return address is equal to xpc */
63 /* check for StackOverflowException */
65 threads_check_stackoverflow(sp);
69 (ptrint) stacktrace_hardware_nullpointerexception(NULL, sp, ra, xpc);
71 _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
72 _mc->mc_rip = (ptrint) asm_handle_exception;
76 /* md_signal_handler_sigfpe ****************************************************
78 ArithmeticException signal handler for hardware divide by zero
81 *******************************************************************************/
83 void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p)
91 _uc = (ucontext_t *) _p;
92 _mc = &_uc->uc_mcontext;
94 sp = (u1 *) _mc->mc_rsp;
95 xpc = (u1 *) _mc->mc_rip;
96 ra = xpc; /* return address is equal to xpc */
99 (ptrint) stacktrace_hardware_arithmeticexception(NULL, sp, ra, xpc);
101 _mc->mc_r10 = (ptrint) xpc; /* REG_ITMP2_XPC */
102 _mc->mc_rip = (ptrint) asm_handle_exception;
106 /* md_signal_handler_sigusr2 ***************************************************
108 Signal handler for profiling sampling.
110 *******************************************************************************/
112 #if defined(ENABLE_THREADS)
113 void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p)
122 _uc = (ucontext_t *) _p;
123 _mc = &_uc->uc_mcontext;
125 pc = (u1 *) _mc->mc_rip;
133 * These are local overrides for various environment variables in Emacs.
134 * Please do not remove this and leave it at the end of the file, where
135 * Emacs will automagically detect them.
136 * ---------------------------------------------------------------------
139 * indent-tabs-mode: t
143 * vim:noexpandtab:sw=4:ts=4: