MFi386: revision 1.615 (change kernel crashdump format to ELF).
Approved by: re (scottl)
This commit is contained in:
parent
9149713184
commit
b2cdc9829c
@ -191,9 +191,11 @@ long Maxmem = 0;
|
||||
long realmem = 0;
|
||||
|
||||
vm_paddr_t phys_avail[10];
|
||||
vm_paddr_t dump_avail[10];
|
||||
|
||||
/* must be 2 less so 0 0 can signal end of chunks */
|
||||
#define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2)
|
||||
#define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(phys_avail[0])) - 2)
|
||||
#define DUMP_AVAIL_ARRAY_END ((sizeof(dump_avail) / sizeof(dump_avail[0])) - 2)
|
||||
|
||||
struct kva_md_info kmi;
|
||||
|
||||
@ -1617,13 +1619,16 @@ sdtossd(sd, ssd)
|
||||
static void
|
||||
getmemsize(int first)
|
||||
{
|
||||
int i, physmap_idx, pa_indx, pg_n;
|
||||
int i, physmap_idx, pa_indx, da_indx;
|
||||
int pg_n;
|
||||
u_long physmem_tunable;
|
||||
u_int extmem, under16;
|
||||
vm_offset_t pa, physmap[PHYSMAP_SIZE];
|
||||
vm_paddr_t pa, physmap[PHYSMAP_SIZE];
|
||||
pt_entry_t *pte;
|
||||
quad_t dcons_addr, dcons_size;
|
||||
|
||||
bzero(physmap, sizeof(physmap));
|
||||
|
||||
/* XXX - some of EPSON machines can't use PG_N */
|
||||
pg_n = PG_N;
|
||||
if (pc98_machine_type & M_EPSON_PC98) {
|
||||
@ -1638,7 +1643,6 @@ getmemsize(int first)
|
||||
break;
|
||||
}
|
||||
}
|
||||
bzero(physmap, sizeof(physmap));
|
||||
|
||||
/*
|
||||
* Perform "base memory" related probes & setup
|
||||
@ -1745,8 +1749,10 @@ getmemsize(int first)
|
||||
*/
|
||||
physmap[0] = PAGE_SIZE; /* mask off page 0 */
|
||||
pa_indx = 0;
|
||||
da_indx = 1;
|
||||
phys_avail[pa_indx++] = physmap[0];
|
||||
phys_avail[pa_indx] = physmap[0];
|
||||
dump_avail[da_indx] = physmap[0];
|
||||
pte = CMAP1;
|
||||
|
||||
/*
|
||||
@ -1767,14 +1773,15 @@ getmemsize(int first)
|
||||
if (physmap[i + 1] < end)
|
||||
end = trunc_page(physmap[i + 1]);
|
||||
for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) {
|
||||
int tmp, page_bad;
|
||||
int tmp, page_bad, full;
|
||||
int *ptr = (int *)CADDR1;
|
||||
|
||||
full = FALSE;
|
||||
/*
|
||||
* block out kernel memory as not available.
|
||||
*/
|
||||
if (pa >= KERNLOAD && pa < first)
|
||||
continue;
|
||||
goto do_dump_avail;
|
||||
|
||||
/*
|
||||
* block out dcons buffer
|
||||
@ -1782,7 +1789,7 @@ getmemsize(int first)
|
||||
if (dcons_addr > 0
|
||||
&& pa >= trunc_page(dcons_addr)
|
||||
&& pa < dcons_addr + dcons_size)
|
||||
continue;
|
||||
goto do_dump_avail;
|
||||
|
||||
page_bad = FALSE;
|
||||
|
||||
@ -1797,30 +1804,26 @@ getmemsize(int first)
|
||||
* Test for alternating 1's and 0's
|
||||
*/
|
||||
*(volatile int *)ptr = 0xaaaaaaaa;
|
||||
if (*(volatile int *)ptr != 0xaaaaaaaa) {
|
||||
if (*(volatile int *)ptr != 0xaaaaaaaa)
|
||||
page_bad = TRUE;
|
||||
}
|
||||
/*
|
||||
* Test for alternating 0's and 1's
|
||||
*/
|
||||
*(volatile int *)ptr = 0x55555555;
|
||||
if (*(volatile int *)ptr != 0x55555555) {
|
||||
page_bad = TRUE;
|
||||
}
|
||||
if (*(volatile int *)ptr != 0x55555555)
|
||||
page_bad = TRUE;
|
||||
/*
|
||||
* Test for all 1's
|
||||
*/
|
||||
*(volatile int *)ptr = 0xffffffff;
|
||||
if (*(volatile int *)ptr != 0xffffffff) {
|
||||
if (*(volatile int *)ptr != 0xffffffff)
|
||||
page_bad = TRUE;
|
||||
}
|
||||
/*
|
||||
* Test for all 0's
|
||||
*/
|
||||
*(volatile int *)ptr = 0x0;
|
||||
if (*(volatile int *)ptr != 0x0) {
|
||||
if (*(volatile int *)ptr != 0x0)
|
||||
page_bad = TRUE;
|
||||
}
|
||||
/*
|
||||
* Restore original value.
|
||||
*/
|
||||
@ -1829,9 +1832,8 @@ getmemsize(int first)
|
||||
/*
|
||||
* Adjust array of valid/good pages.
|
||||
*/
|
||||
if (page_bad == TRUE) {
|
||||
if (page_bad == TRUE)
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* If this good page is a continuation of the
|
||||
* previous set of good pages, then just increase
|
||||
@ -1851,12 +1853,28 @@ getmemsize(int first)
|
||||
printf(
|
||||
"Too many holes in the physical address space, giving up\n");
|
||||
pa_indx--;
|
||||
break;
|
||||
full = TRUE;
|
||||
goto do_dump_avail;
|
||||
}
|
||||
phys_avail[pa_indx++] = pa; /* start */
|
||||
phys_avail[pa_indx] = pa + PAGE_SIZE; /* end */
|
||||
phys_avail[pa_indx] = pa + PAGE_SIZE; /* end */
|
||||
}
|
||||
physmem++;
|
||||
do_dump_avail:
|
||||
if (dump_avail[da_indx] == pa) {
|
||||
dump_avail[da_indx] += PAGE_SIZE;
|
||||
} else {
|
||||
da_indx++;
|
||||
if (da_indx == DUMP_AVAIL_ARRAY_END) {
|
||||
da_indx--;
|
||||
goto do_next;
|
||||
}
|
||||
dump_avail[da_indx++] = pa; /* start */
|
||||
dump_avail[da_indx] = pa + PAGE_SIZE; /* end */
|
||||
}
|
||||
do_next:
|
||||
if (full)
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pte = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user