Contributed by Ruslan Sorokin (Руслан Сорокин) <sorokin@oogis.ru>.
[libsigsegv/ericb.git] / src / fault-hpux-hppa.h
blobbbd549526e572ef13f2c33ff4f643455b058ed4d
1 /* Fault handler information. HP-UX HPPA version.
2 Copyright (C) 2002 Paolo Bonzini <bonzini@gnu.org>
3 Copyright (C) 2002-2003 Bruno Haible <bruno@clisp.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #define USE_64BIT_REGS(mc) \
20 (((mc).ss_flags & SS_WIDEREGS) && ((mc).ss_flags & SS_NARROWISINVALID))
22 /* Extract the cr21 register from an mcontext_t.
23 See the comments in /usr/include/machine/save_state.h. */
24 #define GET_CR21(mc) \
25 (USE_64BIT_REGS(mc) ? (mc).ss_wide.ss_64.ss_cr21 : (mc).ss_narrow.ss_cr21)
27 /* Extract the stack pointer from an mcontext_t.
28 See the comments in /usr/include/machine/save_state.h. */
29 #define GET_SP(mc) \
30 (USE_64BIT_REGS(mc) ? (mc).ss_wide.ss_64.ss_sp : (mc).ss_narrow.ss_sp)
32 /* Both of these alternatives work on HP-UX 10.20 and HP-UX 11.00. */
33 #if 1
35 #include "fault-hpux.h"
37 #define SIGSEGV_FAULT_ADDRESS GET_CR21 (scp->sc_sl.sl_ss)
38 #define SIGSEGV_FAULT_STACKPOINTER GET_SP (scp->sc_ctxt.sl.sl_ss)
40 #else
42 #include "fault-posix.h"
44 #define SIGSEGV_FAULT_STACKPOINTER GET_SP (((ucontext_t *) ucp)->uc_mcontext)
46 #endif