From patchwork Sun Jan 11 08:27:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 4609 Received: (qmail 31955 invoked by alias); 11 Jan 2015 08:27:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31923 invoked by uid 89); 11 Jan 2015 08:27:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Jan 2015 08:27:26 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1YADrm-0001IG-V0 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sun, 11 Jan 2015 00:27:22 -0800 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Sun, 11 Jan 2015 00:27:21 -0800 From: Yao Qi To: Subject: [PATCH 1/2] Move some ppc macros to nat/ppc-linux.h Date: Sun, 11 Jan 2015 16:27:25 +0800 Message-ID: <1420964846-18881-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1420964846-18881-1-git-send-email-yao@codesourcery.com> References: <201412191549.sBJFnfPW030448@d03av02.boulder.ibm.com> <1420964846-18881-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 X-IsSubscribed: yes 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-11 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-11 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. --- gdb/Makefile.in | 2 +- gdb/gdbserver/linux-ppc-low.c | 30 +-------------- gdb/nat/ppc-linux.h | 85 +++++++++++++++++++++++++++++++++++++++++++ gdb/ppc-linux-nat.c | 52 +------------------------- 4 files changed, 88 insertions(+), 81 deletions(-) create mode 100644 gdb/nat/ppc-linux.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 5dae3e6..f519f0a 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/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 697fa6c..6e880c1 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 0000000..30d936f --- /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 ce78b36..c5a286b 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. */