PERFORCE change 78820 for review
Peter Wemm
peter at FreeBSD.org
Wed Jun 22 18:48:23 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=78820
Change 78820 by peter at peter_overcee on 2005/06/22 18:48:16
Build the dump_avail[] list once only, in case that is somehow
messing things up. Eliminate some PAGE_SHIFT abuse while here on
ps's suggestion.
Affected files ...
.. //depot/projects/hammer/sys/amd64/amd64/dump_machdep.c#14 edit
Differences ...
==== //depot/projects/hammer/sys/amd64/amd64/dump_machdep.c#14 (text+ko) ====
@@ -66,17 +66,18 @@
/* 20 phys_avail entry pairs correspond to 10 md_pa's */
static struct md_pa dump_avail[10];
-static struct md_pa *
-md_pa_first(void)
+static void
+md_pa_init(void)
{
- int n;
+ int n, idx;
bzero(&dump_avail, sizeof(dump_avail));
for (n = 0; n < sizeof(dump_avail) / sizeof(dump_avail[0]); n++) {
- if (phys_avail[n * 2] == 0 && phys_avail[n * 2 + 1] == 0)
+ idx = n * 2;
+ if (phys_avail[idx] == 0 && phys_avail[idx + 1] == 0)
break;
- dump_avail[n].md_start = phys_avail[n * 2];
- dump_avail[n].md_size = phys_avail[n * 2 + 1] - phys_avail[n * 2];
+ dump_avail[n].md_start = phys_avail[idx];
+ dump_avail[n].md_size = phys_avail[idx + 1] - phys_avail[idx];
if (dump_avail[n].md_start == kernphys[1]) {
dump_avail[n].md_start = kernphys[0];
dump_avail[n].md_size += kernphys[1] - kernphys[0];
@@ -86,6 +87,11 @@
dump_avail[n].md_size += PAGE_SIZE;
}
}
+}
+
+static struct md_pa *
+md_pa_first(void)
+{
return (&dump_avail[0]);
}
@@ -167,7 +173,7 @@
vm_paddr_t a, pa;
void *va;
uint64_t pgs;
- size_t counter, sz;
+ size_t counter, sz, chunk;
int i, c, error, twiddle;
error = 0; /* catch case in which chunk size is 0 */
@@ -180,22 +186,24 @@
printf(" chunk %d: %ld pages ", seqnr, (long)pgs);
while (pgs) {
- sz = (pgs > MAXDUMPPGS) ?
- MAXDUMPPGS << PAGE_SHIFT : pgs << PAGE_SHIFT;
+ chunk = pgs;
+ if (chunk > MAXDUMPPGS)
+ chunk = MAXDUMPPGS;
+ sz = chunk << PAGE_SHIFT;
counter += sz;
if (counter >> 24) {
printf("%c\b", "|/-\\"[twiddle++ & 3]);
counter &= (1<<24) - 1;
}
- for (i = 0; i < sz >> PAGE_SHIFT; i++) {
+ for (i = 0; i < chunk; i++) {
a = pa + i * PAGE_SIZE;
va = pmap_kenter_temporary(trunc_page(a), i);
}
- error = di->dumper(di->priv, (void*)va, 0, dumplo, sz);
+ error = di->dumper(di->priv, va, 0, dumplo, sz);
if (error)
break;
dumplo += sz;
- pgs -= sz >> PAGE_SHIFT;
+ pgs -= chunk;
pa += sz;
/* Check for user abort. */
@@ -289,6 +297,8 @@
ehdr.e_phentsize = sizeof(Elf64_Phdr);
ehdr.e_shentsize = sizeof(Elf64_Shdr);
+ md_pa_init();
+
/* Calculate dump size. */
dumpsize = 0L;
ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize);
More information about the p4-projects
mailing list