From patchwork Wed Aug 3 12:12:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 3240 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C4C7824070 for ; Wed, 3 Aug 2011 12:12:16 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id 94B5EA182F9 for ; Wed, 3 Aug 2011 12:12:16 +0000 (UTC) Received: by mail-qy0-f180.google.com with SMTP id 30so585833qyk.11 for ; Wed, 03 Aug 2011 05:12:16 -0700 (PDT) Received: by 10.229.44.195 with SMTP id b3mr2769922qcf.7.1312373536341; Wed, 03 Aug 2011 05:12:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.6.73 with SMTP id 9cs156126qcy; Wed, 3 Aug 2011 05:12:16 -0700 (PDT) Received: by 10.216.171.132 with SMTP id r4mr2760293wel.67.1312373535115; Wed, 03 Aug 2011 05:12:15 -0700 (PDT) Received: from mtagate3.uk.ibm.com (mtagate3.uk.ibm.com [194.196.100.163]) by mx.google.com with ESMTPS id k62si1456744weq.46.2011.08.03.05.12.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 03 Aug 2011 05:12:14 -0700 (PDT) Received-SPF: neutral (google.com: 194.196.100.163 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) client-ip=194.196.100.163; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.196.100.163 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) smtp.mail=ken.werner@linaro.org Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p73CC7pe023743 for ; Wed, 3 Aug 2011 12:12:07 GMT Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p73CC7hx2343120 for ; Wed, 3 Aug 2011 13:12:07 +0100 Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p73CC6BN012140 for ; Wed, 3 Aug 2011 06:12:06 -0600 Received: from leonard.boeblingen.de.ibm.com (dyn-9-152-224-36.boeblingen.de.ibm.com [9.152.224.36]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p73CC6Bt012117; Wed, 3 Aug 2011 06:12:06 -0600 From: Ken Werner To: libunwind-devel@nongnu.org Subject: [PATCH 2/5] Change address type from void* to unw_word_t. Date: Wed, 3 Aug 2011 14:12:02 +0200 Message-Id: <1312373525-20741-3-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1312373525-20741-1-git-send-email-ken.werner@linaro.org> References: <1312373525-20741-1-git-send-email-ken.werner@linaro.org> Signed-off-by: Ken Werner --- include/libunwind-arm.h | 4 ++-- include/tdep-arm/ex_tables.h | 4 ++-- src/arm/Gex_tables.c | 28 ++++++++++++++-------------- src/arm/Gstep.c | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/libunwind-arm.h b/include/libunwind-arm.h index 0878771..3e7ebf3 100644 --- a/include/libunwind-arm.h +++ b/include/libunwind-arm.h @@ -289,8 +289,8 @@ struct arm_exidx_table { const char *name; struct arm_exidx_entry *start; struct arm_exidx_entry *end; - void *start_addr; - void *end_addr; + unw_word_t start_addr; + unw_word_t end_addr; }; typedef struct diff --git a/include/tdep-arm/ex_tables.h b/include/tdep-arm/ex_tables.h index d898619..b5e6dcf 100644 --- a/include/tdep-arm/ex_tables.h +++ b/include/tdep-arm/ex_tables.h @@ -55,9 +55,9 @@ struct arm_exbuf_data int arm_exidx_init_local (void); int arm_exidx_table_add (const char *name, struct arm_exidx_entry *start, struct arm_exidx_entry *end); -struct arm_exidx_table *arm_exidx_table_find (void *pc); +struct arm_exidx_table *arm_exidx_table_find (unw_word_t pc); struct arm_exidx_entry *arm_exidx_table_lookup (struct arm_exidx_table *table, - void *pc); + unw_word_t pc); int arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf); int arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c); int arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c); diff --git a/src/arm/Gex_tables.c b/src/arm/Gex_tables.c index 035b24a..b72dabb 100644 --- a/src/arm/Gex_tables.c +++ b/src/arm/Gex_tables.c @@ -55,11 +55,11 @@ prel31_read (uint32_t prel31) return ((int32_t)prel31 << 1) >> 1; } -static inline void * -prel31_to_addr (void *addr) +static inline uint32_t +prel31_to_addr (uint32_t *addr) { - uint32_t offset = ((long)*(uint32_t *)addr << 1) >> 1; - return (char *)addr + offset; + uint32_t offset = ((long)*addr << 1) >> 1; + return (uint32_t)addr + offset; } static void @@ -81,7 +81,7 @@ arm_exidx_table_add (const char *name, table->start_addr = prel31_to_addr (&start->addr); table->end_addr = prel31_to_addr (&(end - 1)->addr); Debug (2, "name=%s, range=%p-%p, addr=%p-%p\n", - name, start, end, table->start_addr, table->end_addr); + name, start, end, (void *)table->start_addr, (void *)table->end_addr); return 0; } @@ -89,7 +89,7 @@ arm_exidx_table_add (const char *name, * Locate the appropriate unwind table from the given PC. */ HIDDEN struct arm_exidx_table * -arm_exidx_table_find (void *pc) +arm_exidx_table_find (unw_word_t pc) { struct arm_exidx_table *table; unsigned i; @@ -106,7 +106,7 @@ arm_exidx_table_find (void *pc) * Finds the corresponding arm_exidx_entry from a given index table and PC. */ HIDDEN struct arm_exidx_entry * -arm_exidx_table_lookup (struct arm_exidx_table *table, void *pc) +arm_exidx_table_lookup (struct arm_exidx_table *table, unw_word_t pc) { struct arm_exidx_entry *first = table->start, *last = table->end - 1; if (pc < prel31_to_addr (&first->addr)) @@ -339,7 +339,7 @@ HIDDEN int arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf) { int nbuf = 0; - uint32_t *addr = prel31_to_addr (&entry->addr); + unw_word_t addr = prel31_to_addr (&entry->addr); uint32_t data = entry->data; if (data == ARM_EXIDX_CANT_UNWIND) @@ -349,20 +349,20 @@ arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf) } else if (data & ARM_EXIDX_COMPACT) { - Debug (2, "%p compact model %d [%8.8x]\n", addr, (data >> 24) & 0x7f, data); + Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, (data >> 24) & 0x7f, data); buf[nbuf++] = data >> 16; buf[nbuf++] = data >> 8; buf[nbuf++] = data; } else { - uint32_t *extbl_data = prel31_to_addr (&entry->data); - data = extbl_data[0]; + uint32_t *extbl_data = (uint32_t *)prel31_to_addr (&entry->data); + data = (unw_word_t)extbl_data[0]; unsigned int n_table_words = 0; if (data & ARM_EXIDX_COMPACT) { int pers = (data >> 24) & 0x0f; - Debug (2, "%p compact model %d [%8.8x]\n", addr, pers, data); + Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data); if (pers == 1 || pers == 2) { n_table_words = (data >> 16) & 0xff; @@ -375,8 +375,8 @@ arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf) } else { - void *pers = prel31_to_addr (extbl_data); - Debug (2, "%p Personality routine: %8p\n", addr, pers); + unw_word_t pers = prel31_to_addr (extbl_data); + Debug (2, "%p Personality routine: %8p\n", (void *)addr, (void *)pers); n_table_words = extbl_data[1] >> 24; buf[nbuf++] = extbl_data[1] >> 16; buf[nbuf++] = extbl_data[1] >> 8; diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c index f5fb441..cfe01c0 100644 --- a/src/arm/Gstep.c +++ b/src/arm/Gstep.c @@ -46,11 +46,11 @@ arm_exidx_step (struct cursor *c) /* mark PC unsaved */ c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC; - table = arm_exidx_table_find ((void *)c->dwarf.ip); + table = arm_exidx_table_find (c->dwarf.ip); if (NULL == table) return -UNW_ENOINFO; - entry = arm_exidx_table_lookup (table, (void *)c->dwarf.ip); + entry = arm_exidx_table_lookup (table, c->dwarf.ip); if (NULL == entry) return -UNW_ENOINFO;