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/server | |
parent | 959b373f8cdc2c1ad11c67c6916f88f48769438f (diff) | |
download | openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.gz openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.bz2 openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.tar.xz openocd+libswd-f4788652e45662d1e43933dc0620561bc4cddae0.zip |
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/server')
-rw-r--r-- | src/server/gdb_server.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 55ec7d4e..9581ea63 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -1004,14 +1004,10 @@ int gdb_set_registers_packet(struct connection *connection, struct target *targe LOG_ERROR("BUG: register packet is too small for registers"); } - struct reg_arch_type *arch_type; bin_buf = malloc(DIV_ROUND_UP(reg_list[i]->size, 8)); gdb_target_to_reg(target, packet_p, chars, bin_buf); - /* get register arch_type, and call set method */ - arch_type = register_get_arch_type(reg_list[i]->arch_type); - - arch_type->set(reg_list[i], bin_buf); + reg_list[i]->type->set(reg_list[i], bin_buf); /* advance packet pointer */ packet_p += chars; @@ -1071,7 +1067,6 @@ int gdb_set_register_packet(struct connection *connection, struct target *target struct reg **reg_list; int reg_list_size; int retval; - struct reg_arch_type *arch_type; LOG_DEBUG("-"); @@ -1100,9 +1095,7 @@ int gdb_set_register_packet(struct connection *connection, struct target *target gdb_target_to_reg(target, separator + 1, chars, bin_buf); - /* get register arch_type, and call set method */ - arch_type = register_get_arch_type(reg_list[reg_num]->arch_type); - arch_type->set(reg_list[reg_num], bin_buf); + reg_list[reg_num]->type->set(reg_list[reg_num], bin_buf); gdb_put_packet(connection, "OK", 2); |