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/armv7m.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/armv7m.c')
-rw-r--r-- | src/target/armv7m.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 3b01fa9a..8c1de32e 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -72,7 +72,6 @@ static struct reg armv7m_gdb_dummy_fp_reg = .valid = 1, .size = 96, .arch_info = NULL, - .arch_type = 0, }; static uint8_t armv7m_gdb_dummy_fps_value[4]; @@ -85,7 +84,6 @@ static struct reg armv7m_gdb_dummy_fps_reg = .valid = 1, .size = 32, .arch_info = NULL, - .arch_type = 0, }; #ifdef ARMV7_GDB_HACKS @@ -99,7 +97,6 @@ struct reg armv7m_gdb_dummy_cpsr_reg = .valid = 1, .size = 32, .arch_info = NULL, - .arch_type = 0, }; #endif @@ -148,8 +145,6 @@ static const struct { #define ARMV7M_NUM_REGS ARRAY_SIZE(armv7m_regs) -static int armv7m_core_reg_arch_type = -1; - /** * Restores target context using the cache of core registers set up * by armv7m_build_reg_cache(), calling optional core-specific hooks. @@ -542,6 +537,10 @@ int armv7m_arch_state(struct target *target) return ERROR_OK; } +static const struct reg_arch_type armv7m_reg_type = { + .get = armv7m_get_core_reg, + .set = armv7m_set_core_reg, +}; /** Builds cache of architecturally defined registers. */ struct reg_cache *armv7m_build_reg_cache(struct target *target) @@ -554,11 +553,6 @@ struct reg_cache *armv7m_build_reg_cache(struct target *target) struct armv7m_core_reg *arch_info = calloc(num_regs, sizeof(struct armv7m_core_reg)); int i; - if (armv7m_core_reg_arch_type == -1) - { - armv7m_core_reg_arch_type = register_reg_arch_type(armv7m_get_core_reg, armv7m_set_core_reg); - } - register_init_dummy(&armv7m_gdb_dummy_fps_reg); #ifdef ARMV7_GDB_HACKS register_init_dummy(&armv7m_gdb_dummy_cpsr_reg); @@ -583,7 +577,7 @@ struct reg_cache *armv7m_build_reg_cache(struct target *target) reg_list[i].value = calloc(1, 4); reg_list[i].dirty = 0; reg_list[i].valid = 0; - reg_list[i].arch_type = armv7m_core_reg_arch_type; + reg_list[i].type = &armv7m_reg_type; reg_list[i].arch_info = &arch_info[i]; } |