Creating a new Simulator port
Eventually we'll cover more internal frameworks, but for now, just look at an existing port like ft32 as an example.
Before submitting, here's a few guidelines you must adhere to before your port will be accepted. Keep in mind that existing ports might violate these, but they are slowly being updated, and we don't want to keep adding bad code we know will need fixing.
- The only sim_xxx symbols you may define:
- All other symbols must come from common/ files
- Do not use global variables -- this is what SIM_CPU is for
- Do not hardcode STATE_CPU(sd,0) everywhere -- functions that operate on cpus must accept a SIM_CPU *cpu argument
- You must have a testsuite
- It's the only way to verify changes to the sim and prevent regressions, especially by people who update common code
- It does not need to be 100% comprehensive (although the more coverage the better)
- Tests are usually self-checking (e.g. run an insn with known inputs and compare against known outputs and exit(1) if it fails)
- Do not re-implement tracing -- use the common sim-trace module instead
- Do not parse argv directly (e.g. in sim_open) -- use the sim-options module to add new flags (e.g. sim_add_option_table)
Do not output directly to stdout/stderr w/printf & friends -- use the sim-io module instead
- Do not implement your own syscall layer -- use the sim-syscall module instead
- Your configure.ac must call SIM_AC_OPTION_WARNINGS and the build must be warning free