From b8d777bc656e86d99567ba656e9511657d62e0a2 Mon Sep 17 00:00:00 2001 From: "hp.com!davidm" Date: Thu, 6 May 2004 20:24:01 +0000 Subject: [PATCH] (access_reg): Do not reject accesses to floating-point registers. On little-endian machines, this automagically does the right thing and on HP-UX (big-endian) we never use this routine. Reject write-accesses to read-only save-locations (such as unw.read_only.r0). (access_fpreg): Reject write-accesses to read-only save-locations. (Logical change 1.229) --- src/ia64/Ginit-ia64.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ia64/Ginit-ia64.c b/src/ia64/Ginit-ia64.c index 77604e23..a1034772 100644 --- a/src/ia64/Ginit-ia64.c +++ b/src/ia64/Ginit-ia64.c @@ -290,9 +290,6 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, unw_word_t *addr, mask; ucontext_t *uc = arg; - if (reg >= UNW_IA64_FR && reg < UNW_IA64_FR + 128) - goto badreg; - if (reg >= UNW_IA64_NAT + 4 && reg <= UNW_IA64_NAT + 7) { mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT); @@ -319,7 +316,12 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, if (write) { - *(unw_word_t *) addr = *val; + if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = *val; Debug (12, "%s <- %lx\n", unw_regname (reg), *val); } else @@ -350,9 +352,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { + if (ia64_read_only_reg (addr)) + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } + *addr = *val; Debug (12, "%s <- %016lx.%016lx\n", unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); - *(unw_fpreg_t *) addr = *val; } else {