Module Name: src Committed By: rmind Date: Mon Mar 30 22:13:43 UTC 2009
Modified Files: src/sys/arch/amd64/conf: files.amd64 src/sys/arch/i386/conf: files.i386 src/sys/arch/x86/conf: files.x86 Added Files: src/sys/arch/x86/x86: core_machdep.c Removed Files: src/sys/arch/amd64/amd64: core_machdep.c src/sys/arch/i386/i386: core_machdep.c Log Message: Merge/move core_machdep.c into x86, no difference between i386 and amd64. To generate a diff of this commit: cvs rdiff -u -r1.3 -r0 src/sys/arch/amd64/amd64/core_machdep.c cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.344 -r1.345 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.2 -r0 src/sys/arch/i386/i386/core_machdep.c cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/core_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/conf/files.amd64 diff -u src/sys/arch/amd64/conf/files.amd64:1.62 src/sys/arch/amd64/conf/files.amd64:1.63 --- src/sys/arch/amd64/conf/files.amd64:1.62 Sat Feb 14 20:22:59 2009 +++ src/sys/arch/amd64/conf/files.amd64 Mon Mar 30 22:13:42 2009 @@ -1,4 +1,4 @@ -# $NetBSD: files.amd64,v 1.62 2009/02/14 20:22:59 cube Exp $ +# $NetBSD: files.amd64,v 1.63 2009/03/30 22:13:42 rmind Exp $ # # new style config file for amd64 architecture # @@ -31,7 +31,6 @@ file arch/amd64/amd64/amd64func.S file arch/amd64/amd64/autoconf.c file arch/amd64/amd64/busfunc.S -file arch/amd64/amd64/core_machdep.c coredump file arch/amd64/amd64/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum file arch/amd64/amd64/cpufunc.S file arch/amd64/amd64/db_disasm.c ddb Index: src/sys/arch/i386/conf/files.i386 diff -u src/sys/arch/i386/conf/files.i386:1.344 src/sys/arch/i386/conf/files.i386:1.345 --- src/sys/arch/i386/conf/files.i386:1.344 Thu Feb 19 13:06:49 2009 +++ src/sys/arch/i386/conf/files.i386 Mon Mar 30 22:13:42 2009 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.344 2009/02/19 13:06:49 jmcneill Exp $ +# $NetBSD: files.i386,v 1.345 2009/03/30 22:13:42 rmind Exp $ # # new style config file for i386 architecture # @@ -62,7 +62,6 @@ file arch/i386/i386/autoconf.c file arch/i386/i386/aout_machdep.c exec_aout file arch/i386/i386/busfunc.S -file arch/i386/i386/core_machdep.c coredump file arch/i386/i386/cpufunc.S file arch/i386/i386/cpu_in_cksum.S (inet | inet6) & cpu_in_cksum file arch/i386/i386/db_dbgreg.S ddb | kstack_check_dr0 Index: src/sys/arch/x86/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.46 src/sys/arch/x86/conf/files.x86:1.47 --- src/sys/arch/x86/conf/files.x86:1.46 Tue Feb 24 06:03:54 2009 +++ src/sys/arch/x86/conf/files.x86 Mon Mar 30 22:13:42 2009 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.46 2009/02/24 06:03:54 yamt Exp $ +# $NetBSD: files.x86,v 1.47 2009/03/30 22:13:42 rmind Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI @@ -45,6 +45,7 @@ file arch/x86/x86/bus_dma.c file arch/x86/x86/bus_space.c file arch/x86/x86/consinit.c +file arch/x86/x86/core_machdep.c coredump file arch/x86/x86/errata.c file arch/x86/x86/genfb_machdep.c file arch/x86/x86/identcpu.c Added files: Index: src/sys/arch/x86/x86/core_machdep.c diff -u /dev/null src/sys/arch/x86/x86/core_machdep.c:1.1 --- /dev/null Mon Mar 30 22:13:43 2009 +++ src/sys/arch/x86/x86/core_machdep.c Mon Mar 30 22:13:42 2009 @@ -0,0 +1,148 @@ +/* $NetBSD: core_machdep.c,v 1.1 2009/03/30 22:13:42 rmind Exp $ */ + +/*- + * Copyright (c) 1982, 1986 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department, and William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 + */ + +/*- + * Copyright (c) 1995 Charles M. Hannum. All rights reserved. + * Copyright (c) 1989, 1990 William Jolitz + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department, and William Jolitz. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 + */ + +/* + * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.1 2009/03/30 22:13:42 rmind Exp $"); + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/proc.h> +#include <sys/vnode.h> +#include <sys/buf.h> +#include <sys/user.h> +#include <sys/core.h> +#include <sys/exec.h> +#include <sys/ptrace.h> + +#include <uvm/uvm_extern.h> + +#include <machine/cpu.h> +#include <machine/gdt.h> +#include <machine/reg.h> +#include <machine/specialreg.h> + +/* + * Dump the machine specific segment at the start of a core dump. + */ + +struct md_core { + struct reg intreg; + struct fpreg freg; +}; + +int +cpu_coredump(struct lwp *l, void *iocookie, struct core *chdr) +{ + struct md_core md_core; + struct coreseg cseg; + int error; + + if (iocookie == NULL) { + CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0); + chdr->c_hdrsize = ALIGN(sizeof(*chdr)); + chdr->c_seghdrsize = ALIGN(sizeof(cseg)); + chdr->c_cpusize = sizeof(md_core); + chdr->c_nseg++; + return 0; + } + + /* Save integer registers. */ + error = process_read_regs(l, &md_core.intreg); + if (error) + return error; + + /* Save floating point registers. */ + error = process_read_fpregs(l, &md_core.freg); + if (error) + return error; + + CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU); + cseg.c_addr = 0; + cseg.c_size = chdr->c_cpusize; + + error = coredump_write(iocookie, UIO_SYSSPACE, &cseg, + chdr->c_seghdrsize); + if (error) + return error; + + return coredump_write(iocookie, UIO_SYSSPACE, + &md_core, sizeof(md_core)); +}