The simple script in the last section can be extended in several
directions:
- load-file simply writes the contents of a file
directly to memory. There are at least two other options:
- Using set to write values directly to memory. This
is useful if the test program is only a few instructions
long.
- Using load-binary to load an executable
in one of the formats Simics recognizes, such as ELF.
Unlike load-file, this command automatically loads the
executable at the right address, and returns the entry point
address.
- You can have more complicated stop conditions than simply "run
twelve instructions"; for example, you can use execution or data
breakpoints (section 11.1.1), control register
breakpoints (section 11.1.3), device I/O
breakpoints (section 11.1.4), or magic instruction
breakpoints (section 11.1.7).
- Various conditions cause Simics to trigger
haps; for example breakpoints, privilege level
changes, magic instructions, and traps. You can easily write a small
hap callback function that is called whenever this happens; such a
callback could terminate the simulation (indicating success or
failure), or simply log or change some value.