mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-26 17:17:39 +01:00
[x86-64] Make even UNW_LOCAL_ONLY accessors go through validation.
Signed-off-by: Arun Sharma <arun.sharma@google.com>
This commit is contained in:
parent
c5dc3c150a
commit
8cdd8bfed8
1 changed files with 3 additions and 49 deletions
|
@ -78,44 +78,8 @@ struct cursor
|
||||||
# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
|
# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0)
|
||||||
# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
|
# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \
|
||||||
tdep_uc_addr((c)->as_arg, (r)), 0))
|
tdep_uc_addr((c)->as_arg, (r)), 0))
|
||||||
|
|
||||||
static inline int
|
|
||||||
dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
|
|
||||||
{
|
|
||||||
if (!DWARF_GET_LOC (loc))
|
|
||||||
return -1;
|
|
||||||
*val = *(unw_fpreg_t *) DWARF_GET_LOC (loc);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
|
|
||||||
{
|
|
||||||
if (!DWARF_GET_LOC (loc))
|
|
||||||
return -1;
|
|
||||||
*(unw_fpreg_t *) DWARF_GET_LOC (loc) = val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
|
|
||||||
{
|
|
||||||
if (!DWARF_GET_LOC (loc))
|
|
||||||
return -1;
|
|
||||||
*val = *(unw_word_t *) DWARF_GET_LOC (loc);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
|
||||||
{
|
|
||||||
if (!DWARF_GET_LOC (loc))
|
|
||||||
return -1;
|
|
||||||
*(unw_word_t *) DWARF_GET_LOC (loc) = val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !UNW_LOCAL_ONLY */
|
#else /* !UNW_LOCAL_ONLY */
|
||||||
|
|
||||||
# define DWARF_LOC_TYPE_FP (1 << 0)
|
# define DWARF_LOC_TYPE_FP (1 << 0)
|
||||||
# define DWARF_LOC_TYPE_REG (1 << 1)
|
# define DWARF_LOC_TYPE_REG (1 << 1)
|
||||||
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
|
# define DWARF_NULL_LOC DWARF_LOC (0, 0)
|
||||||
|
@ -129,13 +93,14 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
|
# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \
|
||||||
| DWARF_LOC_TYPE_FP))
|
| DWARF_LOC_TYPE_FP))
|
||||||
|
|
||||||
|
#endif /* !UNW_LOCAL_ONLY */
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
|
dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
|
||||||
{
|
{
|
||||||
if (DWARF_IS_NULL_LOC (loc))
|
if (DWARF_IS_NULL_LOC (loc))
|
||||||
return -UNW_EBADREG;
|
return -UNW_EBADREG;
|
||||||
|
|
||||||
//# warning fix me
|
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +110,6 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
|
||||||
if (DWARF_IS_NULL_LOC (loc))
|
if (DWARF_IS_NULL_LOC (loc))
|
||||||
return -UNW_EBADREG;
|
return -UNW_EBADREG;
|
||||||
|
|
||||||
//# warning fix me
|
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,10 +119,6 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val)
|
||||||
if (DWARF_IS_NULL_LOC (loc))
|
if (DWARF_IS_NULL_LOC (loc))
|
||||||
return -UNW_EBADREG;
|
return -UNW_EBADREG;
|
||||||
|
|
||||||
if (DWARF_IS_FP_LOC (loc))
|
|
||||||
//# warning fix me
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
if (DWARF_IS_REG_LOC (loc))
|
if (DWARF_IS_REG_LOC (loc))
|
||||||
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
|
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val,
|
||||||
0, c->as_arg);
|
0, c->as_arg);
|
||||||
|
@ -173,10 +133,6 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
if (DWARF_IS_NULL_LOC (loc))
|
if (DWARF_IS_NULL_LOC (loc))
|
||||||
return -UNW_EBADREG;
|
return -UNW_EBADREG;
|
||||||
|
|
||||||
if (DWARF_IS_FP_LOC (loc))
|
|
||||||
//# warning fix me
|
|
||||||
abort ();
|
|
||||||
|
|
||||||
if (DWARF_IS_REG_LOC (loc))
|
if (DWARF_IS_REG_LOC (loc))
|
||||||
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
|
return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val,
|
||||||
1, c->as_arg);
|
1, c->as_arg);
|
||||||
|
@ -185,8 +141,6 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
1, c->as_arg);
|
1, c->as_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !UNW_LOCAL_ONLY */
|
|
||||||
|
|
||||||
#define tdep_needs_initialization UNW_OBJ(needs_initialization)
|
#define tdep_needs_initialization UNW_OBJ(needs_initialization)
|
||||||
#define tdep_init UNW_OBJ(init)
|
#define tdep_init UNW_OBJ(init)
|
||||||
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
|
/* Platforms that support UNW_INFO_FORMAT_TABLE need to define
|
||||||
|
|
Loading…
Reference in a new issue