diff options
author | Maxim Grigoriev <maxim2405@gmail.com> | 2007-08-08 23:22:18 +0000 |
---|---|---|
committer | Maxim Grigoriev <maxim2405@gmail.com> | 2007-08-08 23:22:18 +0000 |
commit | 7b8715682ae902fa51d0bf17dd57e6493a8c7711 (patch) | |
tree | 1b0a089576aa3653bf8bd512f548975694f4b146 /gdb/xtensa-tdep.c | |
parent | 652aaa2406a6b38bf38fdeb6aba975b7825f9f2d (diff) | |
download | gdb-7b8715682ae902fa51d0bf17dd57e6493a8c7711.zip gdb-7b8715682ae902fa51d0bf17dd57e6493a8c7711.tar.gz gdb-7b8715682ae902fa51d0bf17dd57e6493a8c7711.tar.bz2 |
2007-08-08 Maxim Grigoriev <maxim2405@gmail.com>
* xtensa-tdep.h (XTENSA_MAX_COPROCESSOR): New.
(xtensa_register_group_t): Add entries for coprocessors.
* xtensa-tdep.c (xtensa_init_reggroups): New register groups.
(xtensa_add_reggroups): Likewise.
(xtensa_register_reggroup_p): Likewise.
(xtensa_coprocessor_register_group): New function.
(xtensa_cp): New.
Diffstat (limited to 'gdb/xtensa-tdep.c')
-rw-r--r-- | gdb/xtensa-tdep.c | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index f8024a7..c52aa14 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -658,6 +658,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, static struct reggroup *xtensa_ar_reggroup; static struct reggroup *xtensa_user_reggroup; static struct reggroup *xtensa_vectra_reggroup; +static struct reggroup *xtensa_cp[XTENSA_MAX_COPROCESSOR]; static void xtensa_init_reggroups (void) @@ -665,25 +666,51 @@ xtensa_init_reggroups (void) xtensa_ar_reggroup = reggroup_new ("ar", USER_REGGROUP); xtensa_user_reggroup = reggroup_new ("user", USER_REGGROUP); xtensa_vectra_reggroup = reggroup_new ("vectra", USER_REGGROUP); -} + xtensa_cp[0] = reggroup_new ("cp0", USER_REGGROUP); + xtensa_cp[1] = reggroup_new ("cp1", USER_REGGROUP); + xtensa_cp[2] = reggroup_new ("cp2", USER_REGGROUP); + xtensa_cp[3] = reggroup_new ("cp3", USER_REGGROUP); + xtensa_cp[4] = reggroup_new ("cp4", USER_REGGROUP); + xtensa_cp[5] = reggroup_new ("cp5", USER_REGGROUP); + xtensa_cp[6] = reggroup_new ("cp6", USER_REGGROUP); + xtensa_cp[7] = reggroup_new ("cp7", USER_REGGROUP); +} static void xtensa_add_reggroups (struct gdbarch *gdbarch) { + int i; + + /* Predefined groups. */ reggroup_add (gdbarch, all_reggroup); reggroup_add (gdbarch, save_reggroup); reggroup_add (gdbarch, restore_reggroup); reggroup_add (gdbarch, system_reggroup); - reggroup_add (gdbarch, vector_reggroup); /* vectra */ - reggroup_add (gdbarch, general_reggroup); /* core */ - reggroup_add (gdbarch, float_reggroup); /* float */ + reggroup_add (gdbarch, vector_reggroup); + reggroup_add (gdbarch, general_reggroup); + reggroup_add (gdbarch, float_reggroup); + + /* Xtensa-specific groups. */ + reggroup_add (gdbarch, xtensa_ar_reggroup); + reggroup_add (gdbarch, xtensa_user_reggroup); + reggroup_add (gdbarch, xtensa_vectra_reggroup); - reggroup_add (gdbarch, xtensa_ar_reggroup); /* ar */ - reggroup_add (gdbarch, xtensa_user_reggroup); /* user */ - reggroup_add (gdbarch, xtensa_vectra_reggroup); /* vectra */ + for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++) + reggroup_add (gdbarch, xtensa_cp[i]); } +static int +xtensa_coprocessor_register_group (struct reggroup *group) +{ + int i; + + for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++) + if (group == xtensa_cp[i]) + return i; + + return -1; +} #define SAVE_REST_FLAGS (XTENSA_REGISTER_FLAGS_READABLE \ | XTENSA_REGISTER_FLAGS_WRITABLE \ @@ -700,6 +727,7 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch, xtensa_register_t* reg = ®MAP[regnum]; xtensa_register_type_t type = reg->type; xtensa_register_group_t rg = reg->group; + int cp_number; /* First, skip registers that are not visible to this target (unknown and unmapped registers when not using ISS). */ @@ -725,6 +753,8 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch, if (group == save_reggroup || group == restore_reggroup) return (regnum < gdbarch_num_regs (current_gdbarch) && (reg->flags & SAVE_REST_FLAGS) == SAVE_REST_VALID); + if ((cp_number = xtensa_coprocessor_register_group (group)) >= 0) + return rg & (xtRegisterGroupCP0 << cp_number); else return 1; } |