Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/minidump_machdep.c
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | minidumpsys(struct dumperinfo *di) | ||||
/* Walk page table pages, set bits in vm_page_dump */ | /* Walk page table pages, set bits in vm_page_dump */ | ||||
ptesize = 0; | ptesize = 0; | ||||
for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { | for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { | ||||
/* | /* | ||||
* We always write a page, even if it is zero. Each | * We always write a page, even if it is zero. Each | ||||
* page written corresponds to 2MB of space | * page written corresponds to 2MB of space | ||||
*/ | */ | ||||
ptesize += PAGE_SIZE; | ptesize += PAGE_SIZE; | ||||
pd = (pd_entry_t *)((uintptr_t)IdlePTD + KERNBASE); /* always mapped! */ | pd = IdlePTD; /* always mapped! */ | ||||
j = va >> PDRSHIFT; | j = va >> PDRSHIFT; | ||||
if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { | if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { | ||||
/* This is an entire 2M page. */ | /* This is an entire 2M page. */ | ||||
pa = pd[j] & PG_PS_FRAME; | pa = pd[j] & PG_PS_FRAME; | ||||
for (k = 0; k < NPTEPG; k++) { | for (k = 0; k < NPTEPG; k++) { | ||||
if (is_dumpable(pa)) | if (is_dumpable(pa)) | ||||
dump_add_page(pa); | dump_add_page(pa); | ||||
pa += PAGE_SIZE; | pa += PAGE_SIZE; | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | #endif | ||||
/* Dump bitmap */ | /* Dump bitmap */ | ||||
error = blk_write(di, (char *)vm_page_dump, 0, round_page(vm_page_dump_size)); | error = blk_write(di, (char *)vm_page_dump, 0, round_page(vm_page_dump_size)); | ||||
if (error) | if (error) | ||||
goto fail; | goto fail; | ||||
/* Dump kernel page table pages */ | /* Dump kernel page table pages */ | ||||
for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { | for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) { | ||||
/* We always write a page, even if it is zero */ | /* We always write a page, even if it is zero */ | ||||
pd = (pd_entry_t *)((uintptr_t)IdlePTD + KERNBASE); /* always mapped! */ | pd = IdlePTD; /* always mapped! */ | ||||
j = va >> PDRSHIFT; | j = va >> PDRSHIFT; | ||||
if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { | if ((pd[j] & (PG_PS | PG_V)) == (PG_PS | PG_V)) { | ||||
/* This is a single 2M block. Generate a fake PTP */ | /* This is a single 2M block. Generate a fake PTP */ | ||||
pa = pd[j] & PG_PS_FRAME; | pa = pd[j] & PG_PS_FRAME; | ||||
for (k = 0; k < NPTEPG; k++) { | for (k = 0; k < NPTEPG; k++) { | ||||
fakept[k] = (pa + (k * PAGE_SIZE)) | PG_V | PG_RW | PG_A | PG_M; | fakept[k] = (pa + (k * PAGE_SIZE)) | PG_V | PG_RW | PG_A | PG_M; | ||||
} | } | ||||
error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); | error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE); | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |