From 181d401d59419ec2f5a5d89e2600d9a6dbf8f9ed Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 17 Nov 2009 23:50:26 -0800 Subject: ARM: add is_arm_mode() Add a new is_arm_mode() predicate, and use it to replace almost all calls to current armv4_5_mode_to_number(). Eventually those internal mode numbers should vanish... along with their siblings in the armv7a.c file. Remove a handful of superfluous checks ... e.g. the mode number was just initialized, or (debug entry methods) already validated. Move one of the macros using internal mode numbers into the only file which uses that macro. Make the tables manipulated with those numbers be read-only and, where possible, static so they're not confused with part of the generic ARM interface. Signed-off-by: David Brownell --- src/target/armv4_5.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/target/armv4_5.h') diff --git a/src/target/armv4_5.h b/src/target/armv4_5.h index 5b7a5220..81eac476 100644 --- a/src/target/armv4_5.h +++ b/src/target/armv4_5.h @@ -42,6 +42,8 @@ typedef enum armv4_5_mode } armv4_5_mode_t; const char *arm_mode_name(unsigned psr_mode); +bool is_arm_mode(unsigned psr_mode); + int armv4_5_mode_to_number(enum armv4_5_mode mode); enum armv4_5_mode armv4_5_number_to_mode(int number); @@ -54,12 +56,10 @@ typedef enum armv4_5_state extern char* armv4_5_state_strings[]; -extern int armv4_5_core_reg_map[7][17]; +extern const int armv4_5_core_reg_map[7][17]; #define ARMV4_5_CORE_REG_MODE(cache, mode, num) \ cache->reg_list[armv4_5_core_reg_map[armv4_5_mode_to_number(mode)][num]] -#define ARMV4_5_CORE_REG_MODENUM(cache, mode, num) \ - cache->reg_list[armv4_5_core_reg_map[mode][num]] /* offsets into armv4_5 core register cache */ enum -- cgit v1.2.3