From e633236827c579711822c22b65f70965f8bd0cb2 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Sat, 9 Nov 2002 03:59:27 +0000 Subject: [PATCH] (ia64_getfp): Change from macro to inline function. Check "loc" argument for being NULL before dereferencing it. (ia64_putfp): Ditto. (ia64_get): Ditto. (ia64_put): Ditto. (Logical change 1.21) --- src/ia64/unwind_i.h | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/ia64/unwind_i.h b/src/ia64/unwind_i.h index 12bf90df..702f4466 100644 --- a/src/ia64/unwind_i.h +++ b/src/ia64/unwind_i.h @@ -190,14 +190,46 @@ extern void *_Uia64_uc_addr (ucontext_t *uc, unw_regnum_t regnum); _Uia64_glibc_acquire_unwind_info((ip), (i), (c)->uc) # define ia64_release_unwind_info(c,ip,i) \ _Uia64_glibc_release_unwind_info((i), (c)->uc) -# define ia64_get(c,l,v) \ - (*(v) = *(unw_word_t *) IA64_MASK_LOC_TYPE(l), 0) -# define ia64_put(c,l,v) \ - (*(unw_word_t *) IA64_MASK_LOC_TYPE(l) = (v), 0) -# define ia64_getfp(c,l,v) \ - (*(v) = *(unw_fpreg_t *) IA64_MASK_LOC_TYPE(l), 0) -# define ia64_putfp(c,l,v) \ - (*(unw_fpreg_t *) IA64_MASK_LOC_TYPE(l) = (v), 0) + +/* Note: the register accessors (ia64_{get,set}{,fp}()) must check for + NULL locations because _Uia64_uc_addr() returns NULL for unsaved + registers. */ + +static inline int +ia64_getfp (struct ia64_cursor *c, unw_word_t loc, unw_fpreg_t *val) +{ + if (!loc) + return -1; + *val = *(unw_fpreg_t *) IA64_MASK_LOC_TYPE(loc); + return 0; +} + +static inline int +ia64_putfp (struct ia64_cursor *c, unw_word_t loc, unw_fpreg_t val) +{ + if (!loc) + return -1; + *(unw_fpreg_t *) IA64_MASK_LOC_TYPE(loc) = val; + return 0; +} + +static inline int +ia64_get (struct ia64_cursor *c, unw_word_t loc, unw_word_t *val) +{ + if (!loc) + return -1; + *val = *(unw_word_t *) IA64_MASK_LOC_TYPE(loc); + return 0; +} + +static inline int +ia64_put (struct ia64_cursor *c, unw_word_t loc, unw_word_t val) +{ + if (!loc) + return -1; + *(unw_word_t *) IA64_MASK_LOC_TYPE(loc) = (val); + return 0; +} #else /* !UNW_LOCAL_ONLY */