All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liviu Ionescu <ilg@livius.net>
To: Leon Alrae <leon.alrae@imgtec.com>
Cc: peter.maydell@linaro.org, christopher.covington@linaro.org,
	qemu-devel@nongnu.org, matthew.fortune@imgtec.com
Subject: Re: [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument
Date: Sat, 4 Apr 2015 18:20:09 +0300	[thread overview]
Message-ID: <4D529488-EAAF-469E-81A0-1A52C91A5BA1@livius.net> (raw)
In-Reply-To: <1427894283-31953-1-git-send-email-leon.alrae@imgtec.com>


> On 01 Apr 2015, at 16:18, Leon Alrae <leon.alrae@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

      parent reply	other threads:[~2015-04-04 15:20 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 13:18 [Qemu-devel] [RFC PATCH] vl.c: add -semihosting-config "arg" sub-argument Leon Alrae
2015-04-01 15:21 ` Liviu Ionescu
2015-04-01 16:12   ` Matthew Fortune
2015-04-02  7:56   ` Leon Alrae
2015-04-02  8:29     ` Liviu Ionescu
2015-04-02  9:14       ` Leon Alrae
2015-04-02 10:36         ` Leon Alrae
2015-04-02 12:36           ` Liviu Ionescu
2015-04-02 14:27             ` Matthew Fortune
2015-04-02 16:47               ` Liviu Ionescu
2015-04-03 15:33                 ` Liviu Ionescu
2015-04-08 16:20                 ` Leon Alrae
2015-04-14 17:42                   ` Liviu Ionescu
2015-04-15  9:09                     ` Liviu Ionescu
2015-04-15 11:53                       ` Leon Alrae
2015-04-15 12:02                         ` Matthew Fortune
2015-04-15 12:06                         ` Liviu Ionescu
2015-04-15 12:49                           ` Leon Alrae
2015-04-15 16:08                             ` Liviu Ionescu
2015-04-16  9:27                               ` Leon Alrae
2015-04-17 17:45                                 ` Liviu Ionescu
2015-04-16 14:22                       ` Peter Maydell
2015-04-21 13:34                         ` Leon Alrae
2015-04-21 15:14                           ` Liviu Ionescu
2015-04-21 15:55                             ` Peter Maydell
2015-04-21 16:21                               ` Liviu Ionescu
2015-04-21 16:23                                 ` Peter Maydell
2015-04-21 16:51                                   ` Liviu Ionescu
2015-04-21 17:50                                     ` Peter Maydell
2015-04-21 16:48                               ` Eric Blake
2015-04-21 16:54                                 ` Peter Maydell
2015-04-21 17:22                                   ` Eric Blake
2015-04-21 17:49                                   ` Liviu Ionescu
2015-04-21 18:08                           ` Liviu Ionescu
2015-04-23 11:55                             ` Leon Alrae
2015-04-23 12:07                               ` Liviu Ionescu
2015-04-01 15:45 ` Christopher Covington
2015-04-01 16:24   ` Liviu Ionescu
2015-04-04 15:20 ` Liviu Ionescu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D529488-EAAF-469E-81A0-1A52C91A5BA1@livius.net \
    --to=ilg@livius.net \
    --cc=christopher.covington@linaro.org \
    --cc=leon.alrae@imgtec.com \
    --cc=matthew.fortune@imgtec.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.