diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-11-17 09:06:45 -0800 |
---|---|---|
committer | David Brownell <dbrownell@users.sourceforge.net> | 2009-11-17 09:06:45 -0800 |
commit | f4788652e45662d1e43933dc0620561bc4cddae0 (patch) | |
tree | 0cda3c8b5ad766f3dea26d83c2a70b7cb52837d7 /src/target/arm11.c | |
parent | 959b373f8cdc2c1ad11c67c6916f88f48769438f (diff) |
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 <dbrownell@users.sourceforge.net>
Diffstat (limited to 'src/target/arm11.c')
-rw-r--r-- | src/target/arm11.c | 14 |
1 files changed, 6 insertions, 8 deletions
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; |