Skip to content

Instantly share code, notes, and snippets.

@alex-bellon
Last active August 26, 2022 23:17
Show Gist options
  • Save alex-bellon/9a040bfa858c22a42ef466b24d92d15c to your computer and use it in GitHub Desktop.
Save alex-bellon/9a040bfa858c22a42ef466b24d92d15c to your computer and use it in GitHub Desktop.
Description of work done so far to add M68K support to HALucinator

HALucinator 68K Support

src/halucinator/hal_config.py

  • Added support to _init_ for different calling conventions

src/halucinator/main.py

  • Added M68K class from Avatar2 and M68KQemuTarget from qemu_targets in local repo
  • Added M68K as possible architecture to select, choose appropriate path

src/halucinator/qemu_targets/m68k_qemu.py

  • Created this file based on the other ARM targets
  • This has not been fully tested yet
  • TODO (maybe): right now in execute_return, return values are just being put in D0. Is this convention widely supported or do we need to handle returning in other registers?

src/halucinator/bp_handlers/generic/function_callers.py

  • Created M68kFunctionCaller to have a handler for calling functions in M68k
    • TODO: add support for stack and register based calling convention. Right now I don’t know what the type of the arg variable is so I don’t know how to handle them. This needs to wait until we can get HALucinator running and can do some prints of the type.
  • Added option to pass in calling convention wherever needed, since you M68K has multiple

avatar2/archs/m68k.py

  • Created this file, based it on other files in the archs directory
  • Right now I only made a class for the 68040, if you need a different specific CPU that will need to be added

avatar2/protocols/gdb.py

  • (Temporarily) switched architecture to M68K
    • TODO: add a cleaner way to change architecture

avatar2/targets/qemu_target.py

  • (Temporarily) print out the full CLI command that is run

targets/build_qemu.sh

  • Added m68k-softmmu to build

hw/avatar/Makefile.objs

  • Added TARGET_M68K

hw/avatar/configurable_machine.c

  • Added defines for TARGET_M68K
  • Implemented entry point code based off other arch’s code
  • Implemented create_cpu based off of other arch’s code

hw/avatar/irq_controller.c

  • Added defines for TARGET_M68K
  • Added 68K to update_irq

hw/avatar/remote_memory.c

  • Added defines for TARGET_M68K
  • Added 68k to get_current_pc

target/m68k/cpu.h

  • Added cpu_m68k_init and cpu_init, copied from main avatar_qemu repo

target/m68k/helper.c

  • Added cpu_m68k_init, copied from main avatar_qemu repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment