| 584 | } |
| 585 | |
| 586 | void KMemory::logPageFault(KThread* thread, U32 address) { |
| 587 | U32 start = 0; |
| 588 | CPU* cpu = thread->cpu; |
| 589 | |
| 590 | BString name = process->getModuleName(cpu->seg[CS].address + cpu->eip.u32); |
| 591 | klog_fmt("%.8X EAX=%.8X ECX=%.8X EDX=%.8X EBX=%.8X ESP=%.8X EBP=%.8X ESI=%.8X EDI=%.8X %s at %.8X", cpu->seg[CS].address + cpu->eip.u32, cpu->reg[0].u32, cpu->reg[1].u32, cpu->reg[2].u32, cpu->reg[3].u32, cpu->reg[4].u32, cpu->reg[5].u32, cpu->reg[6].u32, cpu->reg[7].u32, name.c_str(), process->getModuleEip(cpu->seg[CS].address + cpu->eip.u32)); |
| 592 | |
| 593 | klog_fmt("Page Fault at %.8X", address); |
| 594 | klog("Valid address ranges:"); |
| 595 | for (U32 i = 0; i < K_NUMBER_OF_PAGES; i++) { |
| 596 | if (!start) { |
| 597 | if (data->isPageValid(i)) { |
| 598 | start = i; |
| 599 | } |
| 600 | } else { |
| 601 | if (!data->isPageValid(i)) { |
| 602 | klog_fmt(" %.8X - %.8X", start * K_PAGE_SIZE, i * K_PAGE_SIZE); |
| 603 | start = 0; |
| 604 | } |
| 605 | } |
| 606 | } |
| 607 | klog("Mapped Files:"); |
| 608 | process->printMappedFiles(); |
| 609 | cpu->walkStack(cpu->eip.u32, EBP, 2); |
| 610 | kpanic("pf"); |
| 611 | } |
| 612 | |
| 613 | void KMemory::performOnMemory(U32 address, U32 len, bool readOnly, std::function<bool(U8* ram, U32 len)> callback) { |
| 614 | if (!len) { |
no test coverage detected