diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/target/arm11.c | 5 | ||||
-rw-r--r-- | src/target/armv4_5.c | 3 | ||||
-rw-r--r-- | src/target/armv7m.c | 24 | ||||
-rw-r--r-- | src/target/mips32.c | 8 | ||||
-rw-r--r-- | src/target/register.c | 27 | ||||
-rw-r--r-- | src/target/register.h | 4 |
6 files changed, 49 insertions, 22 deletions
diff --git a/src/target/arm11.c b/src/target/arm11.c index 758e99d..f2adce8 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -1683,7 +1683,10 @@ void arm11_build_reg_cache(target_t *target) NEW(arm11_reg_state_t, 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); + 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); arm11->reg_list = reg_list; diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index df9e3df..6848bf7 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -277,6 +277,9 @@ reg_cache_t* armv4_5_build_reg_cache(target_t *target, armv4_5_common_t *armv4_5 if (armv4_5_core_reg_arch_type == -1) armv4_5_core_reg_arch_type = register_reg_arch_type(armv4_5_get_core_reg, armv4_5_set_core_reg); + register_init_dummy(&armv4_5_gdb_dummy_fp_reg); + register_init_dummy(&armv4_5_gdb_dummy_fps_reg); + for (i = 0; i < 37; i++) { arch_info[i] = armv4_5_core_reg_list_arch_info[i]; diff --git a/src/target/armv7m.c b/src/target/armv7m.c index 38f635e..8456754 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -198,21 +198,6 @@ int armv7m_set_core_reg(reg_t *reg, u8 *buf) return ERROR_OK; } -int armv7m_get_dummy_core_reg(reg_t *reg) -{ - return ERROR_OK; -} - -int armv7m_set_dummy_core_reg(reg_t *reg, u8 *buf) -{ - u32 value = buf_get_u32(buf, 0, 32); - buf_set_u32(reg->value, 0, 32, value); - reg->dirty = 1; - reg->valid = 1; - - return ERROR_OK; -} - int armv7m_read_core_reg(struct target_s *target, int num) { u32 reg_value; @@ -485,12 +470,11 @@ reg_cache_t *armv7m_build_reg_cache(target_t *target) if (armv7m_core_reg_arch_type == -1) { armv7m_core_reg_arch_type = register_reg_arch_type(armv7m_get_core_reg, armv7m_set_core_reg); - armv7m_dummy_core_reg_arch_type = register_reg_arch_type(armv7m_get_dummy_core_reg, armv7m_set_dummy_core_reg); - - armv7m_gdb_dummy_fp_reg.arch_type=armv7m_dummy_core_reg_arch_type; - armv7m_gdb_dummy_fps_reg.arch_type=armv7m_dummy_core_reg_arch_type; - armv7m_gdb_dummy_cpsr_reg.arch_type=armv7m_dummy_core_reg_arch_type; } + + register_init_dummy(&armv7m_gdb_dummy_fps_reg); + register_init_dummy(&armv7m_gdb_dummy_cpsr_reg); + register_init_dummy(&armv7m_gdb_dummy_fp_reg); /* Build the process context cache */ cache->name = "arm v7m registers"; diff --git a/src/target/mips32.c b/src/target/mips32.c index 96e509c..47b069e 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -4,6 +4,9 @@ * * * Copyright (C) 2008 by David T.L. Wong * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -286,7 +289,10 @@ reg_cache_t *mips32_build_reg_cache(target_t *target) if (mips32_core_reg_arch_type == -1) mips32_core_reg_arch_type = register_reg_arch_type(mips32_get_core_reg, mips32_set_core_reg); - + + register_init_dummy(&mips32_gdb_dummy_fsr_reg); + register_init_dummy(&mips32_gdb_dummy_fir_reg); + /* Build the process context cache */ cache->name = "mips32 registers"; cache->next = NULL; diff --git a/src/target/register.c b/src/target/register.c index 1a8f6dd..cb80eff 100644 --- a/src/target/register.c +++ b/src/target/register.c @@ -2,6 +2,9 @@ * Copyright (C) 2005 by Dominic Rath * * Dominic.Rath@gmx.de * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -103,3 +106,27 @@ reg_arch_type_t* register_get_arch_type(int id) exit(-1); return NULL; } + + + +static int register_get_dummy_core_reg(reg_t *reg) +{ + return ERROR_OK; +} + +static int register_set_dummy_core_reg(reg_t *reg, u8 *buf) +{ + reg->dirty = 1; + reg->valid = 1; + + return ERROR_OK; +} + +void register_init_dummy(reg_t *reg) +{ + static int dummy_arch_type = -1; + if (dummy_arch_type == -1 ) + register_reg_arch_type(register_get_dummy_core_reg, register_set_dummy_core_reg); + + reg->arch_type = dummy_arch_type; +} diff --git a/src/target/register.h b/src/target/register.h index 456ab59..96bd3da 100644 --- a/src/target/register.h +++ b/src/target/register.h @@ -2,6 +2,9 @@ * Copyright (C) 2005 by Dominic Rath * * Dominic.Rath@gmx.de * * * + * Copyright (C) 2007,2008 Øyvind Harboe * + * oyvind.harboe@zylin.com * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -64,6 +67,7 @@ extern reg_t* register_get_by_name(reg_cache_t *first, char *name, int search_al extern reg_cache_t** register_get_last_cache_p(reg_cache_t **first); extern int register_reg_arch_type(int (*get)(reg_t *reg), int (*set)(reg_t *reg, u8 *buf)); extern reg_arch_type_t* register_get_arch_type(int id); +extern void register_init_dummy(reg_t *reg); #endif /* REGISTER_H */ |