Date: Mon, 22 Feb 2010 20:42:30 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r204221 - in user/kib/vm6: contrib/bc contrib/gdb/gdb contrib/gdb/gdb/config/mips games/fortune/fortune gnu/usr.bin gnu/usr.bin/bc gnu/usr.bin/dc gnu/usr.bin/gdb/arch/mips gnu/usr.bin/g... Message-ID: <201002222042.o1MKgUOI053254@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Mon Feb 22 20:42:30 2010 New Revision: 204221 URL: http://svn.freebsd.org/changeset/base/204221 Log: MFH Added: user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h - copied unchanged from r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h - copied unchanged from r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h - copied unchanged from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h user/kib/vm6/sys/kern/subr_hash.c - copied unchanged from r204220, head/sys/kern/subr_hash.c user/kib/vm6/sys/kern/subr_uio.c - copied unchanged from r204220, head/sys/kern/subr_uio.c user/kib/vm6/sys/mips/rmi/bus_space_rmi_pci.c - copied unchanged from r204220, head/sys/mips/rmi/bus_space_rmi_pci.c user/kib/vm6/usr.bin/netstat/netisr.c - copied unchanged from r204220, head/usr.bin/netstat/netisr.c Deleted: user/kib/vm6/contrib/bc/ user/kib/vm6/gnu/usr.bin/bc/ user/kib/vm6/gnu/usr.bin/dc/ user/kib/vm6/sys/kern/kern_subr.c Modified: user/kib/vm6/contrib/gdb/gdb/mips-tdep.h user/kib/vm6/games/fortune/fortune/fortune.c user/kib/vm6/gnu/usr.bin/Makefile user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c user/kib/vm6/lib/libc/gen/sysctl.3 user/kib/vm6/lib/libc/gen/sysctl.c user/kib/vm6/lib/libc/gen/sysctlbyname.c user/kib/vm6/lib/libc/gen/sysctlnametomib.c user/kib/vm6/libexec/rtld-elf/powerpc/reloc.c user/kib/vm6/libexec/rtld-elf/powerpc/rtld_machdep.h user/kib/vm6/libexec/rtld-elf/powerpc/rtld_start.S user/kib/vm6/sbin/atacontrol/atacontrol.c user/kib/vm6/sbin/camcontrol/camcontrol.c user/kib/vm6/sbin/devfs/devfs.8 user/kib/vm6/sbin/hastd/proto_socketpair.c user/kib/vm6/sbin/ifconfig/ifconfig.8 user/kib/vm6/sbin/ifconfig/ifconfig.c user/kib/vm6/sbin/ifconfig/ifvlan.c user/kib/vm6/share/man/man5/devfs.rules.5 user/kib/vm6/share/man/man9/ieee80211_scan.9 user/kib/vm6/share/man/man9/netisr.9 user/kib/vm6/sys/amd64/amd64/busdma_machdep.c user/kib/vm6/sys/amd64/amd64/pmap.c user/kib/vm6/sys/arm/xscale/ixp425/cambria_fled.c user/kib/vm6/sys/boot/powerpc/ofw/Makefile user/kib/vm6/sys/boot/sparc64/loader/main.c user/kib/vm6/sys/cam/ata/ata_xpt.c user/kib/vm6/sys/cam/cam_xpt.c user/kib/vm6/sys/cam/cam_xpt_internal.h user/kib/vm6/sys/cam/scsi/scsi_xpt.c user/kib/vm6/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S user/kib/vm6/sys/conf/files user/kib/vm6/sys/conf/ldscript.mips.cfe user/kib/vm6/sys/dev/ata/ata-all.c user/kib/vm6/sys/dev/ata/ata-pci.c user/kib/vm6/sys/dev/ata/ata-sata.c user/kib/vm6/sys/dev/ata/chipsets/ata-intel.c user/kib/vm6/sys/dev/bge/if_bge.c user/kib/vm6/sys/dev/mii/brgphy.c user/kib/vm6/sys/dev/mii/miidevs user/kib/vm6/sys/dev/msk/if_msk.c user/kib/vm6/sys/dev/mxge/if_mxge.c user/kib/vm6/sys/dev/re/if_re.c user/kib/vm6/sys/dev/xen/netfront/netfront.c user/kib/vm6/sys/i386/conf/XEN user/kib/vm6/sys/i386/xen/pmap.c user/kib/vm6/sys/i386/xen/xen_machdep.c user/kib/vm6/sys/ia64/ia64/context.S user/kib/vm6/sys/ia64/ia64/exception.S user/kib/vm6/sys/ia64/ia64/locore.S user/kib/vm6/sys/ia64/ia64/pmap.c user/kib/vm6/sys/ia64/ia64/support.S user/kib/vm6/sys/ia64/ia64/syscall.S user/kib/vm6/sys/ia64/include/pmap.h user/kib/vm6/sys/kern/uipc_socket.c user/kib/vm6/sys/mips/include/intr_machdep.h user/kib/vm6/sys/mips/rmi/board.c user/kib/vm6/sys/mips/rmi/bus_space_rmi.c user/kib/vm6/sys/mips/rmi/files.xlr user/kib/vm6/sys/mips/rmi/interrupt.h user/kib/vm6/sys/mips/rmi/intr_machdep.c user/kib/vm6/sys/mips/rmi/iodi.c user/kib/vm6/sys/mips/rmi/pcibus.h user/kib/vm6/sys/mips/rmi/xlr_pci.c user/kib/vm6/sys/net/if.c user/kib/vm6/sys/net/if.h user/kib/vm6/sys/net/if_loop.c user/kib/vm6/sys/net/if_vlan.c user/kib/vm6/sys/net/netisr.c user/kib/vm6/sys/net/netisr.h user/kib/vm6/sys/netinet/in_proto.c user/kib/vm6/sys/netinet/ip_input.c user/kib/vm6/sys/netinet/ip_var.h user/kib/vm6/sys/netinet/sctp_input.c user/kib/vm6/sys/netinet/sctp_output.c user/kib/vm6/sys/netinet/sctp_output.h user/kib/vm6/sys/netinet/tcp_syncache.c user/kib/vm6/sys/powerpc/aim/machdep.c user/kib/vm6/sys/powerpc/aim/mmu_oea.c user/kib/vm6/sys/powerpc/aim/mmu_oea64.c user/kib/vm6/sys/powerpc/aim/trap.c user/kib/vm6/sys/powerpc/aim/uma_machdep.c user/kib/vm6/sys/powerpc/booke/copyinout.c user/kib/vm6/sys/powerpc/include/sr.h user/kib/vm6/sys/powerpc/include/vmparam.h user/kib/vm6/sys/powerpc/powermac/smu.c user/kib/vm6/sys/powerpc/powerpc/cpu.c user/kib/vm6/sys/sparc64/include/cache.h user/kib/vm6/sys/sparc64/include/cpu.h user/kib/vm6/sys/sparc64/include/md_var.h user/kib/vm6/sys/sparc64/include/pcpu.h user/kib/vm6/sys/sparc64/include/pmap.h user/kib/vm6/sys/sparc64/include/smp.h user/kib/vm6/sys/sparc64/include/tick.h user/kib/vm6/sys/sparc64/include/ver.h user/kib/vm6/sys/sparc64/sparc64/cache.c user/kib/vm6/sys/sparc64/sparc64/cheetah.c user/kib/vm6/sys/sparc64/sparc64/identcpu.c user/kib/vm6/sys/sparc64/sparc64/iommu.c user/kib/vm6/sys/sparc64/sparc64/machdep.c user/kib/vm6/sys/sparc64/sparc64/mp_locore.S user/kib/vm6/sys/sparc64/sparc64/mp_machdep.c user/kib/vm6/sys/sparc64/sparc64/nexus.c user/kib/vm6/sys/sparc64/sparc64/pmap.c user/kib/vm6/sys/sparc64/sparc64/spitfire.c user/kib/vm6/sys/sparc64/sparc64/tick.c user/kib/vm6/sys/sparc64/sparc64/trap.c user/kib/vm6/sys/sys/sysctl.h user/kib/vm6/sys/sys/systm.h user/kib/vm6/sys/vm/vm_init.c user/kib/vm6/sys/xen/evtchn/evtchn_dev.c user/kib/vm6/usr.bin/netstat/Makefile user/kib/vm6/usr.bin/netstat/main.c user/kib/vm6/usr.bin/netstat/netstat.1 user/kib/vm6/usr.bin/netstat/netstat.h user/kib/vm6/usr.sbin/chown/chgrp.1 user/kib/vm6/usr.sbin/chown/chown.8 user/kib/vm6/usr.sbin/chown/chown.c Directory Properties: user/kib/vm6/ (props changed) Copied: user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h (from r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/config/mips/nm-fbsd.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/config/mips/nm-fbsd.h) @@ -0,0 +1,48 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Native-dependent definitions for NetBSD/mips. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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. */ + +#ifndef NM_FBSD_H +#define NM_FBSD_H + +/* Override child_pid_to_exec_file in 'inftarg.c'. */ +#define CHILD_PID_TO_EXEC_FILE + +/* Type of the third argument to the `ptrace' system call. */ +#define PTRACE_ARG3_TYPE caddr_t + +/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */ +#define FETCH_INFERIOR_REGISTERS + +/* We can attach and detach. */ +#define ATTACH_DETACH + +/* Shared library support. */ + +#include "solib.h" + +#endif /* NM_FBSD_H */ Copied: user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h (from r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/config/mips/tm-fbsd.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/config/mips/tm-fbsd.h) @@ -0,0 +1,43 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Target-dependent definitions for NetBSD/mips. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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. */ + +#ifndef TM_FBSD_H +#define TM_FBSD_H + +#include "mips/tm-mips.h" +#include "solib.h" + +/* We don't want to inherit tm-mips.h's shared library trampoline code. */ +#undef IN_SOLIB_CALL_TRAMPOLINE +#undef IN_SOLIB_RETURN_TRAMPOLINE +#undef SKIP_TRAMPOLINE_CODE +#undef IGNORE_HELPER_CALL + +/* XXX undef a bunch of stuff we want to use multi-arch */ +#undef IN_SIGTRAMP +#endif /* TM_FBSD_H */ Modified: user/kib/vm6/contrib/gdb/gdb/mips-tdep.h ============================================================================== --- user/kib/vm6/contrib/gdb/gdb/mips-tdep.h Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/contrib/gdb/gdb/mips-tdep.h Mon Feb 22 20:42:30 2010 (r204221) @@ -62,6 +62,17 @@ struct mips_regnum extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch); enum { + MIPS_S0_REGNUM = 16, + MIPS_S1_REGNUM = 17, + MIPS_S2_REGNUM = 18, + MIPS_S3_REGNUM = 19, + MIPS_S4_REGNUM = 20, + MIPS_S5_REGNUM = 21, + MIPS_S6_REGNUM = 22, + MIPS_S7_REGNUM = 23, + MIPS_SP_REGNUM = 29, + MIPS_FP_REGNUM = 30, + MIPS_RA_REGNUM = 31, MIPS_EMBED_LO_REGNUM = 33, MIPS_EMBED_HI_REGNUM = 34, MIPS_EMBED_BADVADDR_REGNUM = 35, Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c (from r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-nat.c Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-nat.c) @@ -0,0 +1,108 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Native-dependent code for MIPS systems running NetBSD. + Copyright 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 "defs.h" +#include "inferior.h" +#include "regcache.h" + +#include "mipsfbsd-tdep.h" + +#include <sys/types.h> +#include <sys/ptrace.h> +#include <machine/reg.h> + +/* Determine if PT_GETREGS fetches this register. */ +static int +getregs_supplies (int regno) +{ + return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM); +} + +void +fetch_inferior_registers (int regno) +{ + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + mipsfbsd_supply_reg ((char *) ®s, regno); + if (regno != -1) + return; + } + + if (regno == -1 || regno >= FP0_REGNUM) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get floating point status"); + + mipsfbsd_supply_fpreg ((char *) &fpregs, regno); + } +} + +void +store_inferior_registers (int regno) +{ + if (regno == -1 || getregs_supplies (regno)) + { + struct reg regs; + + if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't get registers"); + + mipsfbsd_fill_reg ((char *) ®s, regno); + + if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) ®s, 0) == -1) + perror_with_name ("Couldn't write registers"); + + if (regno != -1) + return; + } + + if (regno == -1 || regno >= FP0_REGNUM) + { + struct fpreg fpregs; + + if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't get floating point status"); + + mipsfbsd_fill_fpreg ((char *) &fpregs, regno); + + if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) &fpregs, 0) == -1) + perror_with_name ("Couldn't write floating point status"); + } +} Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c (from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.c Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.c) @@ -0,0 +1,579 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Target-dependent code for MIPS systems running NetBSD. + Copyright 2002, 2003 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 "defs.h" +#include "gdbcore.h" +#include "regcache.h" +#include "target.h" +#include "value.h" +#include "osabi.h" + +#include "nbsd-tdep.h" +#include "mipsfbsd-tdep.h" +#include "mips-tdep.h" + +#include "solib-svr4.h" + +#include <sys/procfs.h> +#include "gregset.h" +#include "trad-frame.h" +#include "frame.h" +#include "frame-unwind.h" +#include "bfd.h" +#include "objfiles.h" + +/* Conveniently, GDB uses the same register numbering as the + ptrace register structure used by NetBSD/mips. */ + +void +mipsfbsd_supply_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i <= PC_REGNUM; i++) + { + if (regno == i || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, regs + (i * mips_regsize (current_gdbarch))); + } + } +} +void +supply_gregset (gdb_gregset_t *gregs) +{ + mipsfbsd_supply_reg((char *)gregs, -1); +} + +void +mipsfbsd_fill_reg (char *regs, int regno) +{ + int i; + + for (i = 0; i <= PC_REGNUM; i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, regs + (i * mips_regsize (current_gdbarch))); +} + +void +fill_gregset (gdb_gregset_t *gregs, int regno) +{ + mipsfbsd_fill_reg ((char *)gregs, regno); +} + +void +mipsfbsd_supply_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; + i <= mips_regnum (current_gdbarch)->fp_implementation_revision; + i++) + { + if (regno == i || regno == -1) + { + if (CANNOT_FETCH_REGISTER (i)) + supply_register (i, NULL); + else + supply_register (i, + fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); + } + } +} + +void +supply_fpregset (gdb_fpregset_t *fpregs) +{ + mipsfbsd_supply_fpreg((char *)fpregs, -1); +} + +void +mipsfbsd_fill_fpreg (char *fpregs, int regno) +{ + int i; + + for (i = FP0_REGNUM; i <= mips_regnum (current_gdbarch)->fp_control_status; + i++) + if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i)) + regcache_collect (i, + fpregs + ((i - FP0_REGNUM) * mips_regsize (current_gdbarch))); +} + +void +fill_fpregset (gdb_fpregset_t *fpregs, int regno) +{ + mipsfbsd_fill_fpreg ((char *)fpregs, regno); +} + +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + char *regs, *fpregs; + + /* We get everything from one section. */ + if (which != 0) + return; + + regs = core_reg_sect; + fpregs = core_reg_sect + SIZEOF_STRUCT_REG; + + /* Integer registers. */ + mipsfbsd_supply_reg (regs, -1); + + /* Floating point registers. */ + mipsfbsd_supply_fpreg (fpregs, -1); +} + +static void +fetch_elfcore_registers (char *core_reg_sect, unsigned core_reg_size, int which, + CORE_ADDR ignore) +{ + switch (which) + { + case 0: /* Integer registers. */ + if (core_reg_size != SIZEOF_STRUCT_REG) + warning ("Wrong size register set in core file."); + else + mipsfbsd_supply_reg (core_reg_sect, -1); + break; + + case 2: /* Floating point registers. */ + if (core_reg_size != SIZEOF_STRUCT_FPREG) + warning ("Wrong size register set in core file."); + else + mipsfbsd_supply_fpreg (core_reg_sect, -1); + break; + + default: + /* Don't know what kind of register request this is; just ignore it. */ + break; + } +} + +static struct core_fns mipsfbsd_core_fns = +{ + bfd_target_unknown_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + + +/* + * MIPSFBSD Offsets + * 0x7fff0000 User high mem -> USRSTACK [64K] + * + * 0x7ffefff0 ps_strings -> 16 bytes + * + * 0x7ffeffec sigcode -> 44 bytes + * + * 0x7ffeffc4 sigcode end env strings etc start + */ +#define MIPS_FBSD_SIGTRAMP_START (0x7ffeffc4) +#define MIPS_FBSD_SIGTRAMP_END (0x7ffeffec) +#define MIPS_FBSD_SIGTRAMP_STACK_MOD_START (0x7ffeffc8) +#define MIPS_FBSD_SIGTRAMP_STACK_MOD_END (0x7ffeffd8) + +static LONGEST +mipsfbsd_sigtramp_offset (CORE_ADDR pc) +{ + return pc < MIPS_FBSD_SIGTRAMP_END && + pc >= MIPS_FBSD_SIGTRAMP_START ? 1 : -1; +} + +static int +fbsd_pc_in_sigtramp (CORE_ADDR pc, char *name) +{ + return (name && strcmp (name, "__sigtramp") == 0); +} + +static int +mipsfbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) +{ + return (fbsd_pc_in_sigtramp (pc, func_name) + || mipsfbsd_sigtramp_offset (pc) >= 0); +} + +static int +is_sigtramp_sp_modified (CORE_ADDR pc) +{ + return (pc >= MIPS_FBSD_SIGTRAMP_STACK_MOD_START && + pc <= MIPS_FBSD_SIGTRAMP_STACK_MOD_END); +} + + +/* Figure out where the longjmp will land. We expect that we have + just entered longjmp and haven't yet setup the stack frame, so + the args are still in the argument regs. A0_REGNUM points at the + jmp_buf structure from which we extract the PC that we will land + at. The PC is copied into *pc. This routine returns true on + success. */ + +#define FBSD_MIPS_JB_PC (12) +#define FBSD_MIPS_JB_ELEMENT_SIZE mips_regsize (current_gdbarch) +#define FBSD_MIPS_JB_OFFSET (FBSD_MIPS_JB_PC * \ + FBSD_MIPS_JB_ELEMENT_SIZE) + +static int +mipsfbsd_get_longjmp_target (CORE_ADDR *pc) +{ + CORE_ADDR jb_addr; + char *buf; + + buf = alloca (FBSD_MIPS_JB_ELEMENT_SIZE); + + jb_addr = read_register (A0_REGNUM); + + if (target_read_memory (jb_addr + FBSD_MIPS_JB_OFFSET, buf, + FBSD_MIPS_JB_ELEMENT_SIZE)) + return 0; + + *pc = extract_unsigned_integer (buf, FBSD_MIPS_JB_ELEMENT_SIZE); + + return 1; +} + +static int +mipsfbsd_cannot_fetch_register (int regno) +{ + return (regno == ZERO_REGNUM + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); + /* XXX TODO: Are there other registers that we cannot fetch ? */ +} + +static int +mipsfbsd_cannot_store_register (int regno) +{ + return (regno == ZERO_REGNUM + || regno == mips_regnum (current_gdbarch)->fp_implementation_revision); + /* XXX TODO: Are there other registers that we cannot write ? */ +} + +/* + * This structure is defined in mips-tdep.c. + */ +struct mips_frame_cache +{ + CORE_ADDR base; + struct trad_frame_saved_reg *saved_regs; +}; + +/* + * Prologue cache for sigtramp frame + * When we land in sigtramp, sigcontext is saved on the + * stack just below the sigtramp's stack frame. We have + * the Registers saved at fixed offsets on the stack. + */ + +#define MIPS_FBSD_SIGTRAMP_STACK_SIZE (48) +#define MIPS_FBSD_SIGCONTEXT_REG_OFFSET (32) + +static struct mips_frame_cache * +mipsfbsd_sigtramp_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct mips_frame_cache *cache; + CORE_ADDR gregs_addr, sp, pc; + int regnum; + int sigtramp_stack_size; + + if (*this_cache) + return *this_cache; + + cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache); + *this_cache = cache; + + cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + + /* + * Get sp of next frame which is the adjusted sp of + * tramp code. + */ + sp = frame_unwind_register_unsigned(next_frame, NUM_REGS + SP_REGNUM); + pc = frame_unwind_register_unsigned(next_frame, NUM_REGS + PC_REGNUM); + sigtramp_stack_size = is_sigtramp_sp_modified(pc) ? + MIPS_FBSD_SIGTRAMP_STACK_SIZE : 0; + gregs_addr = sp + sigtramp_stack_size + MIPS_FBSD_SIGCONTEXT_REG_OFFSET; + + for (regnum = 0; regnum < PC_REGNUM; regnum++) { + cache->saved_regs[NUM_REGS + regnum].addr = gregs_addr + + regnum * mips_regsize (current_gdbarch); + } + /* Only retrieve PC and SP */ + cache->saved_regs[NUM_REGS + SP_REGNUM].addr = gregs_addr + + SP_REGNUM * ( mips_regsize (current_gdbarch)); + + cache->saved_regs[NUM_REGS + RA_REGNUM].addr = gregs_addr + + RA_REGNUM * ( mips_regsize (current_gdbarch)); + + cache->base = get_frame_memory_unsigned (next_frame, + cache->saved_regs[NUM_REGS + SP_REGNUM].addr, + mips_regsize (current_gdbarch)); + + /* Todo: Floating point registers */ + + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc] + = cache->saved_regs[NUM_REGS + RA_REGNUM]; + + return *this_cache; +} + +static void +mipsfbsd_sigtramp_frame_this_id (struct frame_info *next_frame, + void **this_cache, + struct frame_id *this_id) +{ + struct mips_frame_cache *cache = + mipsfbsd_sigtramp_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].addr); +} + +static void +mipsfbsd_sigtramp_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, + CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct mips_frame_cache *cache = + mipsfbsd_sigtramp_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + + +static const struct frame_unwind mipsfbsd_sigtramp_frame_unwind = +{ + SIGTRAMP_FRAME, + mipsfbsd_sigtramp_frame_this_id, + mipsfbsd_sigtramp_frame_prev_register +}; + +static const struct frame_unwind * +mipsfbsd_sigtramp_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + char *name; + + find_pc_partial_function (pc, &name, NULL, NULL); + if (mipsfbsd_pc_in_sigtramp (pc, name) ) + return &mipsfbsd_sigtramp_frame_unwind; + + return NULL; +} + +/* + * Find out if PC has landed into dynamic library stub. + * We can find it by seeing if the name of the object + * file section where the PC lies is "MIPS.stubs" + */ + +int +mipsfbsd_in_stub_section (CORE_ADDR pc, char *name) +{ + struct obj_section *s; + int retval = 0; + + s = find_pc_section (pc); + + retval = (s != NULL + && s->the_bfd_section->name != NULL + && strcmp (s->the_bfd_section->name, ".MIPS.stubs") == 0); + return (retval); +} + + +/* + * Prologue cache for dynamic library stub frame. + * This stub does not modify the SP, so we set the + * cache base to calling frame's SP + */ +static struct mips_frame_cache * +mipsfbsd_stub_frame_cache (struct frame_info *next_frame, + void **this_cache) +{ + struct mips_frame_cache *cache; + + if (*this_cache) + return *this_cache; + + cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache); + *this_cache = cache; + + cache->saved_regs = trad_frame_alloc_saved_regs (next_frame); + + + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].realreg = + NUM_REGS + RA_REGNUM; + cache->base = frame_unwind_register_unsigned (next_frame, + NUM_REGS + SP_REGNUM); + + return (*this_cache); +} + + +static void +mipsfbsd_stub_frame_this_id (struct frame_info *next_frame, + void **this_cache, + struct frame_id *this_id) +{ + struct mips_frame_cache *cache = + mipsfbsd_stub_frame_cache (next_frame, this_cache); + + (*this_id) = frame_id_build (cache->base, + cache->saved_regs[NUM_REGS + mips_regnum (current_gdbarch)->pc].addr); +} + +static void +mipsfbsd_stub_frame_prev_register (struct frame_info *next_frame, + void **this_cache, + int regnum, int *optimizedp, + enum lval_type *lvalp, CORE_ADDR *addrp, + int *realnump, void *valuep) +{ + struct mips_frame_cache *cache = + mipsfbsd_stub_frame_cache (next_frame, this_cache); + + trad_frame_prev_register (next_frame, cache->saved_regs, regnum, + optimizedp, lvalp, addrp, realnump, valuep); +} + + + +static const struct frame_unwind mipsfbsd_stub_frame_unwind = { + NORMAL_FRAME, + mipsfbsd_stub_frame_this_id, + mipsfbsd_stub_frame_prev_register +}; + +static const struct frame_unwind * +mipsfbsd_stub_frame_sniffer (struct frame_info *next_frame) +{ + CORE_ADDR pc = frame_pc_unwind (next_frame); + + if (mipsfbsd_in_stub_section(pc, NULL)) + return &mipsfbsd_stub_frame_unwind; + + return NULL; +} + +/* + * typedef struct link_map { + * caddr_t l_addr; /* Base Address of library + * #ifdef __mips__ + * caddr_t l_offs; /* Load Offset of library + * #endif + * const char *l_name; /* Absolute Path to Library + * const void *l_ld; /* Pointer to .dynamic in memory + * struct link_map *l_next, *l_prev; /* linked list of of mapped libs + * } Link_map; + * + * struct r_debug { + * int r_version; /* not used + * struct link_map *r_map; /* list of loaded images + * void (*r_brk)(struct r_debug *, struct link_map *); + * /* pointer to break point + * enum { + * RT_CONSISTENT, /* things are stable + * RT_ADD, /* adding a shared library + * RT_DELETE /* removing a shared library + * } r_state; + * }; + * + */ + +static struct link_map_offsets * +mipsfbsd_ilp32_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 16; + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 24; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 4; + + lmo.l_name_offset = 8; + lmo.l_name_size = 4; + + lmo.l_next_offset = 16; + lmo.l_next_size = 4; + + lmo.l_prev_offset = 20; + lmo.l_prev_size = 4; + } + + return lmp; +} + +static void +mipsfbsd_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + set_gdbarch_pc_in_sigtramp (gdbarch, mipsfbsd_pc_in_sigtramp); + + set_gdbarch_get_longjmp_target (gdbarch, mipsfbsd_get_longjmp_target); + + set_gdbarch_cannot_fetch_register (gdbarch, mipsfbsd_cannot_fetch_register); + set_gdbarch_cannot_store_register (gdbarch, mipsfbsd_cannot_store_register); + + set_gdbarch_software_single_step (gdbarch, mips_software_single_step); + set_solib_svr4_fetch_link_map_offsets (gdbarch, + mipsfbsd_ilp32_solib_svr4_fetch_link_map_offsets); + set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); + set_gdbarch_in_solib_call_trampoline (gdbarch, mipsfbsd_in_stub_section); + + /* frame sniffers */ + frame_unwind_append_sniffer (gdbarch, mipsfbsd_sigtramp_frame_sniffer); + frame_unwind_append_sniffer (gdbarch, mipsfbsd_stub_frame_sniffer); + +} + +void +_initialize_mipsfbsd_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_ELF, + mipsfbsd_init_abi); +} Copied: user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h (from r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kib/vm6/contrib/gdb/gdb/mipsfbsd-tdep.h Mon Feb 22 20:42:30 2010 (r204221, copy of r204220, head/contrib/gdb/gdb/mipsfbsd-tdep.h) @@ -0,0 +1,40 @@ +/*********************************************************************** +Copyright 2003-2006 Raza Microelectronics, Inc.(RMI). +This is a derived work from software originally provided by the external +entity identified below. The licensing terms and warranties specified in +the header of the original work apply to this derived work. +Contribution by RMI: +*****************************#RMI_1#**********************************/ +/* Common target dependent code for GDB on MIPS systems running NetBSD. + Copyright 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. */ + +#ifndef mipsfbsd_TDEP_H +#define mipsfbsd_TDEP_H + +void mipsfbsd_supply_reg (char *, int); +void mipsfbsd_fill_reg (char *, int); + +void mipsfbsd_supply_fpreg (char *, int); +void mipsfbsd_fill_fpreg (char *, int); + +#define SIZEOF_STRUCT_REG (38 * mips_regsize (current_gdbarch)) +#define SIZEOF_STRUCT_FPREG (33 * mips_regsize (current_gdbarch)) + +#endif /* mipsfbsd_TDEP_H */ Modified: user/kib/vm6/games/fortune/fortune/fortune.c ============================================================================== --- user/kib/vm6/games/fortune/fortune/fortune.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/games/fortune/fortune/fortune.c Mon Feb 22 20:42:30 2010 (r204221) @@ -216,7 +216,7 @@ main(int argc, char *argv[]) sleep((unsigned int) max(Fort_len / CPERS, MINW)); } - return (0); + exit(0); } void Modified: user/kib/vm6/gnu/usr.bin/Makefile ============================================================================== --- user/kib/vm6/gnu/usr.bin/Makefile Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/Makefile Mon Feb 22 20:42:30 2010 (r204221) @@ -21,10 +21,6 @@ SUBDIR= ${_binutils} \ sort \ ${_texinfo} -.if ${MACHINE_ARCH} == "mips" -MK_GDB=no # not yet -.endif - .if ${MK_CXX} != "no" _gperf= gperf .if ${MK_GROFF} != "no" Modified: user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/arch/mips/Makefile Mon Feb 22 20:42:30 2010 (r204221) @@ -1,10 +1,10 @@ # $FreeBSD$ .if !defined(GDB_CROSS_DEBUGGER) -LIBSRCS+= mips-nat.c mips-nat.c mipsfbsd-nat.c +LIBSRCS+= mipsfbsd-nat.c .endif LIBSRCS+= solib.c solib-svr4.c -LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c +LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c nm.h: echo '#include "mips/nm-fbsd.h"' > ${.TARGET} Modified: user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/arch/mips/init.c Mon Feb 22 20:42:30 2010 (r204221) @@ -123,15 +123,19 @@ initialize_all_files (void) _initialize_ser_pipe (); _initialize_ser_tcp (); #ifndef CROSS_DEBUGGER +#if 0 _initialize_mipsfbsd_nat (); _initialize_mips_nat (); +#endif _initialize_kernel_u_addr (); _initialize_infptrace (); _initialize_inftarg (); _initialize_solib (); _initialize_svr4_solib (); +#if 0 _initialize_svr4_lm (); #endif +#endif _initialize_remote (); _initialize_dcache (); _initialize_sr_support (); Modified: user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c ============================================================================== --- user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/gnu/usr.bin/gdb/kgdb/trgt_mips.c Mon Feb 22 20:42:30 2010 (r204221) @@ -61,18 +61,17 @@ kgdb_trgt_fetch_registers(int regno __un warnx("kvm_read: %s", kvm_geterr(kvm)); memset(&pcb, 0, sizeof(pcb)); } - supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context.val[0]); - supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context.val[1]); - supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context.val[2]); - supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context.val[3]); - supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context.val[4]); - supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context.val[5]); - supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context.val[6]); - supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context.val[7]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context.val[8]); - supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context.val[9]); - supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context.val[10]); + supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]); + supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]); + supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]); + supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[3]); + supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[4]); + supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[5]); + supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[6]); + supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[7]); + supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[8]); + supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[9]); + supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[10]); } void Modified: user/kib/vm6/lib/libc/gen/sysctl.3 ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctl.3 Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctl.3 Mon Feb 22 20:42:30 2010 (r204221) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd February 21, 2010 .Dt SYSCTL 3 .Os .Sh NAME @@ -42,9 +42,9 @@ .In sys/types.h .In sys/sysctl.h .Ft int -.Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" +.Fn sysctl "const int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen" .Ft int -.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" +.Fn sysctlbyname "const char *name" "void *oldp" "size_t *oldlenp" "const void *newp" "size_t newlen" .Ft int .Fn sysctlnametomib "const char *name" "int *mibp" "size_t *sizep" .Sh DESCRIPTION Modified: user/kib/vm6/lib/libc/gen/sysctl.c ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctl.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctl.c Mon Feb 22 20:42:30 2010 (r204221) @@ -43,15 +43,12 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #include <string.h> -extern int __sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, - void *newp, size_t newlen); +extern int __sysctl(const int *name, u_int namelen, void *oldp, + size_t *oldlenp, const void *newp, size_t newlen); int -sysctl(name, namelen, oldp, oldlenp, newp, newlen) - int *name; - u_int namelen; - void *oldp, *newp; - size_t *oldlenp, newlen; +sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp, + const void *newp, size_t newlen) { if (name[0] != CTL_USER) return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen)); Modified: user/kib/vm6/lib/libc/gen/sysctlbyname.c ============================================================================== --- user/kib/vm6/lib/libc/gen/sysctlbyname.c Mon Feb 22 19:17:17 2010 (r204220) +++ user/kib/vm6/lib/libc/gen/sysctlbyname.c Mon Feb 22 20:42:30 2010 (r204221) @@ -13,27 +13,19 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/sysctl.h> -#include <string.h> int *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002222042.o1MKgUOI053254>