From: Andrew STUBBS <andrew.stubbs@st.com>
To: gdb-patches@sources.redhat.com
Subject: [SH] PATCH: Define the register groups
Date: Fri, 28 Oct 2005 18:03:00 -0000 [thread overview]
Message-ID: <436105B8.7020605@st.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 559 bytes --]
Hi all,
The SH port does not currently define any register groups. Instead, it
just relies on the default in reggroup.c. This is not quite adequate as
it is not always clear from the type where a register should naturally
sit. In particular the 'fv' vector registers are classified as general,
not float or vector.
The attached patch adds a function to do the register classification.
It does not know about all the registers of sh2a or any of the dsp
variants (because I don't), but should not make the situation any worse
for those.
Andrew Stubbs
[-- Attachment #2: sh_regroups.patch --]
[-- Type: text/plain, Size: 2572 bytes --]
2005-10-27 Andrew Stubbs <andrew.stubbs@st.com>
* sh-tdep.c (sh_register_reggroup_p): New function.
(sh_gdbarch_init): Add call to set_gdbarch_register_reggroup_p.
Index: src/gdb/sh-tdep.c
===================================================================
--- src.orig/gdb/sh-tdep.c 2005-10-17 14:06:03.000000000 +0100
+++ src/gdb/sh-tdep.c 2005-10-27 17:37:00.000000000 +0100
@@ -44,6 +44,7 @@
#include "regcache.h"
#include "doublest.h"
#include "osabi.h"
+#include "reggroups.h"
#include "sh-tdep.h"
@@ -1812,6 +1813,51 @@ sh_default_register_type (struct gdbarch
return builtin_type_int;
}
+/* Is a register in a reggroup?
+ The default code in reggroup.c doesn't identify system registers, some
+ float registers or any of the vector registers.
+ TODO: sh2a and dsp registers. */
+int
+sh_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ struct reggroup *reggroup)
+{
+ if (REGISTER_NAME (regnum) == NULL
+ || *REGISTER_NAME (regnum) == '\0')
+ return 0;
+ if (reggroup == all_reggroup)
+ return 1;
+ if (reggroup == save_reggroup || reggroup == restore_reggroup)
+ return regnum < NUM_REGS; /* i.e. not pseudo regs */
+
+ if (FP0_REGNUM != -1
+ && ((regnum >= FP0_REGNUM && regnum <= FP_LAST_REGNUM)
+ || (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
+ || (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM)
+ || (regnum == FPUL_REGNUM)
+ || (regnum == FPSCR_REGNUM)))
+ {
+ if (reggroup == float_reggroup)
+ return 1;
+ if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM
+ && reggroup == vector_reggroup)
+ return 1;
+ }
+ else if (reggroup == system_reggroup
+ && (regnum == PC_REGNUM
+ || regnum == PR_REGNUM
+ || regnum == GBR_REGNUM
+ || regnum == VBR_REGNUM
+ || regnum == SR_REGNUM
+ || regnum == FPSCR_REGNUM
+ || regnum == SSR_REGNUM
+ || regnum == SPC_REGNUM))
+ return 1;
+ else if (reggroup == general_reggroup)
+ return 1;
+
+ return 0;
+}
+
/* On the sh4, the DRi pseudo registers are problematic if the target
is little endian. When the user writes one of those registers, for
instance with 'ser var $dr0=1', we want the double to be stored
@@ -2549,6 +2595,7 @@ sh_gdbarch_init (struct gdbarch_info inf
set_gdbarch_num_pseudo_regs (gdbarch, 0);
set_gdbarch_register_type (gdbarch, sh_default_register_type);
+ set_gdbarch_register_reggroup_p (gdbarch, sh_register_reggroup_p);
set_gdbarch_print_registers_info (gdbarch, sh_print_registers_info);
next reply other threads:[~2005-10-27 16:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-28 18:03 Andrew STUBBS [this message]
2005-11-07 18:57 ` Andrew STUBBS
2006-01-12 12:39 ` Andrew STUBBS
2006-01-20 23:35 ` Daniel Jacobowitz
2006-01-23 15:51 ` Andrew STUBBS
2006-01-23 16:07 ` Daniel Jacobowitz
2006-01-23 17:35 ` Andrew STUBBS
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=436105B8.7020605@st.com \
--to=andrew.stubbs@st.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox