1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-02 11:17:38 +01:00
libunwind-eh_elf/src/ia64/regs.h
hp.com!davidm c67d345c33 Convert from debug() to Debug().
(Logical change 1.162)
2004-01-30 00:01:24 +00:00

76 lines
1.8 KiB
C

#include "unwind_i.h"
/* Apply rotation to a general register. REG must be in the range 0-127. */
static inline int
rotate_gr (struct cursor *c, int reg)
{
unsigned int rrb_gr, sor;
int preg;
sor = 8 * ((c->cfm >> 14) & 0xf);
rrb_gr = (c->cfm >> 18) & 0x7f;
if ((unsigned) (reg - 32) >= sor)
preg = reg;
else
{
preg = reg + rrb_gr; /* apply rotation */
if ((unsigned) (preg - 32) >= sor)
preg -= sor; /* wrap around */
}
if (sor)
Debug (16, "sor=%u rrb.gr=%u, r%d -> r%d\n", 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 cursor *c, int reg)
{
unsigned int rrb_fr;
int preg;
rrb_fr = (c->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 */
}
if (rrb_fr)
Debug (16, "rrb.fr=%u, f%d -> f%d\n", rrb_fr, reg, preg);
return preg;
}
/* Apply logical-to-physical rotation. */
static inline unw_word_t
pr_ltop (struct cursor *c, unw_word_t pr)
{
unw_word_t rrb_pr, mask, rot;
rrb_pr = (c->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 cursor *c, unw_word_t pr)
{
unw_word_t rrb_pr, mask, rot;
rrb_pr = 48 - ((c->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);
}