diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 933b49beb..702d6cfb1 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -14,6 +14,7 @@ #include "arm720t.h" #include +#include #include "target_type.h" #include "register.h" #include "arm_opcodes.h" @@ -227,14 +228,10 @@ static int arm720t_arch_state(struct target *target) { struct arm720t_common *arm720t = target_to_arm720(target); - static const char *state[] = { - "disabled", "enabled" - }; - arm_arch_state(target); LOG_USER("MMU: %s, Cache: %s", - state[arm720t->armv4_5_mmu.mmu_enabled], - state[arm720t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled]); + str_enabled_disabled(arm720t->armv4_5_mmu.mmu_enabled), + str_enabled_disabled(arm720t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled)); return ERROR_OK; } diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 4dd576353..67c212e0b 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -12,6 +12,7 @@ #include "arm920t.h" #include +#include #include "target_type.h" #include "register.h" #include "arm_opcodes.h" @@ -509,10 +510,6 @@ static int arm920t_verify_pointer(struct command_invocation *cmd, /** Logs summary of ARM920 state for a halted target. */ int arm920t_arch_state(struct target *target) { - static const char *state[] = { - "disabled", "enabled" - }; - struct arm920t_common *arm920t = target_to_arm920(target); if (arm920t->common_magic != ARM920T_COMMON_MAGIC) { @@ -522,9 +519,9 @@ int arm920t_arch_state(struct target *target) arm_arch_state(target); LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s", - state[arm920t->armv4_5_mmu.mmu_enabled], - state[arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled], - state[arm920t->armv4_5_mmu.armv4_5_cache.i_cache_enabled]); + str_enabled_disabled(arm920t->armv4_5_mmu.mmu_enabled), + str_enabled_disabled(arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled), + str_enabled_disabled(arm920t->armv4_5_mmu.armv4_5_cache.i_cache_enabled)); return ERROR_OK; } diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c index 587f25061..a3fff2ae5 100644 --- a/src/target/arm926ejs.c +++ b/src/target/arm926ejs.c @@ -14,6 +14,7 @@ #include "arm926ejs.h" #include +#include #include "target_type.h" #include "register.h" #include "arm_opcodes.h" @@ -505,10 +506,6 @@ static int arm926ejs_verify_pointer(struct command_invocation *cmd, /** Logs summary of ARM926 state for a halted target. */ int arm926ejs_arch_state(struct target *target) { - static const char *state[] = { - "disabled", "enabled" - }; - struct arm926ejs_common *arm926ejs = target_to_arm926(target); if (arm926ejs->common_magic != ARM926EJS_COMMON_MAGIC) { @@ -518,9 +515,9 @@ int arm926ejs_arch_state(struct target *target) arm_arch_state(target); LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s", - state[arm926ejs->armv4_5_mmu.mmu_enabled], - state[arm926ejs->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled], - state[arm926ejs->armv4_5_mmu.armv4_5_cache.i_cache_enabled]); + str_enabled_disabled(arm926ejs->armv4_5_mmu.mmu_enabled), + str_enabled_disabled(arm926ejs->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled), + str_enabled_disabled(arm926ejs->armv4_5_mmu.armv4_5_cache.i_cache_enabled)); return ERROR_OK; } diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 2bbafd420..c5829095e 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -18,6 +18,7 @@ #include "register.h" #include +#include #include #include @@ -480,10 +481,6 @@ int armv7a_init_arch_info(struct target *target, struct armv7a_common *armv7a) int armv7a_arch_state(struct target *target) { - static const char *state[] = { - "disabled", "enabled" - }; - struct armv7a_common *armv7a = target_to_armv7a(target); struct arm *arm = &armv7a->arm; @@ -496,13 +493,13 @@ int armv7a_arch_state(struct target *target) if (armv7a->is_armv7r) { LOG_TARGET_USER(target, "D-Cache: %s, I-Cache: %s", - state[armv7a->armv7a_mmu.armv7a_cache.d_u_cache_enabled], - state[armv7a->armv7a_mmu.armv7a_cache.i_cache_enabled]); + str_enabled_disabled(armv7a->armv7a_mmu.armv7a_cache.d_u_cache_enabled), + str_enabled_disabled(armv7a->armv7a_mmu.armv7a_cache.i_cache_enabled)); } else { LOG_TARGET_USER(target, "MMU: %s, D-Cache: %s, I-Cache: %s", - state[armv7a->armv7a_mmu.mmu_enabled], - state[armv7a->armv7a_mmu.armv7a_cache.d_u_cache_enabled], - state[armv7a->armv7a_mmu.armv7a_cache.i_cache_enabled]); + str_enabled_disabled(armv7a->armv7a_mmu.mmu_enabled), + str_enabled_disabled(armv7a->armv7a_mmu.armv7a_cache.d_u_cache_enabled), + str_enabled_disabled(armv7a->armv7a_mmu.armv7a_cache.i_cache_enabled)); } if (arm->core_mode == ARM_MODE_ABT) diff --git a/src/target/armv8.c b/src/target/armv8.c index ece49c2a2..478a72b8d 100644 --- a/src/target/armv8.c +++ b/src/target/armv8.c @@ -18,6 +18,7 @@ #include "register.h" #include +#include #include #include @@ -1359,10 +1360,6 @@ static int armv8_aarch64_state(struct target *target) int armv8_arch_state(struct target *target) { - static const char * const state[] = { - "disabled", "enabled" - }; - struct armv8_common *armv8 = target_to_armv8(target); struct arm *arm = &armv8->arm; @@ -1377,9 +1374,9 @@ int armv8_arch_state(struct target *target) arm_arch_state(target); LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s", - state[armv8->armv8_mmu.mmu_enabled], - state[armv8->armv8_mmu.armv8_cache.d_u_cache_enabled], - state[armv8->armv8_mmu.armv8_cache.i_cache_enabled]); + str_enabled_disabled(armv8->armv8_mmu.mmu_enabled), + str_enabled_disabled(armv8->armv8_mmu.armv8_cache.d_u_cache_enabled), + str_enabled_disabled(armv8->armv8_mmu.armv8_cache.i_cache_enabled)); if (arm->core_mode == ARM_MODE_ABT) armv8_show_fault_registers(target); diff --git a/src/target/xscale.c b/src/target/xscale.c index 783628b12..50e03f202 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -22,6 +22,7 @@ #include "arm_simulator.h" #include "arm_disassembler.h" #include +#include #include "register.h" #include "image.h" #include "arm_opcodes.h" @@ -774,10 +775,6 @@ static int xscale_arch_state(struct target *target) struct xscale_common *xscale = target_to_xscale(target); struct arm *arm = &xscale->arm; - static const char *state[] = { - "disabled", "enabled" - }; - static const char *arch_dbg_reason[] = { "", "\n(processor reset)", "\n(trace buffer full)" }; @@ -789,9 +786,9 @@ static int xscale_arch_state(struct target *target) arm_arch_state(target); LOG_USER("MMU: %s, D-Cache: %s, I-Cache: %s%s", - state[xscale->armv4_5_mmu.mmu_enabled], - state[xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled], - state[xscale->armv4_5_mmu.armv4_5_cache.i_cache_enabled], + str_enabled_disabled(xscale->armv4_5_mmu.mmu_enabled), + str_enabled_disabled(xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled), + str_enabled_disabled(xscale->armv4_5_mmu.armv4_5_cache.i_cache_enabled), arch_dbg_reason[xscale->arch_debug_reason]); return ERROR_OK;