Commit a1eb7cc8 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: various fixes regarding Thumb disassembly

Quirk: if CPU is in ARM mode, the disassembler looks at the Thumb bit of the requested address.
If CPU is in Thumb mode, the disassembler ignores the Thumb bit from the address, and always disassembles as Thumb.
This inconsistency is also present in latest QEMU from git. Why?

IDC scripts: comments containing disassembled Thumb code were updated (DIGIC 6/7/8 and 1300D).

--HG--
branch : qemu
parent ae4c89791395
......@@ -323,8 +323,11 @@ static void eos_idc_log_call(EOSState *s, CPUState *cpu, CPUARMState *env,
assert(stderr_dup);
fflush(stderr); fflush(idc);
dup2(fileno(idc), fileno(stderr));
/* target_disas now looks at the Thumb bit, but only if env->thumb is 0, why? */
int t0 = env->thumb; env->thumb = 0;
fprintf(stderr, " /* from "); log_target_disas(cpu, prev_pc, prev_size, 0);
fprintf(stderr, " * -> "); log_target_disas(cpu, tb->pc, tb->size, 0);
fprintf(stderr, " * -> "); log_target_disas(cpu, tb->pc | t0, tb->size, 0);
env->thumb = t0;
const char * task_name = eos_get_current_task_name(s);
fprintf(stderr, " * %s%sPC:%x->%x LR:%x->%x SP:%x */\n",
task_name ? task_name : "", task_name ? " " : "",
......@@ -1882,10 +1885,10 @@ check_insn:
len += eos_indent(len, CALLSTACK_RIGHT_ALIGN);
print_call_location(s, prev_pc, prev_lr);
call_stack_indent(id, 0, 0);
/* hm, target_disas used to look at flags for ARM or Thumb... */
int t0 = env->thumb; env->thumb = prev_pc & 1;
/* target_disas now looks at the Thumb bit, but only if env->thumb is 0, why? */
int t0 = env->thumb; env->thumb = 0;
assert(prev_size);
target_disas(stderr, CPU(arm_env_get_cpu(env)), prev_pc0, prev_size, 0);
target_disas(stderr, CPU(arm_env_get_cpu(env)), prev_pc, prev_size, 0);
env->thumb = t0;
}
}
......
......@@ -57,8 +57,11 @@ unsigned int eos_handle_ml_helpers ( unsigned int parm, EOSState *s, unsigned in
uint32_t bits = eos_get_mem_h(s, value & ~1) >> 11;
size = (bits == 0b11101 || bits == 0b11110 || bits == 0b11111) ? 4 : 2;
}
/* target_disas now looks at the Thumb bit, but only if env->thumb is 0, why? */
int t0 = s->cpu0->env.thumb; s->cpu0->env.thumb = 0;
target_disas(stderr, CPU(arm_env_get_cpu(&s->cpu0->env)), value, size, 0);
fprintf(stderr, KRESET);
s->cpu0->env.thumb = t0;
return 0;
}
}
......
8f26fa0209a6fbcd7c151fd5940480bc calls-main.log
09efd77939ee2593ee25130f1da11fb1 calls-main.idc
4ce9333a20d75e9384d32b657c7bf06f calls-main.idc
57478c9c14217ef8ff17c87ec9474ed7 calls-main-basic.log
4a6ef02a69a39aecae65789c8b7c771f calls-main-basic.idc
386db8272141da25b7218e5e513d0718 calls-main.log
656362cdb566fc62b583985a2f76387d calls-main.idc
a69aa99980ff0c20b22ed155d322dc32 calls-main.idc
eb2b848b0e8cf83b377448d5cb29ba55 calls-main-basic.log
1feea5839d655ec93ef72e2b02cd9a26 calls-main-basic.idc
642e2ad742da7cdb6340b2c8d344b816 calls-main.log
316e615a7bed3788b540fe70ad86c5af calls-main.idc
6d6efcb7f3234fcf338de547fd304f58 calls-main.idc
a96ccf25237a6b2b0b3f9129e1ce2d7b calls-main-basic.log
1aacee8d0b8b83f838a2b35a7f7fd3ad calls-main-basic.idc
ea0d2f5063c0aad1e2cd492042c14531 calls-main.log
570e66dbf03a556b32564ec72d053a48 calls-main.idc
6c1c15c1e57c1aa08a9569a7744f05e9 calls-main.idc
1036ea285cb96febb885c365eaa3eb32 calls-main-basic.log
222e6960c42fa888871e00fc27cdd2b7 calls-main-basic.idc
bce86759656d17b8d657ef55406734c9 calls-main.log
f167da05be089c2f783adb6ceeacd548 calls-main.idc
c2c054d63427b1596e15df791fd30fe1 calls-main.idc
fcfa8c37435a70c883663729a22a3f4e calls-main-basic.log
8daee3f1079934a0ca7897c2d66b1554 calls-main-basic.idc
1b6705fbbade17575ee71a0754bf4af4 calls-main.log
87eb975fe530a4eeb436ea95e2719a32 calls-main.idc
8bb528131c1c4e656dd464c6c7635866 calls-main.idc
ea20d42c1c5e61f2f9b8ed932da1ad36 calls-main-basic.log
3bc141c31f6af678b90bdf6d6fcdb994 calls-main-basic.idc
1d15189e939ddd47d26a663fe74fc1c0 calls-main.log
99c16212731dca901d6ea1ffe95d822d calls-main.idc
f98fe722cfd7eaf0f3549362b24a7304 calls-main.idc
52c866bc78e2cdbeb12c7c1861700d39 calls-main-basic.log
cc8845fa31870a400836df9483090d9a calls-main-basic.idc
7fb444a2d78b02b87fed3596557878c3 calls-main.log
16d48c8bf4e1ac7d97c51fa345ad09c4 calls-main.idc
44c3568fe1705e2f25e20812a3ba3742 calls-main.idc
fdcf6ca504d0f404f6dd9567365b0b4b calls-main-basic.log
0b3638d0ad622e9f0da942cc1ac47dbd calls-main-basic.idc
d3085ec0c6dcb4057343996352a3c859 calls-main.idc
00e31ca98ca960792d9947c15dd68891 calls-main.idc
d0b31ceed138eb774ab0893069a9f4f1 calls-main-basic.log
1ec1769c8f9f770a81ac3630489f1d34 calls-main-basic.idc
a2da497427ea579685dc09b11c3cfdc9 calls-main.log
dc8d89dcc337a6c95616a2dfe714ee71 calls-main.idc
836ea9c9a84190a1bf05f691ac1eecd4 calls-main.idc
68ff0eae9c0eefc1742964a214858eaa calls-main-basic.log
e18550b14074b05faa64fc00e1febe85 calls-main-basic.idc
22eda72a13f8f8fa937b023dad57cca2 calls-main.log
2102981ce2a6c0bb194ba9aaac864df6 calls-main.idc
bd04e2e965968eea81161342bd66e4bd calls-main.idc
ff2942b8af81731e566654f93c13edb8 calls-main-basic.log
71ed0135a7364a38867040a00d5749f6 calls-main-basic.idc
2bf410a5e7c5d1da7f054868a6180968 calls-main.idc
9d56a3abff56924cb4e549948b9f6f6d calls-main.idc
1a87eeeca1622fe08ef34df34078b97c calls-main-basic.log
d10caf116e5bbb1630893a94c6e245e5 calls-main-basic.idc
3fe82128a424f713574fa9937f568ae3 calls-main.log
2584f8681f3c7e8f4ffb4b103ec16dbd calls-main.idc
804dd0da5fe2f7d90aa56f52f0bd51f5 calls-main.idc
036cd3f6a8ca2db73a370992522175e6 calls-main-basic.log
4259fc145af1aabde4bb9f9e215fe45c calls-main-basic.idc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment