Some updates:
- upgraded to QEMU 2.9.0, thanks nkls (still experimental, as I had quite a bit of trouble with it, so it's in a different branch for now)
- fixed another (or maybe the same?) nondeterministic lock-up (see a few posts above)
- initial support for
1300D (WIP)
- options to log memory accesses (aka memory tracing); run with "-d help" to get the list
The lock-up bug was showing up very rarely on 2.5.0 after the timer refactoring from nkls (let's say about 1 out of 100 runs was bad), but after upgrading to 2.9.0 it showed up in more than half of the test runs (or about 1/5 of the test runs if the log was redirected to file). Narrowed down to interrupt controller (from a change made many months ago to support 1000D and other VxWorks models).
I'm also experimenting with logging all memory accesses made by the guest firmware, on 2.5.0. Examples for 1300D:
./run_canon_fw.sh 1300D -d romw
...
Firm Jump RAM to ROM 0xFE0C0000
K404 READY
[rom1] at 0x0001D54C:0001D54C [0xF8000000] <- 0x6 : 8-bit
[rom1] at 0x0001D54C:0001D54C [0xF8000000] <- 0x6 : 8-bit
[rom1] at 0x0001D54C:0001D54C [0xF8000000] <- 0xE9 : 8-bit
[DMA1] Copy [0xF8E60000] -> [0x402D4000], length [0x0026BBF8], flags [0x00030001]
[DMA1] OK
0: 20.480 [STARTUP]
./run_canon_fw.sh 1300D -d ramw,romr
...
[rom1] at 0xFE0C000C:001000EC [0xFEA7A270] -> 0xE92D4010
[ram] at 0xFE0C000C:001000EC [0x00001900] <- 0xE92D4010
[rom1] at 0xFE0C009C:001000EC [0xFEA7A274] -> 0xEB000BAB
[ram] at 0xFE0C009C:001000EC [0x00001904] <- 0xEB000BAB
...
I know
I'm almost certainly reinventing the wheel, but I had only limited success with these modified versions:
- mtrace uses a very very old QEMU
- panda 1.0 uses QEMU 1.0.1, examples work, lots of nice tools, but appears deprecated (shouldn't be hard to roll back our patches to the older version)
- panda 2.0 uses a very recent QEMU, but could not run any ARM examples (segmentation fault). Also, most of the cool tools from panda 1.0 are not ported yet.
- QEMU-DBI is "being upstreamed into QEMU", and a large part of it is already in 2.9.0 (the main reason I've upgraded). TODO: figure out how to use it...
- QEMU-CHERI is a mod for MIPS that also traces memory and instructions (nice to see how it works)
- the last one, QEMU-trace, is a very simple patch that showed me where to place the hooks in the QEMU codebase (also with
this message and
this thread from mailing lists).
So, yeah, I still want to use the state-of-art method for logging memory accesses, just need to figure out how. Until then, my monkey-patched method appears to work pretty well (can rebuild the memory contents from the trace) and has very little overhead as long as I'm not printing each access to the console.