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/xscale.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/target/xscale.c') diff --git a/src/target/xscale.c b/src/target/xscale.c index 38928f41..09e68254 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -954,7 +954,7 @@ static int xscale_debug_entry(struct target *target) LOG_DEBUG("cpsr: 0x%8.8" PRIx32 "", buffer[9]); armv4_5->core_mode = buffer[9] & 0x1f; - if (armv4_5_mode_to_number(armv4_5->core_mode) == -1) + if (!is_arm_mode(armv4_5->core_mode)) { target->state = TARGET_UNKNOWN; LOG_ERROR("cpsr contains invalid mode value - communication failure"); @@ -969,9 +969,6 @@ static int xscale_debug_entry(struct target *target) armv4_5->core_state = ARMV4_5_STATE_ARM; - if (armv4_5_mode_to_number(armv4_5->core_mode)==-1) - return ERROR_FAIL; - /* get banked registers, r8 to r14, and spsr if not in USR/SYS mode */ if ((armv4_5->core_mode != ARMV4_5_MODE_USR) && (armv4_5->core_mode != ARMV4_5_MODE_SYS)) { -- cgit v1.2.3