From patchwork Wed Mar 23 15:55:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Werner X-Patchwork-Id: 761 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:45:31 -0000 Delivered-To: patches@linaro.org Received: by 10.220.180.8 with SMTP id bs8cs11685vcb; Wed, 23 Mar 2011 08:55:13 -0700 (PDT) Received: by 10.213.26.152 with SMTP id e24mr2398431ebc.125.1300895711123; Wed, 23 Mar 2011 08:55:11 -0700 (PDT) Received: from mtagate5.uk.ibm.com (mtagate5.uk.ibm.com [194.196.100.165]) by mx.google.com with ESMTPS id s8si12045378eeh.88.2011.03.23.08.55.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 23 Mar 2011 08:55:11 -0700 (PDT) Received-SPF: neutral (google.com: 194.196.100.165 is neither permitted nor denied by best guess record for domain of ken.werner@linaro.org) client-ip=194.196.100.165; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.196.100.165 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 mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2NFtAp2013090 for ; Wed, 23 Mar 2011 15:55:10 GMT Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2NFtbvu1736796 for ; Wed, 23 Mar 2011 15:55:37 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2NFtAeW022530 for ; Wed, 23 Mar 2011 09:55:10 -0600 Received: from localhost.localdomain (dyn-9-152-224-51.boeblingen.de.ibm.com [9.152.224.51]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p2NFt7Tx022296; Wed, 23 Mar 2011 09:55:09 -0600 From: Ken Werner To: libunwind-devel@nongnu.org Subject: [PATCH 6/8] Remove the ARM_EXIDX_TABLE_MALLOC code path. Date: Wed, 23 Mar 2011 15:55:04 +0000 Message-Id: <1300895706-5424-7-git-send-email-ken.werner@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1300895706-5424-1-git-send-email-ken.werner@linaro.org> References: <1300895706-5424-1-git-send-email-ken.werner@linaro.org> Using malloc is not an option since unw_init_local and unw_step are supposed to be async signal safe. Therefore this code path can be removed. Signed-off-by: Ken Werner --- include/tdep-arm/ex_tables.h | 3 --- src/arm/ex_tables.c | 29 ++--------------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/include/tdep-arm/ex_tables.h b/include/tdep-arm/ex_tables.h index 625c780..6376ea7 100644 --- a/include/tdep-arm/ex_tables.h +++ b/include/tdep-arm/ex_tables.h @@ -36,9 +36,6 @@ struct arm_exidx_table { struct arm_exidx_entry *end; void *start_addr; void *end_addr; -#ifdef ARM_EXIDX_TABLE_MALLOC - struct arm_exidx_table *next; -#endif }; typedef enum arm_exbuf_cmd { diff --git a/src/arm/ex_tables.c b/src/arm/ex_tables.c index a723db5..36a52cb 100644 --- a/src/arm/ex_tables.c +++ b/src/arm/ex_tables.c @@ -33,18 +33,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ARM_EXTBL_OP_FINISH 0xb0 +#define ARM_EXIDX_TABLE_LIMIT 32 + enum arm_exbuf_cmd_flags { ARM_EXIDX_VFP_SHIFT_16 = 1 << 16, ARM_EXIDX_VFP_DOUBLE = 1 << 17, }; -#ifdef ARM_EXIDX_TABLE_MALLOC -static struct arm_exidx_table *arm_exidx_table_list; -#else -#define ARM_EXIDX_TABLE_LIMIT 32 static struct arm_exidx_table arm_exidx_tables[ARM_EXIDX_TABLE_LIMIT]; static unsigned arm_exidx_table_count = 0; -#endif static inline uint32_t prel31_read (uint32_t prel31) @@ -62,33 +59,16 @@ prel31_to_addr (void *addr) static void arm_exidx_table_reset_all (void) { -#ifdef ARM_EXIDX_TABLE_MALLOC - while (NULL != arm_exidx_table_list) - { - struct arm_exidx_table *next = arm_exidx_table_list->next; - free (arm_exidx_table_list); - arm_exidx_table_list = next; - } -#else arm_exidx_table_count = 0; -#endif } HIDDEN int arm_exidx_table_add (const char *name, struct arm_exidx_entry *start, struct arm_exidx_entry *end) { -#ifdef ARM_EXIDX_TABLE_MALLOC - struct arm_exidx_table *table = malloc (sizeof (*table)); - if (NULL == table) - return -1; - table->next = arm_exidx_table_list; - arm_exidx_table_list = table; -#else if (arm_exidx_table_count >= ARM_EXIDX_TABLE_LIMIT) return -1; struct arm_exidx_table *table = &arm_exidx_tables[arm_exidx_table_count++]; -#endif table->name = name; table->start = start; table->end = end; @@ -106,15 +86,10 @@ HIDDEN struct arm_exidx_table * arm_exidx_table_find (void *pc) { struct arm_exidx_table *table; -#ifdef ARM_EXIDX_TABLE_MALLOC - for (table = arm_exidx_table_list; table != NULL; table = table->next) - { -#else unsigned i; for (i = 0; i < arm_exidx_table_count; i++) { table = &arm_exidx_tables[i]; -#endif if (pc >= table->start_addr && pc < table->end_addr) return table; }