svn commit: r214373 - in head/sys: amd64/amd64 conf i386/i386 x86/x86

Attilio Rao attilio at FreeBSD.org
Tue Oct 26 12:46:27 UTC 2010


Author: attilio
Date: Tue Oct 26 12:46:26 2010
New Revision: 214373
URL: http://svn.freebsd.org/changeset/base/214373

Log:
  Merge dump_machdep.c i386/amd64 under the x86 subtree.
  
  Sponsored by:	Sandvine Incorporated
  Tested by:	gianni

Added:
  head/sys/x86/x86/dump_machdep.c
     - copied, changed from r214370, head/sys/amd64/amd64/dump_machdep.c
Deleted:
  head/sys/amd64/amd64/dump_machdep.c
  head/sys/i386/i386/dump_machdep.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98

Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64	Tue Oct 26 10:23:49 2010	(r214372)
+++ head/sys/conf/files.amd64	Tue Oct 26 12:46:26 2010	(r214373)
@@ -104,7 +104,6 @@ amd64/amd64/cpu_switch.S	standard
 amd64/amd64/db_disasm.c		optional	ddb
 amd64/amd64/db_interface.c	optional	ddb
 amd64/amd64/db_trace.c		optional	ddb
-amd64/amd64/dump_machdep.c	standard
 amd64/amd64/elf_machdep.c	standard
 amd64/amd64/exception.S		standard
 amd64/amd64/fpu.c		standard
@@ -321,6 +320,7 @@ x86/isa/isa_dma.c		standard
 x86/isa/nmi.c			standard
 x86/isa/orm.c			optional	isa
 x86/pci/qpi.c			standard
+x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		standard
 x86/x86/local_apic.c		standard
 x86/x86/mca.c			standard

Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386	Tue Oct 26 10:23:49 2010	(r214372)
+++ head/sys/conf/files.i386	Tue Oct 26 12:46:26 2010	(r214373)
@@ -263,7 +263,6 @@ i386/i386/busdma_machdep.c	standard
 i386/i386/db_disasm.c		optional ddb
 i386/i386/db_interface.c	optional ddb
 i386/i386/db_trace.c		optional ddb
-i386/i386/dump_machdep.c	standard
 i386/i386/elan-mmcr.c		optional cpu_elan | cpu_soekris
 i386/i386/elf_machdep.c		standard
 i386/i386/exception.s		optional native
@@ -395,6 +394,7 @@ x86/isa/isa_dma.c		optional isa
 x86/isa/nmi.c			standard
 x86/isa/orm.c			optional isa
 x86/pci/qpi.c			standard
+x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		optional apic
 x86/x86/local_apic.c		optional apic
 x86/x86/mca.c			standard

Modified: head/sys/conf/files.pc98
==============================================================================
--- head/sys/conf/files.pc98	Tue Oct 26 10:23:49 2010	(r214372)
+++ head/sys/conf/files.pc98	Tue Oct 26 12:46:26 2010	(r214373)
@@ -138,7 +138,6 @@ i386/i386/busdma_machdep.c	standard
 i386/i386/db_disasm.c		optional ddb
 i386/i386/db_interface.c	optional ddb
 i386/i386/db_trace.c		optional ddb
-i386/i386/dump_machdep.c	standard
 i386/i386/elf_machdep.c		standard
 i386/i386/exception.s		standard
 i386/i386/gdb_machdep.c		optional gdb
@@ -255,6 +254,7 @@ pc98/pc98/pc98_machdep.c	standard
 x86/isa/atpic.c			optional atpic	
 x86/isa/clock.c			standard
 x86/isa/isa.c			optional isa
+x86/x86/dump_machdep.c		standard
 x86/x86/io_apic.c		optional apic
 x86/x86/local_apic.c		optional apic
 x86/x86/mca.c			standard

Copied and modified: head/sys/x86/x86/dump_machdep.c (from r214370, head/sys/amd64/amd64/dump_machdep.c)
==============================================================================
--- head/sys/amd64/amd64/dump_machdep.c	Tue Oct 26 08:50:09 2010	(r214370, copy source)
+++ head/sys/x86/x86/dump_machdep.c	Tue Oct 26 12:46:26 2010	(r214373)
@@ -36,9 +36,18 @@ __FBSDID("$FreeBSD$");
 #include <sys/kerneldump.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
+#include <machine/_inttypes.h>
 #include <machine/elf.h>
 #include <machine/md_var.h>
 
+#ifdef __amd64__
+#define	KERNELDUMP_VERSION	KERNELDUMP_AMD64_VERSION
+#define	EM_VALUE		EM_X86_64
+#else
+#define	KERNELDUMP_VERSION	KERNELDUMP_I386_VERSION
+#define	EM_VALUE		EM_386
+#endif
+
 CTASSERT(sizeof(struct kerneldumpheader) == 512);
 
 int do_minidump = 1;
@@ -168,7 +177,8 @@ cb_dumpdata(struct md_pa *mdp, int seqnr
 	if (maxdumppgs == 0)	/* seatbelt */
 		maxdumppgs = 1;
 
-	printf("  chunk %d: %ldMB (%ld pages)", seqnr, PG2MB(pgs), pgs);
+	printf("  chunk %d: %"PRIu64"MB (%"PRIu64" pages)", seqnr, PG2MB(pgs),
+	    pgs);
 
 	while (pgs) {
 		chunk = pgs;
@@ -177,7 +187,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr
 		sz = chunk << PAGE_SHIFT;
 		counter += sz;
 		if (counter >> 24) {
-			printf(" %ld", PG2MB(pgs));
+			printf(" %"PRIu64, PG2MB(pgs));
 			counter &= (1<<24) - 1;
 		}
 		for (i = 0; i < chunk; i++) {
@@ -279,7 +289,7 @@ dumpsys(struct dumperinfo *di)
 	ehdr.e_ident[EI_VERSION] = EV_CURRENT;
 	ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE;	/* XXX big picture? */
 	ehdr.e_type = ET_CORE;
-	ehdr.e_machine = EM_X86_64;
+	ehdr.e_machine = EM_VALUE;
 	ehdr.e_phoff = sizeof(ehdr);
 	ehdr.e_flags = 0;
 	ehdr.e_ehsize = sizeof(ehdr);
@@ -304,7 +314,8 @@ dumpsys(struct dumperinfo *di)
 	dumplo = di->mediaoffset + di->mediasize - dumpsize;
 	dumplo -= sizeof(kdh) * 2;
 
-	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
+	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_VERSION, dumpsize,
+	    di->blocksize);
 
 	printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20,
 	    ehdr.e_phnum);


More information about the svn-src-all mailing list