0

I loaded a program using Code Composer Studio 3.3, and through the diassembly window we can see something like this:

00000C5C  00000000            NOP 
00000C60  DD7ABCD2            .word         0xdd7abcd2       

The first column means PC, the second column means the 32-bit data in the corresponding memory, and the last column means the instruction if CCS3.3 think so.

Apparent in the second line, CCS3.3 don't think this is an instruction.But it can be translated to a correct instruction, so I am wondering how does CCS3.3 decide whether to translate the 32-bit data into an instruction or not? Thank you.

boz
  • 4,891
  • 5
  • 41
  • 68
  • 1
    I suppose it doesn't think it is a valid instruction. Double check your disassembling, and also see if you need to specify your CPU to CCS3 ... maybe it is valid for some chips, but not for others. – Jester May 12 '15 at 14:33
  • in general it is difficult at best to completely know instructions from data, there is no foolproof way to know (Even simulating or executing is not foolproof). – old_timer May 12 '15 at 14:35
  • Some disassembler's, mostly older ones, support input scripts to define which areas are code and which areas are data. They also generate labels for branch and/or call targets. The intent of these disassemblers is to produce actual source code that can be assembled to reproduce the program, and also source code that can be updated as needed. – rcgldr May 13 '15 at 02:30

1 Answers1

0

Every value is a instruction and a variable. Values that are used as variables could theoretically also be used as instructions (however this makes rarely no sense and when it's done wrong, it would cause an exception).

  • A way to find out, which value is used as an instruction, is emulation. Places, which can be reached while running the program, are instructions.
  • Another way to find out, is to analyze, which sections are writeable and readable and which are executable (but there are also sections which are both). But if a section is not executeable, this isn't sure, that this values won't ever be used as code, because the program (or an included DLL) could copy that values to an executeable section and jump there.
  • A third way, is to analyze which values would cause an exception (due to invalid opcodes, for example). But that isn't always clear, because that values could also be used as variables.
Van Uitkon
  • 356
  • 1
  • 6