| 1396 | } |
| 1397 | |
| 1398 | static void |
| 1399 | log_illegal_instruction(const char *msg, struct trapframe *frame) |
| 1400 | { |
| 1401 | pt_entry_t *ptep; |
| 1402 | pd_entry_t *pdep; |
| 1403 | unsigned int *addr, instr[4]; |
| 1404 | struct thread *td; |
| 1405 | struct proc *p; |
| 1406 | register_t pc; |
| 1407 | |
| 1408 | td = curthread; |
| 1409 | p = td->td_proc; |
| 1410 | |
| 1411 | #ifdef SMP |
| 1412 | printf("cpuid = %d\n", PCPU_GET(cpuid)); |
| 1413 | #endif |
| 1414 | pc = frame->pc + (DELAYBRANCH(frame->cause) ? 4 : 0); |
| 1415 | log(LOG_ERR, "%s: pid %d tid %ld (%s), uid %d: pc %#jx ra %#jx\n", |
| 1416 | msg, p->p_pid, (long)td->td_tid, p->p_comm, |
| 1417 | p->p_ucred ? p->p_ucred->cr_uid : -1, |
| 1418 | (intmax_t)pc, |
| 1419 | (intmax_t)frame->ra); |
| 1420 | |
| 1421 | /* log registers in trap frame */ |
| 1422 | log_frame_dump(frame); |
| 1423 | |
| 1424 | get_mapping_info((vm_offset_t)pc, &pdep, &ptep); |
| 1425 | |
| 1426 | /* |
| 1427 | * Dump a few words around faulting instruction, if the addres is |
| 1428 | * valid. |
| 1429 | */ |
| 1430 | addr = (unsigned int *)(intptr_t)pc; |
| 1431 | if ((pc & 3) == 0 && copyin(addr, instr, sizeof(instr)) == 0) { |
| 1432 | /* dump page table entry for faulting instruction */ |
| 1433 | log(LOG_ERR, "Page table info for pc address %#jx: pde = %p, pte = %#jx\n", |
| 1434 | (intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0)); |
| 1435 | |
| 1436 | log(LOG_ERR, "Dumping 4 words starting at pc address %p: \n", |
| 1437 | addr); |
| 1438 | log(LOG_ERR, "%08x %08x %08x %08x\n", |
| 1439 | instr[0], instr[1], instr[2], instr[3]); |
| 1440 | } else { |
| 1441 | log(LOG_ERR, "pc address %#jx is inaccessible, pde = %p, pte = %#jx\n", |
| 1442 | (intmax_t)pc, (void *)(intptr_t)*pdep, (uintmax_t)(ptep ? *ptep : 0)); |
| 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | static void |
| 1447 | log_bad_page_fault(char *msg, struct trapframe *frame, int trap_type) |
no test coverage detected