0
|
1 /* DWARF2 EH unwinding support for Alpha Linux.
|
|
2 Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of GCC.
|
|
5
|
|
6 GCC is free software; you can redistribute it and/or modify
|
|
7 it under the terms of the GNU General Public License as published by
|
|
8 the Free Software Foundation; either version 3, or (at your option)
|
|
9 any later version.
|
|
10
|
|
11 GCC is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 GNU General Public License for more details.
|
|
15
|
|
16 Under Section 7 of GPL version 3, you are granted additional
|
|
17 permissions described in the GCC Runtime Library Exception, version
|
|
18 3.1, as published by the Free Software Foundation.
|
|
19
|
|
20 You should have received a copy of the GNU General Public License and
|
|
21 a copy of the GCC Runtime Library Exception along with this program;
|
|
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
23 <http://www.gnu.org/licenses/>. */
|
|
24
|
|
25 /* Do code reading to identify a signal frame, and set the frame
|
|
26 state data appropriately. See unwind-dw2.c for the structs. */
|
|
27
|
|
28 #include <signal.h>
|
|
29 #include <sys/ucontext.h>
|
|
30
|
|
31 #define MD_FALLBACK_FRAME_STATE_FOR alpha_fallback_frame_state
|
|
32
|
|
33 static _Unwind_Reason_Code
|
|
34 alpha_fallback_frame_state (struct _Unwind_Context *context,
|
|
35 _Unwind_FrameState *fs)
|
|
36 {
|
|
37 unsigned int *pc = context->ra;
|
|
38 struct sigcontext *sc;
|
|
39 long new_cfa, i;
|
|
40
|
|
41 if (pc[0] != 0x47fe0410 /* mov $30,$16 */
|
|
42 || pc[2] != 0x00000083 /* callsys */)
|
|
43 return _URC_END_OF_STACK;
|
|
44 if (context->cfa == 0)
|
|
45 return _URC_END_OF_STACK;
|
|
46 if (pc[1] == 0x201f0067) /* lda $0,NR_sigreturn */
|
|
47 sc = context->cfa;
|
|
48 else if (pc[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */
|
|
49 {
|
|
50 struct rt_sigframe {
|
|
51 struct siginfo info;
|
|
52 struct ucontext uc;
|
|
53 } *rt_ = context->cfa;
|
|
54 sc = &rt_->uc.uc_mcontext;
|
|
55 }
|
|
56 else
|
|
57 return _URC_END_OF_STACK;
|
|
58 new_cfa = sc->sc_regs[30];
|
|
59 fs->regs.cfa_how = CFA_REG_OFFSET;
|
|
60 fs->regs.cfa_reg = 30;
|
|
61 fs->regs.cfa_offset = new_cfa - (long) context->cfa;
|
|
62 for (i = 0; i < 30; ++i)
|
|
63 {
|
|
64 fs->regs.reg[i].how = REG_SAVED_OFFSET;
|
|
65 fs->regs.reg[i].loc.offset
|
|
66 = (long)&sc->sc_regs[i] - new_cfa;
|
|
67 }
|
|
68 for (i = 0; i < 31; ++i)
|
|
69 {
|
|
70 fs->regs.reg[i+32].how = REG_SAVED_OFFSET;
|
|
71 fs->regs.reg[i+32].loc.offset
|
|
72 = (long)&sc->sc_fpregs[i] - new_cfa;
|
|
73 }
|
|
74 fs->regs.reg[64].how = REG_SAVED_OFFSET;
|
|
75 fs->regs.reg[64].loc.offset = (long)&sc->sc_pc - new_cfa;
|
|
76 fs->retaddr_column = 64;
|
|
77 return _URC_NO_REASON;
|
|
78 }
|