arm: add missing error reporting
authorØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 11 Aug 2010 08:58:49 +0000 (10:58 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 11 Aug 2010 08:58:49 +0000 (10:58 +0200)
when an unknown core mode is read from the target,
report error. Can be communication failure.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/arm7_9_common.c
src/target/arm920t.c
src/target/armv4_5.c

index 3bbe8b07ad27c30fac93152e2ef8b31f8d446d2c..778e606b608adfd1a57644f5802b946d6630b7ba 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
- *   Copyright (C) 2007-2009 Øyvind Harboe                                 *
+ *   Copyright (C) 2007-2010 Øyvind Harboe                                 *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2008 by Spencer Oliver                                  *
@@ -1518,7 +1518,10 @@ static int arm7_9_full_context(struct target *target)
        }
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        /* iterate through processor modes (User, FIQ, IRQ, SVC, ABT, UND)
         * SYS shares registers with User, so we don't touch SYS
@@ -1621,7 +1624,10 @@ static int arm7_9_restore_context(struct target *target)
                arm7_9->pre_restore_context(target);
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        /* iterate through processor modes (User, FIQ, IRQ, SVC, ABT, UND)
         * SYS shares registers with User, so we don't touch SYS
index 90f548f38f0fbf6ee9d14a929ed037c1824478cb..a3a5adf1592bebfc5c226dd00694cf9371adc153 100644 (file)
@@ -281,7 +281,10 @@ static int arm920t_read_cp15_interpreted(struct target *target,
 #endif
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        r[0].dirty = 1;
        r[1].dirty = 1;
@@ -323,7 +326,10 @@ int arm920t_write_cp15_interpreted(struct target *target,
 #endif
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        r[0].dirty = 1;
        r[1].dirty = 1;
@@ -1154,7 +1160,10 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command)
        fclose(output);
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        /* force writeback of the valid data */
        r = armv4_5->core_cache->reg_list;
@@ -1481,7 +1490,10 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command)
        fclose(output);
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        /* force writeback of the valid data */
        r = armv4_5->core_cache->reg_list;
index d950af366403af53316e86f9cec2daf1a799288d..07c8c6ebc9becedbad81fc5f62a3081f1fe38bba 100644 (file)
@@ -634,7 +634,10 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
        }
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        if (!armv4_5->full_context) {
                command_print(CMD_CTX, "error: target doesn't support %s",
@@ -1046,7 +1049,10 @@ int arm_get_gdb_reg_list(struct target *target,
        int i;
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        *reg_list_size = 26;
        *reg_list = malloc(sizeof(struct reg*) * (*reg_list_size));
@@ -1127,7 +1133,10 @@ int armv4_5_run_algorithm_inner(struct target *target,
        }
 
        if (!is_arm_mode(armv4_5->core_mode))
+       {
+               LOG_ERROR("not a valid arm core mode - communication failure?");
                return ERROR_FAIL;
+       }
 
        /* armv5 and later can terminate with BKPT instruction; less overhead */
        if (!exit_point && armv4_5->is_armv4)