Move some ppc macros to nat/ppc-linux.h

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.
This commit is contained in:
Yao Qi 2015-01-08 17:23:55 +08:00
parent 5589af0e66
commit 514c533895
6 changed files with 111 additions and 81 deletions

View 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

View 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 \

View 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

View File

@ -23,12 +23,7 @@
#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];

85
gdb/nat/ppc-linux.h Normal file
View File

@ -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

View File

@ -46,57 +46,7 @@
#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. */