This exercise involves writing an ARM disassembler. That is, a program that can take an ARM instruction and decode it back to its mnemonic. For instance, you may be given the integer values 0xEF000002, 0xE35500FF, or 0xD282102A and your program should decode these back to
SWI 2, CMP R5, #255, and ADDLE R1, R2, #42 respectively. For those doing G51CSA, this is similar to what you have done by hand in coursework two. For those who are not doing G51CSA, or would like a refresher then there are some recommended reading in the resource section.
In addition, this program should be a full ‘disassembler’ in that it takes an ELF (Executable and Linking Format) executable and decodes all the instructions in the program. ELF is a binary file format that contains both the ARM instructions, and a series of headers that specify where to load these in.
Finally, rather than getting you to write the program ab initio, we are providing a skeleton file containing most of the code required to process an ELF executable binary, although you will need to make some modifications to this (as described in section 4). You are to add your code to this skeleton to make it print out the ARM mnemonics for each instruction as well as the hex value.
There are two main tasks for this coursework:
• Implement the decoding of ARM instructions
• Modify the ELF loader so it processes all program headers rather than just the first.