mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-22 15:47:37 +01:00
(unw_resume): Call ia64_make_proc_info() to ensure c->is_signal_frame is valid.
2002/12/11 12:26:26-08:00 mostang.com!davidm Rename: src/ia64/Lresume.c -> src/ia64/Gresume.c (Logical change 1.30)
This commit is contained in:
parent
b6251b0f41
commit
ea24716375
1 changed files with 124 additions and 0 deletions
124
src/ia64/Gresume.c
Normal file
124
src/ia64/Gresume.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2001-2002 Hewlett-Packard Co
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "rse.h"
|
||||
#include "unwind_i.h"
|
||||
|
||||
inline int
|
||||
ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
|
||||
{
|
||||
struct ia64_cursor *c = (struct ia64_cursor *) cursor;
|
||||
unw_fpreg_t fpval;
|
||||
ucontext_t *uc = arg;
|
||||
unw_word_t val, sol;
|
||||
int i, ret;
|
||||
# define SET_NAT(n) \
|
||||
do \
|
||||
{ \
|
||||
ret = ia64_access_reg (c, UNW_IA64_NAT + (n), &val, 0); \
|
||||
if (ret < 0) \
|
||||
return ret; \
|
||||
if (val) \
|
||||
uc->uc_mcontext.sc_nat |= (unw_word_t) 1 << n; \
|
||||
} \
|
||||
while (0)
|
||||
# define SET_REG(f, r) \
|
||||
do \
|
||||
{ \
|
||||
ret = ia64_get (c, c->r, &val); \
|
||||
if (ret < 0) \
|
||||
return ret; \
|
||||
uc->uc_mcontext.f = val; \
|
||||
} \
|
||||
while (0)
|
||||
# define SET_FPREG(f, r) \
|
||||
do \
|
||||
{ \
|
||||
ret = ia64_getfp (c, c->r, &fpval); \
|
||||
if (ret < 0) \
|
||||
return ret; \
|
||||
uc->uc_mcontext.f.u.bits[0] = fpval.raw.bits[0]; \
|
||||
uc->uc_mcontext.f.u.bits[1] = fpval.raw.bits[1]; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* ensure c->pi is up-to-date: */
|
||||
if ((ret = ia64_make_proc_info (c)) < 0)
|
||||
return ret;
|
||||
|
||||
SET_REG (sc_ar_pfs, pfs_loc);
|
||||
SET_REG (sc_br[0], ip_loc);
|
||||
SET_REG (sc_pr, pr_loc);
|
||||
SET_REG (sc_ar_rnat, rnat_loc);
|
||||
SET_REG (sc_ar_lc, lc_loc);
|
||||
SET_REG (sc_ar_fpsr, fpsr_loc);
|
||||
|
||||
SET_REG (sc_gr[4], r4_loc); SET_REG(sc_gr[5], r5_loc);
|
||||
SET_REG (sc_gr[6], r6_loc); SET_REG(sc_gr[7], r7_loc);
|
||||
uc->uc_mcontext.sc_nat = 0;
|
||||
SET_NAT (4); SET_NAT(5);
|
||||
SET_NAT (6); SET_NAT(7);
|
||||
|
||||
SET_REG (sc_br[1], b1_loc);
|
||||
SET_REG (sc_br[2], b2_loc);
|
||||
SET_REG (sc_br[3], b3_loc);
|
||||
SET_REG (sc_br[4], b4_loc);
|
||||
SET_REG (sc_br[5], b5_loc);
|
||||
SET_FPREG (sc_fr[2], f2_loc);
|
||||
SET_FPREG (sc_fr[3], f3_loc);
|
||||
SET_FPREG (sc_fr[4], f4_loc);
|
||||
SET_FPREG (sc_fr[5], f5_loc);
|
||||
for (i = 16; i < 32; ++i)
|
||||
SET_FPREG (sc_fr[i], fr_loc[i - 16]);
|
||||
|
||||
if (c->is_signal_frame)
|
||||
abort (); /* XXX this needs to be fixed... */
|
||||
|
||||
/* Account for the fact that __ia64_install_context() returns via
|
||||
br.ret, which will decrement bsp by size-of-locals. */
|
||||
sol = (uc->uc_mcontext.sc_ar_pfs >> 7) & 0x7f;
|
||||
uc->uc_mcontext.sc_ar_bsp = ia64_rse_skip_regs (c->bsp, sol);
|
||||
|
||||
uc->uc_mcontext.sc_flags = 0;
|
||||
uc->uc_mcontext.sc_gr[1] = c->pi.gp;
|
||||
uc->uc_mcontext.sc_gr[12] = c->psp;
|
||||
|
||||
__ia64_install_context (uc, c->eh_args[0], c->eh_args[1], c->eh_args[2],
|
||||
c->eh_args[3]);
|
||||
}
|
||||
|
||||
int
|
||||
unw_resume (unw_cursor_t *cursor)
|
||||
{
|
||||
struct ia64_cursor *c = (struct ia64_cursor *) cursor;
|
||||
|
||||
#ifdef UNW_LOCAL_ONLY
|
||||
return ia64_local_resume (c->as, cursor, c->as_arg);
|
||||
#else
|
||||
return (*c->as->acc.resume) (c->as, cursor, c->as_arg);
|
||||
#endif
|
||||
}
|
Loading…
Reference in a new issue