• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System PortalPlayer-based
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by ahellmann - 2007-05-17
Last edited by barrywardell - 2007-08-01

FS#7182 - ARM Disassembler

First approach of a simple ARM disassembler.
Compared to the gnu objdump it has following enhancements:
- shows 'const' data in the disassembly
- shows calculated 'const' data (i.e. mov rx, #v1 followed by sub/add rx, rx, #v2)
- skips disassembly of accessed 'const' data
Currently thumb disassembly is not supported. The binary input must not exceed 8MB.

Closed by  barrywardell
2007-08-01 22:28
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Committed to SVN

I've been trying to compile this under Linux, but am getting odd behaviour.

The offsets for branches (and other instructions) are being decoded wrongly. e.g. when running the supplied win32 .exe, I would get "b 0x20" in the output, but with my version compiled for Linux (32-bit x86) I get "b 0xa800020".

I'm attaching my modified version of your code, which includes a Makefile. Can anyone get this working? My attempts at debugging have failed.

The only changes I made to the two .c files were the following:

diff -r ORIG/disasm_arm.c new/disasm_arm.c
> #include <stdint.h>
< off = (ULONG)1)) | 2);

off = (ULONG)3)) | 4);
diff -r ORIG/main.c new/main.c
< void main(int argc, char argv)
— > int main(int argc, char
< printf(" disassembles input file to 'disasm.txt'");

printf(" disassembles input file to 'disasm.txt'\\n");
< }

No newline at end of file

1) unsigned __int64)(val&0xff) « (32 - 2 * ((val » 8) & 15
2) , 4) val&0xff) » 2 * ((val » 8) & 15
3) uint64_t)(val&0xff) « (32 - 2 * ((val » 8) & 15

I've found the problems, and attach an updated version of this disassembler which compiles cleanly (no warnings with -Wall) on Linux x86. It produces identical output (on my single test file…) to the Windows binary included in the original patch.

Toni - what are your plans for this disassembler? I think it could be nice if it was added to Rockbox SVN - maybe in something like a "utils" directory at the same level as apps, tools, firmware etc could be created for tools like this - and we can keep "tools" for tools required to build/install Rockbox.

I came across an endianness problem when I tried using this on my PPC Mac. Attached is an updated version that now works well on my Mac. The only change is in ensuring to convert from little endian to host format when reading in the data.

I agree that it would be great to see this in SVN. Do you plan on working on it further?

And another endianness problem, this time when the const data was being read. Fixed version attached.


Available keyboard shortcuts


Task Details

Task Editing