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

(rotate_gr, rotate_fr, pr_ltop, pr_ptol): Move into regs.h.

(Logical change 1.10)
This commit is contained in:
hp.com!davidm 2002-04-03 06:51:34 +00:00
parent 1bb24a283f
commit a5bf714ea5

View file

@ -24,6 +24,7 @@ License. */
#include <assert.h>
#include "offsets.h"
#include "regs.h"
#include "rse.h"
#include "unwind_i.h"
@ -71,101 +72,6 @@ ia64_scratch_loc (struct ia64_cursor *c, unw_regnum_t reg)
return IA64_REG_LOC (c, reg);
}
/* Apply rotation to a general register. The number REG must be in
the range of 0-127. */
static inline int
rotate_gr (struct ia64_cursor *c, int reg)
{
unsigned int rrb_gr, sor;
unw_word_t cfm;
int preg, ret;
ret = ia64_get (c, c->cfm_loc, &cfm);
if (ret < 0)
return ret;
sor = 8 * ((cfm >> 14) & 0xf);
rrb_gr = (cfm >> 18) & 0x7f;
if ((unsigned) (reg - 32) > sor)
preg = reg; /* register not part of the rotating partition */
else
{
preg = reg + rrb_gr; /* apply rotation */
if (preg > 32 + sor)
preg -= sor; /* wrap around */
}
debug (100, "%s: sor=%u rrb.gr=%u, r%d -> r%d\n", __FUNCTION__, sor, rrb_gr,
reg, preg);
return preg;
}
/* Apply rotation to a floating-point register. The number REG must
be in the range of 0-127. */
static inline int
rotate_fr (struct ia64_cursor *c, int reg)
{
unsigned int rrb_fr;
unw_word_t cfm;
int preg, ret;
ret = ia64_get (c, c->cfm_loc, &cfm);
if (ret < 0)
return ret;
rrb_fr = (cfm >> 25) & 0x7f;
if (reg < 32)
preg = reg; /* register not part of the rotating partition */
else
{
preg = reg + rrb_fr; /* apply rotation */
if (preg > 127)
preg -= 96; /* wrap around */
}
debug (100, "%s: rrb.fr=%u, f%d -> f%d\n", __FUNCTION__, rrb_fr, reg, preg);
return preg;
}
/* Apply logical-to-physical rotation. */
static inline unw_word_t
pr_ltop (struct ia64_cursor *c, unw_word_t pr)
{
unw_word_t rrb_pr, mask, rot, cfm;
int ret;
ret = ia64_get (c, c->cfm_loc, &cfm);
if (ret < 0)
return ret;
rrb_pr = (cfm >> 32) & 0x3f;
rot = pr >> 16;
mask = ((unw_word_t) 1 << rrb_pr) - 1;
rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask);
return (pr & 0xffff) | (rot << 16);
}
/* Apply physical-to-logical rotation. */
static inline unw_word_t
pr_ptol (struct ia64_cursor *c, unw_word_t pr)
{
unw_word_t rrb_pr, mask, rot, cfm;
int ret;
ret = ia64_get (c, c->cfm_loc, &cfm);
if (ret < 0)
return ret;
rrb_pr = 48 - ((cfm >> 32) & 0x3f);
rot = pr >> 16;
mask = ((unw_word_t) 1 << rrb_pr) - 1;
rot = ((pr & mask) << (48 - rrb_pr)) | ((pr >> rrb_pr) & mask);
return (pr & 0xffff) | (rot << 16);
}
static inline int
update_nat (struct ia64_cursor *c, unw_word_t nat_loc, unw_word_t mask,
unw_word_t *valp, int write)
@ -288,10 +194,10 @@ access_nat (struct ia64_cursor *c, unw_word_t loc, unw_word_t reg_loc,
else if (reg >= 32)
{
/* NaT bit is saved in a stacked register. */
nat_loc = (intptr_t) ia64_rse_rnat_addr (reg_loc);
nat_loc = ia64_rse_rnat_addr (reg_loc); /* XXX looks wrong */
if (nat_loc > c->rbs_top)
nat_loc = c->top_rnat_loc;
mask = (intptr_t) 1 << ia64_rse_slot_num (reg_loc);
mask = (unw_word_t) 1 << ia64_rse_slot_num (reg_loc);
}
else
{