From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6089 invoked by alias); 27 Oct 2005 16:54:30 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6066 invoked by uid 22791); 27 Oct 2005 16:54:21 -0000 Received: from lon-del-02.spheriq.net (HELO lon-del-02.spheriq.net) (195.46.50.98) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 27 Oct 2005 16:54:21 +0000 Received: from lon-out-02.spheriq.net ([195.46.50.130]) by lon-del-02.spheriq.net with ESMTP id j9RGrvdt023728 for ; Thu, 27 Oct 2005 16:53:57 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-02.spheriq.net with ESMTP id j9RGrvDU032276 for ; Thu, 27 Oct 2005 16:53:57 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id j9RGrubD028392 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Thu, 27 Oct 2005 16:53:57 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 43539DA42 for ; Thu, 27 Oct 2005 16:53:56 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id E2F8947402; Thu, 27 Oct 2005 16:56:45 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A61BC75995 for ; Thu, 27 Oct 2005 16:56:45 +0000 (UTC) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2DA4947426 for ; Thu, 27 Oct 2005 16:56:45 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CEL00799 (AUTH "andrew stubbs"); Thu, 27 Oct 2005 17:53:54 +0100 (BST) Message-ID: <436105B8.7020605@st.com> Date: Fri, 28 Oct 2005 18:03:00 -0000 From: Andrew STUBBS User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [SH] PATCH: Define the register groups Content-Type: multipart/mixed; boundary="------------030003020504000300030501" X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.1.07 X-SW-Source: 2005-10/txt/msg00211.txt.bz2 This is a multi-part message in MIME format. --------------030003020504000300030501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 559 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 --------------030003020504000300030501 Content-Type: text/plain; name="sh_regroups.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sh_regroups.patch" Content-length: 2572 2005-10-27 Andrew Stubbs * 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); --------------030003020504000300030501--