From f4788652e45662d1e43933dc0620561bc4cddae0 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 17 Nov 2009 09:06:45 -0800 Subject: target: simplify register get/set ops No need to indirect from registered integers to pointers. Just stash the pointers directly in the register struct, and don't even bother registering. This is a small code shrink, speeds register access just a smidgeon, and gets rid of another rude exit() path. Signed-off-by: David Brownell --- src/target/arm11.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/target/arm11.c') diff --git a/src/target/arm11.c b/src/target/arm11.c index 31135e4a..936edd81 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -58,8 +58,6 @@ static uint32_t arm11_vcr = 0; static bool arm11_config_step_irq_enable = false; static bool arm11_config_hardware_step = false; -static int arm11_regs_arch_type = -1; - enum arm11_regtype { ARM11_REGISTER_CORE, @@ -263,7 +261,6 @@ static struct reg arm11_gdb_dummy_fp_reg = .valid = 1, .size = 96, .arch_info = NULL, - .arch_type = 0, }; static uint8_t arm11_gdb_dummy_fps_value[4]; @@ -276,7 +273,6 @@ static struct reg arm11_gdb_dummy_fps_reg = .valid = 1, .size = 32, .arch_info = NULL, - .arch_type = 0, }; @@ -1945,6 +1941,11 @@ static int arm11_set_reg(struct reg *reg, uint8_t *buf) return ERROR_OK; } +static const struct reg_arch_type arm11_reg_type = { + .get = arm11_get_reg, + .set = arm11_set_reg, +}; + static int arm11_build_reg_cache(struct target *target) { struct arm11_common *arm11 = target_to_arm11(target); @@ -1953,9 +1954,6 @@ static int arm11_build_reg_cache(struct target *target) NEW(struct reg, reg_list, ARM11_REGCACHE_COUNT); NEW(struct arm11_reg_state, arm11_reg_states, ARM11_REGCACHE_COUNT); - if (arm11_regs_arch_type == -1) - arm11_regs_arch_type = register_reg_arch_type(arm11_get_reg, arm11_set_reg); - register_init_dummy(&arm11_gdb_dummy_fp_reg); register_init_dummy(&arm11_gdb_dummy_fps_reg); @@ -1995,7 +1993,7 @@ static int arm11_build_reg_cache(struct target *target) r->value = (uint8_t *)(arm11->reg_values + i); r->dirty = 0; r->valid = 0; - r->arch_type = arm11_regs_arch_type; + r->type = &arm11_reg_type; r->arch_info = rs; rs->def_index = i; -- cgit v1.2.3