From owner-svn-src-user@FreeBSD.ORG Thu Feb 4 00:53:51 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A47791065676; Thu, 4 Feb 2010 00:53:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9152B8FC08; Thu, 4 Feb 2010 00:53:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o140rpk9058996; Thu, 4 Feb 2010 00:53:51 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o140rpaL058991; Thu, 4 Feb 2010 00:53:51 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201002040053.o140rpaL058991@svn.freebsd.org> From: Warner Losh Date: Thu, 4 Feb 2010 00:53:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r203465 - in user/imp/tbemd/gnu/usr.bin/gdb: . gdbserver X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 00:53:51 -0000 Author: imp Date: Thu Feb 4 00:53:51 2010 New Revision: 203465 URL: http://svn.freebsd.org/changeset/base/203465 Log: Rename *-ppc.c to *-powerpc.c in gdbserver, then apply a more generic heuristic to see if we need gdbserver or not. Once that doesn't list every architecture. Added: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c - copied unchanged from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c - copied unchanged from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c Deleted: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Modified: user/imp/tbemd/gnu/usr.bin/gdb/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/Makefile Thu Feb 4 00:51:13 2010 (r203464) +++ user/imp/tbemd/gnu/usr.bin/gdb/Makefile Thu Feb 4 00:53:51 2010 (r203465) @@ -2,7 +2,7 @@ SUBDIR= doc libgdb gdb gdbtui kgdb -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "powerpc" +.if exists(${.CURDIR}/gdbserver/reg-${MACHINE_CPUARCH}.c) SUBDIR+=gdbserver .endif Modified: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Thu Feb 4 00:51:13 2010 (r203464) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/Makefile Thu Feb 4 00:53:51 2010 (r203465) @@ -14,16 +14,10 @@ SRCS= inferiors.c mem-break.c regcache.c server.c signals.c target.c utils.c SRCS+= fbsd-low.c -.if ${MACHINE_CPUARCH} == "i386" -SRCS+= fbsd-i386-low.c i387-fp.c reg-i386.c -.endif +SRCS+= fbsd-${MACHINE_CPUARCH}-low.c reg-${MACHINE_CPUARCH}.c -.if ${MACHINE_CPUARCH} == "arm" -SRCS+= fbsd-arm-low.c reg-arm.c -.endif - -.if ${MACHINE_CPUARCH} == "powerpc" -SRCS+= fbsd-ppc-low.c reg-ppc.c +.if ${MACHINE_CPUARCH} == "i386" +SRCS+= i387-fp.c .endif #CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_CPUARCH} Copied: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c (from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c Thu Feb 4 00:53:51 2010 (r203465, copy of r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) @@ -0,0 +1,156 @@ +/* FreeBSD/PowerPC specific low level interface, for the remote server for + GDB. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "server.h" +#include "fbsd-low.h" + +#include +#include + +#define ppc_num_regs 71 + +/* Currently, don't check/send MQ. */ +static int ppc_regmap[] = + { 0, 4, 8, 12, 16, 20, 24, 28, + 32, 36, 40, 44, 48, 52, 56, 60, + 64, 68, 72, 76, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, +#if 0 + /* + * XXX on FreeBSD the gdbserver for PowerPC was only tested with FPU-less + * cores i.e. e500. Let's leave the original FPR references around in case + * someone picks up and brings support for AIM-like FPU machines. + */ + PT_FPR0*4, PT_FPR0*4 + 8, PT_FPR0*4+16, PT_FPR0*4+24, + PT_FPR0*4+32, PT_FPR0*4+40, PT_FPR0*4+48, PT_FPR0*4+56, + PT_FPR0*4+64, PT_FPR0*4+72, PT_FPR0*4+80, PT_FPR0*4+88, + PT_FPR0*4+96, PT_FPR0*4+104, PT_FPR0*4+112, PT_FPR0*4+120, + PT_FPR0*4+128, PT_FPR0*4+136, PT_FPR0*4+144, PT_FPR0*4+152, + PT_FPR0*4+160, PT_FPR0*4+168, PT_FPR0*4+176, PT_FPR0*4+184, + PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216, + PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248, +#endif + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 144, -1, 132, 128, 140, 136, -1 + }; + +static int +ppc_cannot_store_register (int regno) +{ + /* Some kernels do not allow us to store fpscr. */ + if (regno == find_regno ("fpscr")) + return 2; + + return 0; +} + +static int +ppc_cannot_fetch_register (int regno) +{ + return 0; +} + +static CORE_ADDR +ppc_get_pc (void) +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return (CORE_ADDR) pc; +} + +static void +ppc_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. Note that this file is + for PowerPC only, not PowerPC64. + This instruction is "twge r2, r2", which GDB uses as a software + breakpoint. */ +static const unsigned long ppc_breakpoint = 0x7d821008; +#define ppc_breakpoint_len 4 + +static int +ppc_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == ppc_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + +static void +ppc_fill_gregset (void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + collect_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +static void +ppc_store_gregset (const void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + supply_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +struct regset_info target_regsets[] = { + { PT_GETREGS, PT_SETREGS, sizeof (struct reg), + GENERAL_REGS, + ppc_fill_gregset, ppc_store_gregset }, + { 0, 0, -1, -1, NULL, NULL } +}; + +struct fbsd_target_ops the_low_target = { + ppc_num_regs, + ppc_regmap, + ppc_cannot_fetch_register, + ppc_cannot_store_register, + ppc_get_pc, + ppc_set_pc, + (const char *) &ppc_breakpoint, + ppc_breakpoint_len, + NULL, + 0, + ppc_breakpoint_at, +}; Copied: user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c (from r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c Thu Feb 4 00:53:51 2010 (r203465, copy of r203406, user/imp/tbemd/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) @@ -0,0 +1,113 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* A register protocol for GDB, the GNU debugger. + Copyright 2001, 2002 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``regdat.sh'' and ``../../../../contrib/gdb/gdb/regformats/reg-ppc.dat''. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "regdef.h" +#include "regcache.h" + +struct reg regs_ppc[] = { + { "r0", 0, 32 }, + { "r1", 32, 32 }, + { "r2", 64, 32 }, + { "r3", 96, 32 }, + { "r4", 128, 32 }, + { "r5", 160, 32 }, + { "r6", 192, 32 }, + { "r7", 224, 32 }, + { "r8", 256, 32 }, + { "r9", 288, 32 }, + { "r10", 320, 32 }, + { "r11", 352, 32 }, + { "r12", 384, 32 }, + { "r13", 416, 32 }, + { "r14", 448, 32 }, + { "r15", 480, 32 }, + { "r16", 512, 32 }, + { "r17", 544, 32 }, + { "r18", 576, 32 }, + { "r19", 608, 32 }, + { "r20", 640, 32 }, + { "r21", 672, 32 }, + { "r22", 704, 32 }, + { "r23", 736, 32 }, + { "r24", 768, 32 }, + { "r25", 800, 32 }, + { "r26", 832, 32 }, + { "r27", 864, 32 }, + { "r28", 896, 32 }, + { "r29", 928, 32 }, + { "r30", 960, 32 }, + { "r31", 992, 32 }, + { "f0", 1024, 64 }, + { "f1", 1088, 64 }, + { "f2", 1152, 64 }, + { "f3", 1216, 64 }, + { "f4", 1280, 64 }, + { "f5", 1344, 64 }, + { "f6", 1408, 64 }, + { "f7", 1472, 64 }, + { "f8", 1536, 64 }, + { "f9", 1600, 64 }, + { "f10", 1664, 64 }, + { "f11", 1728, 64 }, + { "f12", 1792, 64 }, + { "f13", 1856, 64 }, + { "f14", 1920, 64 }, + { "f15", 1984, 64 }, + { "f16", 2048, 64 }, + { "f17", 2112, 64 }, + { "f18", 2176, 64 }, + { "f19", 2240, 64 }, + { "f20", 2304, 64 }, + { "f21", 2368, 64 }, + { "f22", 2432, 64 }, + { "f23", 2496, 64 }, + { "f24", 2560, 64 }, + { "f25", 2624, 64 }, + { "f26", 2688, 64 }, + { "f27", 2752, 64 }, + { "f28", 2816, 64 }, + { "f29", 2880, 64 }, + { "f30", 2944, 64 }, + { "f31", 3008, 64 }, + { "pc", 3072, 32 }, + { "ps", 3104, 32 }, + { "cr", 3136, 32 }, + { "lr", 3168, 32 }, + { "ctr", 3200, 32 }, + { "xer", 3232, 32 }, + { "fpscr", 3264, 32 }, +}; + +const char *expedite_regs_ppc[] = { "r1", "pc", 0 }; + +void +init_registers () +{ + set_register_cache (regs_ppc, + sizeof (regs_ppc) / sizeof (regs_ppc[0])); + gdbserver_expedite_regs = expedite_regs_ppc; +}