1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-05 01:09:27 +01:00

(tdep_access_reg): Handle UNW_HPPA_IP, UNW_HPPA_CFA, UNW_HPPA_SP,

and UNW_HPPA_EH{0,1,2,3} correctly.
(tdep_access_fpreg): Implement.

2004/12/02 00:40:45-08:00 mostang.com!davidm
(tdep_access_reg): Provide a minimally working implementation.
(tdep_access_fpreg): New (unimplemented) function.

(Logical change 1.290)
This commit is contained in:
hp.com!davidm 2005-05-03 09:13:17 +00:00
parent b38691980f
commit 5b0507c432

View file

@ -1,6 +1,6 @@
/* libunwind - a platform-independent unwind library
Copyright (C) 2003 Hewlett-Packard Co
Contributed by ...
Copyright (C) 2004 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
@ -26,31 +26,62 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
HIDDEN int
hppa_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
int write)
{
struct hppa_loc loc = HPPA_LOC (0, 0);
struct dwarf_loc loc;
switch (reg)
{
case UNW_HPPA_IP:
if (write)
c->ip = *valp; /* also update the IP cache */
loc = c->ip_loc;
c->dwarf.ip = *valp; /* update the IP cache */
if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip
|| *valp >= c->dwarf.pi.end_ip))
c->dwarf.pi_valid = 0; /* new IP outside of current proc */
break;
case UNW_HPPA_CFA:
case UNW_HPPA_SP:
if (write)
return -UNW_EREADONLYREG;
*valp = c->sp;
*valp = c->dwarf.cfa;
return 0;
/* Do the exception-handling register remapping: */
case UNW_HPPA_EH0: reg = UNW_HPPA_GR + 20; break;
case UNW_HPPA_EH1: reg = UNW_HPPA_GR + 21; break;
case UNW_HPPA_EH2: reg = UNW_HPPA_GR + 22; break;
case UNW_HPPA_EH3: reg = UNW_HPPA_GR + 31; break;
default:
return -UNW_EBADREG;
break;
}
if ((unsigned) (reg - UNW_HPPA_GR) >= 32)
return -UNW_EBADREG;
loc = c->dwarf.loc[reg];
if (write)
return hppa_put (c, loc, *valp);
return dwarf_put (&c->dwarf, loc, *valp);
else
return hppa_get (c, loc, valp);
return dwarf_get (&c->dwarf, loc, valp);
}
HIDDEN int
tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
int write)
{
struct dwarf_loc loc;
if ((unsigned) (reg - UNW_HPPA_FR) >= 32)
return -UNW_EBADREG;
loc = c->dwarf.loc[reg];
if (write)
return dwarf_putfp (&c->dwarf, loc, *valp);
else
return dwarf_getfp (&c->dwarf, loc, valp);
}