public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [RFC 1/4] Move ARM register numbers enum to arch/arm.h
Date: Tue, 28 Jul 2015 10:00:00 -0000	[thread overview]
Message-ID: <1438077592-15356-2-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1438077592-15356-1-git-send-email-yao.qi@linaro.org>

This patch moves ARM register numbers enum to arch/arm.h, so that it
can used by GDBserver too.

This patch is a RFC because it creates a new directory gdb/arch in which
arch-specific or target-specific files are placed.

gdb:

2015-07-28  Yao Qi  <yao.qi@linaro.org>

	* arm-tdep.h (enum gdb_regnum): Move it to ...
	* arch/arm.h: ... here.  New file.
	* Makefile.in (HFILES_NO_SRCDIR): Add arch/arm.h.
---
 gdb/Makefile.in |  2 +-
 gdb/arch/arm.h  | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/arm-tdep.h  | 39 +-----------------------------------
 3 files changed, 63 insertions(+), 39 deletions(-)
 create mode 100644 gdb/arch/arm.h

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e7fefd9..4080ba4 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -983,7 +983,7 @@ common/common-debug.h common/cleanups.h common/gdb_setjmp.h \
 common/common-exceptions.h target/target.h common/symbol.h \
 common/common-regcache.h fbsd-tdep.h nat/linux-personality.h \
 common/fileio.h nat/x86-linux.h nat/x86-linux-dregs.h \
-nat/linux-namespaces.h
+nat/linux-namespaces.h arch/arm.h
 
 # Header files that already have srcdir in them, or which are in objdir.
 
diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h
new file mode 100644
index 0000000..e0eed60
--- /dev/null
+++ b/gdb/arch/arm.h
@@ -0,0 +1,61 @@
+/* Common target dependent code for GDB on ARM systems.
+   Copyright (C) 2002-2015 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   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 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef ARM_H
+#define ARM_H
+
+/* Register numbers of various important registers.  */
+
+enum gdb_regnum {
+  ARM_A1_REGNUM = 0,		/* first integer-like argument */
+  ARM_A4_REGNUM = 3,		/* last integer-like argument */
+  ARM_AP_REGNUM = 11,
+  ARM_IP_REGNUM = 12,
+  ARM_SP_REGNUM = 13,		/* Contains address of top of stack */
+  ARM_LR_REGNUM = 14,		/* address to return to from a function call */
+  ARM_PC_REGNUM = 15,		/* Contains program counter */
+  ARM_F0_REGNUM = 16,		/* first floating point register */
+  ARM_F3_REGNUM = 19,		/* last floating point argument register */
+  ARM_F7_REGNUM = 23, 		/* last floating point register */
+  ARM_FPS_REGNUM = 24,		/* floating point status register */
+  ARM_PS_REGNUM = 25,		/* Contains processor status */
+  ARM_WR0_REGNUM,		/* WMMX data registers.  */
+  ARM_WR15_REGNUM = ARM_WR0_REGNUM + 15,
+  ARM_WC0_REGNUM,		/* WMMX control registers.  */
+  ARM_WCSSF_REGNUM = ARM_WC0_REGNUM + 2,
+  ARM_WCASF_REGNUM = ARM_WC0_REGNUM + 3,
+  ARM_WC7_REGNUM = ARM_WC0_REGNUM + 7,
+  ARM_WCGR0_REGNUM,		/* WMMX general purpose registers.  */
+  ARM_WCGR3_REGNUM = ARM_WCGR0_REGNUM + 3,
+  ARM_WCGR7_REGNUM = ARM_WCGR0_REGNUM + 7,
+  ARM_D0_REGNUM,		/* VFP double-precision registers.  */
+  ARM_D31_REGNUM = ARM_D0_REGNUM + 31,
+  ARM_FPSCR_REGNUM,
+
+  ARM_NUM_REGS,
+
+  /* Other useful registers.  */
+  ARM_FP_REGNUM = 11,		/* Frame register in ARM code, if used.  */
+  THUMB_FP_REGNUM = 7,		/* Frame register in Thumb code, if used.  */
+  ARM_NUM_ARG_REGS = 4, 
+  ARM_LAST_ARG_REGNUM = ARM_A4_REGNUM,
+  ARM_NUM_FP_ARG_REGS = 4,
+  ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM
+};
+
+#endif
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index f81679a..3e06f79 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -24,44 +24,7 @@ struct gdbarch;
 struct regset;
 struct address_space;
 
