Move some ppc macros to nat/ppc-linux.h
authorYao Qi <yao@codesourcery.com>
Thu, 8 Jan 2015 09:23:55 +0000 (17:23 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 14 Jan 2015 14:28:22 +0000 (22:28 +0800)
When I use PPC_FEATURE_BOOKE in GDBserver, I find it is defined in GDB
but not in GDBserver.  After taking a further look, I find some macros
are duplicated between ppc-linux-nat.c and linux-ppc-low.c, so this
patch is to move them into nat/ppc-linux.h.

gdb/gdbserver:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* linux-ppc-low.c: Include "nat/ppc-linux.h".
 (PPC_FEATURE_HAS_VSX): Move to nat/ppc-linux.h.
(PPC_FEATURE_HAS_ALTIVEC,  PPC_FEATURE_HAS_SPE): Likewise.
(PT_ORIG_R3, PT_TRAP): Likewise.
(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.

gdb:

2015-01-14  Yao Qi  <yao@codesourcery.com>

* ppc-linux-nat.c (PT_ORIG_R3, PT_TRAP): Move to
nat/ppc-linux.h.
(PPC_FEATURE_CELL, PPC_FEATURE_BOOKE): Likewise.
(PPC_FEATURE_HAS_DFP): Likewise.
(PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
(PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
(PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
Include "nat/ppc-linux.h".
* nat/ppc-linux.h: New file.
* Makefile.in (HFILES_NO_SRCDIR): Add nat/ppc-linux.h.

gdb/ChangeLog
gdb/Makefile.in
gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-ppc-low.c
gdb/nat/ppc-linux.h [new file with mode: 0644]
gdb/ppc-linux-nat.c

index 648b341a3fa2d80d79aa0e5e4d84e9d7f88f921b..3b954f82ce674d5e44fbd80b3870e0c1228b43f2 100644 (file)
@@ -1,3 +1,16 @@
+2015-01-14  Yao Qi  <yao@codesourcery.com>
+
+       * ppc-linux-nat.c (PT_ORIG_R3, PT_TRAP): Move to
+       nat/ppc-linux.h.
+       (PPC_FEATURE_CELL, PPC_FEATURE_BOOKE): Likewise.
+       (PPC_FEATURE_HAS_DFP): Likewise.
+       (PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
+       (PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
+       (PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
+       Include "nat/ppc-linux.h".
+       * nat/ppc-linux.h: New file.
+       * Makefile.in (HFILES_NO_SRCDIR): Add nat/ppc-linux.h.
+
 2015-01-14  Pedro Alves  <palves@redhat.com>
 
        PR gdb/17525
index 86ab1be15d39de441220210fba8f342cdab59ee8..968dc50879684d998b2ec23141816d7b3029a0a0 100644 (file)
@@ -955,7 +955,7 @@ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \
 common/format.h common/host-defs.h utils.h common/queue.h \
 nat/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h \
 gdb_bfd.h sparc-ravenscar-thread.h ppc-ravenscar-thread.h nat/linux-btrace.h \
-ctf.h nat/x86-cpuid.h nat/x86-gcc-cpuid.h target/resume.h \
+nat/ppc-linux.h ctf.h nat/x86-cpuid.h nat/x86-gcc-cpuid.h target/resume.h \
 target/wait.h target/waitstatus.h nat/linux-nat.h nat/linux-waitpid.h \
 common/print-utils.h common/rsp-low.h nat/x86-dregs.h x86-linux-nat.h \
 i386-linux-nat.h common/common-defs.h common/errors.h common/common-types.h \
index d126748209cae15fbfe23cda735f97eb343c5ba0..2b844a09dddcfe71f3283cfaa918d68c6f5badbe 100644 (file)
@@ -1,3 +1,13 @@
+2015-01-14  Yao Qi  <yao@codesourcery.com>
+
+       * linux-ppc-low.c: Include "nat/ppc-linux.h".
+        (PPC_FEATURE_HAS_VSX): Move to nat/ppc-linux.h.
+       (PPC_FEATURE_HAS_ALTIVEC,  PPC_FEATURE_HAS_SPE): Likewise.
+       (PT_ORIG_R3, PT_TRAP): Likewise.
+       (PTRACE_GETVSXREGS, PTRACE_SETVSXREGS): Likewise.
+       (PTRACE_GETVRREGS, PTRACE_SETVRREGS): Likewise.
+       (PTRACE_GETEVRREGS, PTRACE_SETEVRREGS): Likewise.
+
 2015-01-10  Joel Brobecker  <brobecker@adacore.com>
 
        * i387-fp.c (i387_cache_to_xsave): In look over
index 697fa6c111d401b8d1fff2d0fcb0972173ef191d..6e880c19376314e548a5ef98b784abae5cb7871d 100644 (file)
 #include <elf.h>
 #include <asm/ptrace.h>
 
-/* These are in <asm/cputable.h> in current kernels.  */
-#define PPC_FEATURE_HAS_VSX            0x00000080
-#define PPC_FEATURE_HAS_ALTIVEC         0x10000000
-#define PPC_FEATURE_HAS_SPE             0x00800000
-#define PPC_FEATURE_CELL                0x00010000
-#define PPC_FEATURE_HAS_DFP             0x00000400
+#include "nat/ppc-linux.h"
 
 static unsigned long ppc_hwcap;
 
@@ -95,14 +90,6 @@ extern const struct target_desc *tdesc_powerpc_isa205_vsx64l;
 
 #define ppc_num_regs 73
 
-/* This sometimes isn't defined.  */
-#ifndef PT_ORIG_R3
-#define PT_ORIG_R3 34
-#endif
-#ifndef PT_TRAP
-#define PT_TRAP 40
-#endif
-
 #ifdef __powerpc64__
 /* We use a constant for FPSCR instead of PT_FPSCR, because
    many shipped PPC64 kernels had the wrong value in ptrace.h.  */
@@ -544,11 +531,6 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf)
     ppc_collect_ptrace_register (regcache, i, (char *) buf + ppc_regmap[i]);
 }
 
-#ifndef PTRACE_GETVSXREGS
-#define PTRACE_GETVSXREGS 27
-#define PTRACE_SETVSXREGS 28
-#endif
-
 #define SIZEOF_VSXREGS 32*8
 
 static void
@@ -579,11 +561,6 @@ ppc_store_vsxregset (struct regcache *regcache, const void *buf)
     supply_register (regcache, base + i, &regset[i * 8]);
 }
 
-#ifndef PTRACE_GETVRREGS
-#define PTRACE_GETVRREGS 18
-#define PTRACE_SETVRREGS 19
-#endif
-
 #define SIZEOF_VRREGS 33*16+4
 
 static void
@@ -620,11 +597,6 @@ ppc_store_vrregset (struct regcache *regcache, const void *buf)
   supply_register_by_name (regcache, "vrsave", &regset[33 * 16]);
 }
 
-#ifndef PTRACE_GETEVRREGS
-#define PTRACE_GETEVRREGS      20
-#define PTRACE_SETEVRREGS      21
-#endif
-
 struct gdb_evrregset_t
 {
   unsigned long evr[32];
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
new file mode 100644 (file)
index 0000000..30d936f
--- /dev/null
@@ -0,0 +1,85 @@
+/* Copyright (C) 1995-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 PPC_LINUX_H
+#define PPC_LINUX_H 1
+
+#include <asm/ptrace.h>
+#include <asm/cputable.h>
+
+/* This sometimes isn't defined.  */
+#ifndef PT_ORIG_R3
+#define PT_ORIG_R3 34
+#endif
+#ifndef PT_TRAP
+#define PT_TRAP 40
+#endif
+
+/* The PPC_FEATURE_* defines should be provided by <asm/cputable.h>.
+   If they aren't, we can provide them ourselves (their values are fixed
+   because they are part of the kernel ABI).  They are used in the AT_HWCAP
+   entry of the AUXV.  */
+#ifndef PPC_FEATURE_CELL
+#define PPC_FEATURE_CELL 0x00010000
+#endif
+#ifndef PPC_FEATURE_BOOKE
+#define PPC_FEATURE_BOOKE 0x00008000
+#endif
+#ifndef PPC_FEATURE_HAS_DFP
+#define PPC_FEATURE_HAS_DFP    0x00000400  /* Decimal Floating Point.  */
+#endif
+#ifndef PPC_FEATURE_HAS_VSX
+#define PPC_FEATURE_HAS_VSX 0x00000080
+#endif
+#ifndef PPC_FEATURE_HAS_ALTIVEC
+#define PPC_FEATURE_HAS_ALTIVEC 0x10000000
+#endif
+#ifndef PPC_FEATURE_HAS_SPE
+#define PPC_FEATURE_HAS_SPE 0x00800000
+#endif
+
+/* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a
+   configure time check.  Some older glibc's (for instance 2.2.1)
+   don't have a specific powerpc version of ptrace.h, and fall back on
+   a generic one.  In such cases, sys/ptrace.h defines
+   PTRACE_GETFPXREGS and PTRACE_SETFPXREGS to the same numbers that
+   ppc kernel's asm/ptrace.h defines PTRACE_GETVRREGS and
+   PTRACE_SETVRREGS to be.  This also makes a configury check pretty
+   much useless.  */
+
+/* These definitions should really come from the glibc header files,
+   but Glibc doesn't know about the vrregs yet.  */
+#ifndef PTRACE_GETVRREGS
+#define PTRACE_GETVRREGS 18
+#define PTRACE_SETVRREGS 19
+#endif
+
+/* PTRACE requests for POWER7 VSX registers.  */
+#ifndef PTRACE_GETVSXREGS
+#define PTRACE_GETVSXREGS 27
+#define PTRACE_SETVSXREGS 28
+#endif
+
+/* Similarly for the ptrace requests for getting / setting the SPE
+   registers (ev0 -- ev31, acc, and spefscr).  See the description of
+   gdb_evrregset_t for details.  */
+#ifndef PTRACE_GETEVRREGS
+#define PTRACE_GETEVRREGS 20
+#define PTRACE_SETEVRREGS 21
+#endif
+
+#endif
index ce78b360e1465dbac182fd5113e61d790ddb25d6..c5a286bb97a07b57dfd0093bf4cf6def501f13b8 100644 (file)
 #include "elf/common.h"
 #include "auxv.h"
 
-/* This sometimes isn't defined.  */
-#ifndef PT_ORIG_R3
-#define PT_ORIG_R3 34
-#endif
-#ifndef PT_TRAP
-#define PT_TRAP 40
-#endif
-
-/* The PPC_FEATURE_* defines should be provided by <asm/cputable.h>.
-   If they aren't, we can provide them ourselves (their values are fixed
-   because they are part of the kernel ABI).  They are used in the AT_HWCAP
-   entry of the AUXV.  */
-#ifndef PPC_FEATURE_CELL
-#define PPC_FEATURE_CELL 0x00010000
-#endif
-#ifndef PPC_FEATURE_BOOKE
-#define PPC_FEATURE_BOOKE 0x00008000
-#endif
-#ifndef PPC_FEATURE_HAS_DFP
-#define PPC_FEATURE_HAS_DFP    0x00000400  /* Decimal Floating Point.  */
-#endif
-
-/* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a
-   configure time check.  Some older glibc's (for instance 2.2.1)
-   don't have a specific powerpc version of ptrace.h, and fall back on
-   a generic one.  In such cases, sys/ptrace.h defines
-   PTRACE_GETFPXREGS and PTRACE_SETFPXREGS to the same numbers that
-   ppc kernel's asm/ptrace.h defines PTRACE_GETVRREGS and
-   PTRACE_SETVRREGS to be.  This also makes a configury check pretty
-   much useless.  */
-
-/* These definitions should really come from the glibc header files,
-   but Glibc doesn't know about the vrregs yet.  */
-#ifndef PTRACE_GETVRREGS
-#define PTRACE_GETVRREGS 18
-#define PTRACE_SETVRREGS 19
-#endif
-
-/* PTRACE requests for POWER7 VSX registers.  */
-#ifndef PTRACE_GETVSXREGS
-#define PTRACE_GETVSXREGS 27
-#define PTRACE_SETVSXREGS 28
-#endif
-
-/* Similarly for the ptrace requests for getting / setting the SPE
-   registers (ev0 -- ev31, acc, and spefscr).  See the description of
-   gdb_evrregset_t for details.  */
-#ifndef PTRACE_GETEVRREGS
-#define PTRACE_GETEVRREGS 20
-#define PTRACE_SETEVRREGS 21
-#endif
+#include "nat/ppc-linux.h"
 
 /* Similarly for the hardware watchpoint support.  These requests are used
    when the PowerPC HWDEBUG ptrace interface is not available.  */
This page took 0.069072 seconds and 4 git commands to generate.