aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2008-10-01 22:08:53 +0000
committerPeter Wemm <peter@FreeBSD.org>2008-10-01 22:08:53 +0000
commite6592ee55c70841f91ba307ed5da17d12cd809bd (patch)
tree63a9bf6e972762df141963f82c26829a6b8cb9b8 /sys/amd64
parentb2ce9725370692b8dda994d51810755188dcdfff (diff)
downloadsrc-e6592ee55c70841f91ba307ed5da17d12cd809bd.tar.gz
src-e6592ee55c70841f91ba307ed5da17d12cd809bd.zip
Collect N identical (or near identical) mkdumpheader() implementations into
one, as threatened in the comment. Textdump magic can be passed in.
Notes
Notes: svn path=/head/; revision=183527
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/dump_machdep.c23
-rw-r--r--sys/amd64/amd64/minidump_machdep.c23
2 files changed, 2 insertions, 44 deletions
diff --git a/sys/amd64/amd64/dump_machdep.c b/sys/amd64/amd64/dump_machdep.c
index 08d32d5ab7d9..c07f0cae5945 100644
--- a/sys/amd64/amd64/dump_machdep.c
+++ b/sys/amd64/amd64/dump_machdep.c
@@ -105,27 +105,6 @@ md_pa_next(struct md_pa *mdp)
return (mdp);
}
-/* XXX should be MI */
-static void
-mkdumpheader(struct kerneldumpheader *kdh, uint32_t archver, uint64_t dumplen,
- uint32_t blksz)
-{
-
- bzero(kdh, sizeof(*kdh));
- strncpy(kdh->magic, KERNELDUMPMAGIC, sizeof(kdh->magic));
- strncpy(kdh->architecture, MACHINE_ARCH, sizeof(kdh->architecture));
- kdh->version = htod32(KERNELDUMPVERSION);
- kdh->architectureversion = htod32(archver);
- kdh->dumplength = htod64(dumplen);
- kdh->dumptime = htod64(time_second);
- kdh->blocksize = htod32(blksz);
- strncpy(kdh->hostname, G_hostname, sizeof(kdh->hostname));
- strncpy(kdh->versionstring, version, sizeof(kdh->versionstring));
- if (panicstr != NULL)
- strncpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring));
- kdh->parity = kerneldump_parity(kdh);
-}
-
static int
buf_write(struct dumperinfo *di, char *ptr, size_t sz)
{
@@ -326,7 +305,7 @@ dumpsys(struct dumperinfo *di)
dumplo = di->mediaoffset + di->mediasize - dumpsize;
dumplo -= sizeof(kdh) * 2;
- mkdumpheader(&kdh, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
+ mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20,
ehdr.e_phnum);
diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c
index d3c4309ced96..ec6727c5c243 100644
--- a/sys/amd64/amd64/minidump_machdep.c
+++ b/sys/amd64/amd64/minidump_machdep.c
@@ -81,27 +81,6 @@ is_dumpable(vm_paddr_t pa)
return (0);
}
-/* XXX should be MI */
-static void
-mkdumpheader(struct kerneldumpheader *kdh, uint32_t archver, uint64_t dumplen,
- uint32_t blksz)
-{
-
- bzero(kdh, sizeof(*kdh));
- strncpy(kdh->magic, KERNELDUMPMAGIC, sizeof(kdh->magic));
- strncpy(kdh->architecture, MACHINE_ARCH, sizeof(kdh->architecture));
- kdh->version = htod32(KERNELDUMPVERSION);
- kdh->architectureversion = htod32(archver);
- kdh->dumplength = htod64(dumplen);
- kdh->dumptime = htod64(time_second);
- kdh->blocksize = htod32(blksz);
- strncpy(kdh->hostname, G_hostname, sizeof(kdh->hostname));
- strncpy(kdh->versionstring, version, sizeof(kdh->versionstring));
- if (panicstr != NULL)
- strncpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring));
- kdh->parity = kerneldump_parity(kdh);
-}
-
#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8)
static int
@@ -284,7 +263,7 @@ minidumpsys(struct dumperinfo *di)
mdhdr.dmapbase = DMAP_MIN_ADDRESS;
mdhdr.dmapend = DMAP_MAX_ADDRESS;
- mkdumpheader(&kdh, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
+ mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize, di->blocksize);
printf("Physical memory: %ju MB\n", ptoa((uintmax_t)physmem) / 1048576);
printf("Dumping %llu MB:", (long long)dumpsize >> 20);