Revision b769d8fe target-ppc/helper.c
b/target-ppc/helper.c | ||
---|---|---|
432 | 432 |
generated code */ |
433 | 433 |
saved_env = env; |
434 | 434 |
env = cpu_single_env; |
435 |
#if 0 |
|
435 | 436 |
{ |
436 | 437 |
unsigned long tlb_addrr, tlb_addrw; |
437 | 438 |
int index; |
438 | 439 |
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); |
439 | 440 |
tlb_addrr = env->tlb_read[is_user][index].address; |
440 | 441 |
tlb_addrw = env->tlb_write[is_user][index].address; |
441 |
#if 0 |
|
442 | 442 |
if (loglevel) { |
443 | 443 |
fprintf(logfile, |
444 | 444 |
"%s 1 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx " |
... | ... | |
447 | 447 |
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK, |
448 | 448 |
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)); |
449 | 449 |
} |
450 |
#endif |
|
451 | 450 |
} |
451 |
#endif |
|
452 | 452 |
ret = cpu_ppc_handle_mmu_fault(env, addr, is_write, is_user, 1); |
453 | 453 |
if (ret) { |
454 | 454 |
if (retaddr) { |
... | ... | |
463 | 463 |
} |
464 | 464 |
do_raise_exception_err(env->exception_index, env->error_code); |
465 | 465 |
} |
466 |
#if 0 |
|
466 | 467 |
{ |
467 | 468 |
unsigned long tlb_addrr, tlb_addrw; |
468 | 469 |
int index; |
469 | 470 |
index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); |
470 | 471 |
tlb_addrr = env->tlb_read[is_user][index].address; |
471 | 472 |
tlb_addrw = env->tlb_write[is_user][index].address; |
472 |
#if 0 |
|
473 | 473 |
printf("%s 2 %p %p idx=%d addr=0x%08lx tbl_addr=0x%08lx 0x%08lx " |
474 | 474 |
"(0x%08lx 0x%08lx)\n", __func__, env, |
475 | 475 |
&env->tlb_read[is_user][index], index, addr, |
476 | 476 |
tlb_addrr, tlb_addrw, addr & TARGET_PAGE_MASK, |
477 | 477 |
tlb_addrr & (TARGET_PAGE_MASK | TLB_INVALID_MASK)); |
478 |
#endif |
|
479 | 478 |
} |
479 |
#endif |
|
480 | 480 |
env = saved_env; |
481 | 481 |
} |
482 | 482 |
|
... | ... | |
496 | 496 |
int access_type; |
497 | 497 |
int ret = 0; |
498 | 498 |
|
499 |
// printf("%s 0\n", __func__); |
|
500 |
access_type = env->access_type; |
|
499 |
if (rw == 2) { |
|
500 |
/* code access */ |
|
501 |
rw = 0; |
|
502 |
access_type = ACCESS_CODE; |
|
503 |
} else { |
|
504 |
/* data access */ |
|
505 |
/* XXX: put correct access by using cpu_restore_state() |
|
506 |
correctly */ |
|
507 |
access_type = ACCESS_INT; |
|
508 |
// access_type = env->access_type; |
|
509 |
} |
|
501 | 510 |
if (env->user_mode_only) { |
502 | 511 |
/* user mode only emulation */ |
503 | 512 |
ret = -2; |
504 | 513 |
goto do_fault; |
505 | 514 |
} |
506 |
/* NASTY BUG workaround */ |
|
507 |
if (access_type == ACCESS_CODE && rw) { |
|
508 |
printf("%s: ERROR WRITE CODE ACCESS\n", __func__); |
|
509 |
access_type = ACCESS_INT; |
|
510 |
} |
|
511 | 515 |
ret = get_physical_address(env, &physical, &prot, |
512 | 516 |
address, rw, access_type); |
513 | 517 |
if (ret == 0) { |
... | ... | |
590 | 594 |
env->error_code = error_code; |
591 | 595 |
ret = 1; |
592 | 596 |
} |
593 |
|
|
594 | 597 |
return ret; |
595 | 598 |
} |
596 | 599 |
|
... | ... | |
671 | 674 |
if (loglevel > 0) { |
672 | 675 |
fprintf(logfile, "Raise exception at 0x%08x => 0x%08x (%02x)\n", |
673 | 676 |
env->nip, excp << 8, env->error_code); |
674 |
} |
|
677 |
}
|
|
675 | 678 |
if (loglevel > 0) |
676 | 679 |
cpu_ppc_dump_state(env, logfile, 0); |
677 | 680 |
} |
678 | 681 |
#endif |
682 |
if (loglevel & CPU_LOG_INT) { |
|
683 |
fprintf(logfile, "Raise exception at 0x%08x => 0x%08x (%02x)\n", |
|
684 |
env->nip, excp << 8, env->error_code); |
|
685 |
} |
|
679 | 686 |
/* Generate informations in save/restore registers */ |
680 | 687 |
switch (excp) { |
681 | 688 |
case EXCP_OFCALL: |
... | ... | |
824 | 831 |
} |
825 | 832 |
goto store_next; |
826 | 833 |
case EXCP_SYSCALL: |
827 |
#if defined (DEBUG_EXCEPTIONS) |
|
828 |
if (msr_pr) { |
|
829 |
if (loglevel) { |
|
830 |
fprintf(logfile, "syscall %d 0x%08x 0x%08x 0x%08x 0x%08x\n", |
|
831 |
env->gpr[0], env->gpr[3], env->gpr[4], |
|
832 |
env->gpr[5], env->gpr[6]); |
|
833 |
} else { |
|
834 |
printf("syscall %d from 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n", |
|
835 |
env->gpr[0], env->nip, env->gpr[3], env->gpr[4], |
|
836 |
env->gpr[5], env->gpr[6]); |
|
837 |
} |
|
838 |
} |
|
839 |
#endif |
|
834 |
if (loglevel & CPU_LOG_INT) { |
|
835 |
fprintf(logfile, "syscall %d 0x%08x 0x%08x 0x%08x 0x%08x\n", |
|
836 |
env->gpr[0], env->gpr[3], env->gpr[4], |
|
837 |
env->gpr[5], env->gpr[6]); |
|
838 |
if (env->gpr[0] == 4 && env->gpr[3] == 1) { |
|
839 |
int len, addr, i; |
|
840 |
uint8_t c; |
|
841 |
|
|
842 |
fprintf(logfile, "write: "); |
|
843 |
addr = env->gpr[4]; |
|
844 |
len = env->gpr[5]; |
|
845 |
if (len > 64) |
|
846 |
len = 64; |
|
847 |
for(i = 0; i < len; i++) { |
|
848 |
c = 0; |
|
849 |
cpu_memory_rw_debug(env, addr + i, &c, 1, 0); |
|
850 |
if (c < 32 || c > 126) |
|
851 |
c = '.'; |
|
852 |
fprintf(logfile, "%c", c); |
|
853 |
} |
|
854 |
fprintf(logfile, "\n"); |
|
855 |
} |
|
856 |
} |
|
840 | 857 |
goto store_next; |
841 | 858 |
case EXCP_TRACE: |
842 | 859 |
goto store_next; |
Also available in: Unified diff