1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-23 20:03:43 +01:00

(ia64_local_resume): Move here from unw_init_local().

(Logical change 1.27)
This commit is contained in:
mostang.com!davidm 2002-11-16 06:50:04 +00:00
parent 40e5cd3ca7
commit 9f93a9d0da

View file

@ -23,16 +23,98 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <stdlib.h>
#include "rse.h"
#include "unwind_i.h" #include "unwind_i.h"
inline int
ia64_local_resume (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)
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->pi.flags & IA64_FLAG_SIGTRAMP) != 0)
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 int
unw_resume (unw_cursor_t *cursor) unw_resume (unw_cursor_t *cursor)
{ {
struct ia64_cursor *c = (struct ia64_cursor *) cursor; struct ia64_cursor *c = (struct ia64_cursor *) cursor;
#ifdef UNW_LOCAL_ONLY #ifdef UNW_LOCAL_ONLY
return ia64_local_resume (cursor, c->uc); return ia64_local_resume (cursor, c->as_arg);
#else #else
return (*c->acc.resume) (cursor, c->acc.arg); return (*c->as->acc.resume) (cursor, c->as_arg);
#endif #endif
} }