From: Yao Qi Date: Thu, 8 Jan 2015 09:23:55 +0000 (+0800) Subject: Move some ppc macros to nat/ppc-linux.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=514c533895543e246eea1771ea67f3c3486006a4;p=binutils-gdb.git 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 * 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 * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 648b341a3fa..3b954f82ce6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2015-01-14 Yao Qi + + * 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 PR gdb/17525 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 86ab1be15d3..968dc508796 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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 \ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index d126748209c..2b844a09ddd 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,13 @@ +2015-01-14 Yao Qi + + * 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 * i387-fp.c (i387_cache_to_xsave): In look over diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 697fa6c111d..6e880c19376 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -23,12 +23,7 @@ #include #include -/* These are in 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, ®set[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", ®set[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 index 00000000000..30d936fdb9b --- /dev/null +++ b/gdb/nat/ppc-linux.h @@ -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 . */ + +#ifndef PPC_LINUX_H +#define PPC_LINUX_H 1 + +#include +#include + +/* 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 . + 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 diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index ce78b360e14..c5a286bb97a 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -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 . - 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. */