-/* Register numbers of various important registers.  */
-
-enum gdb_regnum {
-  ARM_A1_REGNUM = 0,		/* first integer-like argument */
-  ARM_A4_REGNUM = 3,		/* last integer-like argument */
-  ARM_AP_REGNUM = 11,
-  ARM_IP_REGNUM = 12,
-  ARM_SP_REGNUM = 13,		/* Contains address of top of stack */
-  ARM_LR_REGNUM = 14,		/* address to return to from a function call */
-  ARM_PC_REGNUM = 15,		/* Contains program counter */
-  ARM_F0_REGNUM = 16,		/* first floating point register */
-  ARM_F3_REGNUM = 19,		/* last floating point argument register */
-  ARM_F7_REGNUM = 23, 		/* last floating point register */
-  ARM_FPS_REGNUM = 24,		/* floating point status register */
-  ARM_PS_REGNUM = 25,		/* Contains processor status */
-  ARM_WR0_REGNUM,		/* WMMX data registers.  */
-  ARM_WR15_REGNUM = ARM_WR0_REGNUM + 15,
-  ARM_WC0_REGNUM,		/* WMMX control registers.  */
-  ARM_WCSSF_REGNUM = ARM_WC0_REGNUM + 2,
-  ARM_WCASF_REGNUM = ARM_WC0_REGNUM + 3,
-  ARM_WC7_REGNUM = ARM_WC0_REGNUM + 7,
-  ARM_WCGR0_REGNUM,		/* WMMX general purpose registers.  */
-  ARM_WCGR3_REGNUM = ARM_WCGR0_REGNUM + 3,
-  ARM_WCGR7_REGNUM = ARM_WCGR0_REGNUM + 7,
-  ARM_D0_REGNUM,		/* VFP double-precision registers.  */
-  ARM_D31_REGNUM = ARM_D0_REGNUM + 31,
-  ARM_FPSCR_REGNUM,
-
-  ARM_NUM_REGS,
-
-  /* Other useful registers.  */
-  ARM_FP_REGNUM = 11,		/* Frame register in ARM code, if used.  */
-  THUMB_FP_REGNUM = 7,		/* Frame register in Thumb code, if used.  */
-  ARM_NUM_ARG_REGS = 4, 
-  ARM_LAST_ARG_REGNUM = ARM_A4_REGNUM,
-  ARM_NUM_FP_ARG_REGS = 4,
-  ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM
-};
+#include "arch/arm.h"
 
 /* Size of integer registers.  */
 #define INT_REGISTER_SIZE		4
-- 
1.9.1

  parent reply	other threads:[~2015-07-28 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 10:00 [PATCH 0/4] GDBserver linux-arm-low.c cleanup Yao Qi
2015-07-28 10:00 ` [PATCH 2/4] Don't use arm_regmap and arm_num_regs in arm_fill_gregset and arm_store_gregset Yao Qi
2015-07-28 10:00 ` [PATCH 4/4] Remove global variable arm_hwcap Yao Qi
2015-07-28 10:00 ` Yao Qi [this message]
2015-07-28 10:00 ` [PATCH 3/4] Use regcache->tdesc instead of arm_hwcap Yao Qi
2015-07-30 14:08 ` [PATCH 0/4] GDBserver linux-arm-low.c cleanup Yao Qi

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=1438077592-15356-2-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).