> On 01 Apr 2015, at 16:18, Leon Alrae <leon.al...@imgtec.com> wrote: > > ... I would like to follow up with a clean up > where we've got a semi-hosting specific structure rather than keep generating > more semihosting_* variables.
I checked the differences between my fork and the master branch (SourceTree for Mac is a great git tool!), and I can summarise my changes: - in qemu-options.hx I added -semihosting_cmdline DEF("semihosting-cmdline", HAS_ARG, QEMU_OPTION_semihosting_cmdline, "-semihosting-cmdline [string] semihosting command line\n", QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA | QEMU_ARCH_LM32) - in vl.c I defined I defined qemu_semihosting_cmdline_opts static QemuOptsList qemu_semihosting_cmdline_opts = { .name = "semihosting-cmdline", .implied_opt_name = "cmdline", .merge_lists = true, .head = QTAILQ_HEAD_INITIALIZER(qemu_semihosting_cmdline_opts.head), .desc = { { /* end of list */ } }, }; - in vl.c I identify the "semihosting-cmdline", get the next option argument and store it in the cmdline option field: case QEMU_OPTION_semihosting_cmdline: opts = qemu_opts_parse(qemu_find_opts("semihosting-cmdline"), optarg, 0); if (opts != NULL) { Error *local_err = NULL; qemu_opt_set(opts, "cmdline", optarg, &local_err); } - in target-arm/arm-semi.c, the initial code computed the semihosting command line by concatenating the kernel path and the kernel cmdline. the patched version first checks if -semihosting-cmdline is not null, and uses it as-is, otherwise it falls back to the kernel path and kernel cmdline. the intention was to remain compatible with existing configurations, and I guess it was met. access to semihosting cmdline is simple: opts = qemu_opts_find(qemu_find_opts("semihosting-cmdline"), NULL); cmdline = qemu_opt_get(opts, "cmdline"); https://sourceforge.net/p/gnuarmeclipse/qemu/ci/gnuarmeclipse-dev/tree/target-arm/arm-semi.c - in hw/arm/cortexm.c, the equivalent of armv7m.c, the env->boot_info pointer must be initialised, otherwise the arm-semi.c code fails. /* Fill-in a minimalistic boot info, required for semihosting. */ cortexm_binfo.kernel_cmdline = kernel_cmdline; cortexm_binfo.kernel_filename = machine->kernel_cmdline; env->boot_info = &cortexm_binfo; you can use these code snippets, or I can pack them in a patch, if the semihosting-cmdline solution is accepted in the master branch. regards, Liviu