next up previous contents
Next: The unelf utility Up: Implementation of predecode and Previous: Implementation of predecode and

The predecode utility

Source files: src/predecode/predecode.cc, src/predecode/predecode_instr.cc, src/predecode/predecode_table.cc,

Header files: incl/Processor/instruction.h, incl/Processor/table.h, incl/Processor/decoding.h, incl/Processor/archregnums.h

This utility converts application executable files from the SPARC format to a format understood by RSIM. The main() function starts by looping through the ELF sections of the executable looking for instruction sections. Once a text section is found, the start_decode function is called on every SPARC instruction in the region.

The start_decode function begins by calling either branch_instr, call_instr, arith_instr, or mem_instr, based on the first two-bits of the instruction type. call_instr directly interprets the CALL instruction specified and returns. The other functions mentioned begin by dispatching the instruction to another function, based on up to 6 opcode bits. This dispatch is done through a table set in the function TableSetup, which corresponds to the instruction mapping specified in the SPARC V9 architecture [23]. In some cases, multiple dispatch functions may need to be invoked. Finally, however, the functions given in predecode_instr.cc convert from the SPARC instruction with tightly-encoded fields to the more loosely-encoded RSIM instruction format (specified in the instr data structure). The opcode and the way in which it defines its fields determines the final encoding used.

More information about the opcodes supported and their fields can be found in the SPARC V9 Architecture Reference Manual [23].



Vijay Sadananda Pai
Thu Aug 7 14:18:56 CDT 1997