Hello list, ARM ADS/RVCT compiler generated executables by default use "semihosting" to communicate with the host, including retrieval of a commandline. The semihosting implementation up to now did not implement this functionality; this patch adds the SYS_GET_CMDLINE semihosting call, such that semihosting executables get a command line when executed through qemu-arm.
This is a reworked patch an earlier version of which can be found at http://lists.gnu.org/archive/html/qemu-devel/2006-06/msg00323.html . The old version contained a bug which effectively limited the commandline to 128 bytes. (quoted from that earlier mail:) The patch below implements the SYS_GET_CMDLINE semihosting call, by keeping a global pointer to the user space commandline arguments, and by re-building a space-separated command line in the guest side supplied buffer. This patch has two shortcomings, which I would love to see feedback on: - I am keeping a global pointer in order to have a handle on the command line arguments inside do_arm_semihosting. Is there a better place to keep this? - The ARM (guest) side supplied buffer is only 256 bytes long; if the user supplied command line is larger, the semihosting call will fail (gracefully). A better strategy may be to build the string on the initial guest stack (similar to loader_build_argptgr()) and then hand that pointer to the guest. I am not quite sure whether the ARGS[] array should be locked before access (then again, none of the functions in do_arm_semihosting() do this). This is tested with both big- and littleendian emulation (i.e. qemu-arm and qemu-armeb). All comments welcome. -- Wolfgang Schildbach, Senior Research Engineer Coding Technologies GmbH
arm_semihosting_commandline.diff
Description: Binary data
_______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel