diff -r 8b06129b51ca contrib/qemu/eos/dbi/logging.c --- a/contrib/qemu/eos/dbi/logging.c +++ b/contrib/qemu/eos/dbi/logging.c @@ -45,6 +45,21 @@ return name; } +static int is_ml_addr(uint32_t pc) +{ + return pc >= 0xC80000 && pc <= 0xCF0340; +} + +static int should_log_call(uint32_t prev_pc, uint32_t pc) +{ + return is_ml_addr(prev_pc) && !is_ml_addr(pc); +} + +static int should_log_ret(uint32_t prev_pc, uint32_t pc) +{ + return !is_ml_addr(prev_pc) && is_ml_addr(pc); +} + /* whether the addresses from this memory region should be analyzed (by any logging tools) */ static inline int should_log_memory_region(MemoryRegion * mr, int is_write) { @@ -877,7 +892,7 @@ call_stacks[id][level].num_args = MAX(arg_num, call_stacks[id][level].num_args); - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && 0) { uint32_t pc = CURRENT_CPU->env.regs[15]; uint32_t lr = CURRENT_CPU->env.regs[14]; int len = eos_callstack_indent(s); @@ -897,7 +912,7 @@ } } - if (is_write && qemu_loglevel_mask(EOS_LOG_CALLS)) + if (is_write && qemu_loglevel_mask(EOS_LOG_CALLS) && 0) { uint8_t id = get_stackid(s); int call_depth = call_stack_num[id]; @@ -1044,7 +1059,7 @@ interrupt_level++; uint8_t id = get_stackid(s); assert(id == 0xFE); - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && 0) { int len = call_stack_indent(id, 0, 0); len += fprintf(stderr, KCYN"interrupt %02Xh"KRESET, s->irq_id); len -= strlen(KCYN KRESET); @@ -1101,7 +1116,8 @@ call_stack_num[id] = k; - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && should_log_ret(prev_pc, pc)) + { int len = call_stack_indent(id, 0, 0); len += fprintf(stderr, "return %x to 0x%X", env->regs[0], pc | env->thumb); len += eos_indent(len, CALLSTACK_RIGHT_ALIGN); @@ -1150,7 +1166,8 @@ uint8_t id = get_stackid(s); - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && should_log_call(prev_pc, pc)) + { const char * name = eos_lookup_symbol(pc); int len = call_stack_indent(id, 0, 0); len += fprintf(stderr, "%scall 0x%X", tail_call ? "tail " : "", pc | env->thumb); @@ -1375,7 +1392,7 @@ assert(interrupt_level == 0); } - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && 0) { int len = call_stack_indent(id, 0, 0); len += fprintf(stderr, KCYN"return from interrupt"KRESET" to %x", pc); if (pc != old_pc && pc != old_pc + 4) len += fprintf(stderr, " (old=%x)", old_pc); @@ -1439,13 +1456,14 @@ { /* many DIGIC 6 functions have wrappers that simply jump to another function */ /* don't be too verbose on these, but also make sure it's really just a simple jump */ - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && should_log_call(prev_pc, pc)) { int len = call_stack_indent(id, 0, 0); len += fprintf(stderr, "-> 0x%X", pc | env->thumb); const char * name = eos_lookup_symbol(pc); if (name && name[0]) { len += fprintf(stderr, " %s", name); } + len += print_args(env->regs); len += eos_indent(len, CALLSTACK_RIGHT_ALIGN); /* print LR from the call stack, so it will always show the caller */ @@ -1539,7 +1557,7 @@ } /* unknown jump case, to be diagnosed manually */ - if (qemu_loglevel_mask(EOS_LOG_CALLS)) { + if (qemu_loglevel_mask(EOS_LOG_CALLS) && 0) { static uint32_t prev_jump = 0; if (pc != prev_jump) {