33.4. Baremetal command line arguments

QEMU and gem5 currently supports baremetal CLI arguments!

You can see them in action e.g. with:

./run --arch aarch64 --baremetal userland/c/command_line_arguments.c --cli-args 'aa bb cc'
./run --arch aarch64 --userland userland/c/command_line_arguments.c --cli-args 'aa bb cc'

both of which output the exact same thing:

aa
bb
cc

This is implemented by parsing the command line arguments and placing them into memory where the code will find them.

This works by:

It is worth noting that e.g. ARM has a Semihosting mechanism for loading CLI arguments through SYS_GET_CMDLINE, but our mechanism works in principle for any ISA.