When gem5 needs to extract function arguments from or set a return value in a guest context, it has a couple mechanisms it uses. The API and the ABI expected by it depend on the type of function being called (syscall, pseudo instruction, kernel function). These sometimes depend on global constants, and/or Process subclass methods, and/or hard coding in the ISA decoder.
These mechanisms also tend to assume that arguments are gathered in particular ways (from a sequence of registers for instance), and can't easily be specialized for ABIs which work differently. This has been partially hacked around, but a more elegant and unified mechanism would be nice. Also we will eventually need a mechanism which never depends on global constants.
See for more information.