target: create/use register_cache_invalidate()

Create a generic register_cache_invalidate(), and use it to
replace three all-but-identical core-specific routines:

 - armv4_5_invalidate_core_regs()
 - armv7m_invalidate_core_regs
 - mips32_invalidate_core_regs() too.

Make cache->num_regs be unsigned, avoiding various errors.

Net code shrink and simplification.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
David Brownell
2009-11-19 19:02:10 -08:00
parent 31fb7788a6
commit 71cde5e359
14 changed files with 47 additions and 77 deletions

View File

@@ -1860,7 +1860,7 @@ COMMAND_HANDLER(handle_reg_command)
{
struct target *target;
struct reg *reg = NULL;
int count = 0;
unsigned count = 0;
char *value;
LOG_DEBUG("-");
@@ -1875,7 +1875,7 @@ COMMAND_HANDLER(handle_reg_command)
count = 0;
while (cache)
{
int i;
unsigned i;
command_print(CMD_CTX, "===== %s", cache->name);
@@ -1917,10 +1917,10 @@ COMMAND_HANDLER(handle_reg_command)
count = 0;
while (cache)
{
int i;
unsigned i;
for (i = 0; i < cache->num_regs; i++)
{
if (count++ == (int)num)
if (count++ == num)
{
reg = &cache->reg_list[i];
break;