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>
This commit is contained in:
David Brownell
2009-11-17 09:06:45 -08:00
parent 959b373f8c
commit f4788652e4
14 changed files with 62 additions and 136 deletions

View File

@@ -1955,8 +1955,7 @@ COMMAND_HANDLER(handle_reg_command)
if (reg->valid == 0)
{
struct reg_arch_type *arch_type = register_get_arch_type(reg->arch_type);
arch_type->get(reg);
reg->type->get(reg);
}
value = buf_to_str(reg->value, reg->size, 16);
command_print(cmd_ctx, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);
@@ -1970,8 +1969,7 @@ COMMAND_HANDLER(handle_reg_command)
uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8));
str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0);
struct reg_arch_type *arch_type = register_get_arch_type(reg->arch_type);
arch_type->set(reg, buf);
reg->type->set(reg, buf);
value = buf_to_str(reg->value, reg->size, 16);
command_print(cmd_ctx, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);