qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liviu Ionescu <ilg@livius.net>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: keithp@keithp.com,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: Semihosting, arm, riscv, ppc and common code
Date: Thu, 16 Jan 2020 09:57:00 +0200	[thread overview]
Message-ID: <3724D35F-AC4B-44A9-9537-FCCA930D463E@livius.net> (raw)
In-Reply-To: <1a1cecb5128134e681b9145b9c6bc10a8db00ea9.camel@kernel.crashing.org>



> On 16 Jan 2020, at 04:04, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> 
> ... I agree, which is also why I want to use the same interface for
> powerpc, it will simply make life easier for everybody.


I don't know the current implementation in QEMU, but I suggest you also take a look at the current Arm specs:

	https://static.docs.arm.com/100863/0200/semihosting.pdf

The implementation in OpenOCD is:

	https://github.com/xpack-dev-tools/openocd/blob/xpack/src/target/semihosting_common.c

> The calls
> aren't perfect but they do work sufficiently well to be useful and I
> haven't yet been convinced that it can't be extended if necessary.

In theory it can, in practice it'll not be easy.

Imagine that you decide to use Arm semihosting for your architecture, and implement it in QEMU.

Then you try to convince other tool developers to do the same. If you ask them nicely, they might copy/paste the Arm code, and you're done, major commercial tools will have Arm semihosting support for your architecture and it becomes a de facto standard.

If at a later time you decide to extend the protocol, you have to go again to all commercial tool vendors and ask them to implement the extension. You'll need good reasons to convince them.

In my case it was easier to convince SEGGER to add Arm semihosting support to their RISC-V JTAG, because we had a long relationship, but even so I doubt they'll be happy to implement extensions.

---

Anyway, from my experience, for practical cases the Arm semihosting is more than enough, once you have a functional implementation for the client side you simply forget about it, and you can use it for any architecture.

My implementation is the following:

	https://github.com/micro-os-plus/semihosting-xpack/blob/xpack/src/syscalls-semihosting.cpp


Regards,

Liviu




  reply	other threads:[~2020-01-16  7:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  6:25 Semihosting, arm, riscv, ppc and common code Benjamin Herrenschmidt
2020-01-14  7:32 ` Liviu Ionescu
2020-01-14  7:53   ` Benjamin Herrenschmidt
2020-01-14  9:51     ` Alex Bennée
2020-01-15  1:14       ` Benjamin Herrenschmidt
2020-01-15 12:01         ` Alex Bennée
2020-01-15 12:30           ` Liviu Ionescu
2020-01-15 21:28           ` Richard Henderson
2020-01-15 22:02             ` Liviu Ionescu
2020-01-16  2:04               ` Benjamin Herrenschmidt
2020-01-16  7:57                 ` Liviu Ionescu [this message]
2020-01-16  6:33           ` Benjamin Herrenschmidt
2020-01-14  9:59 ` Peter Maydell
2020-01-15  1:17   ` Benjamin Herrenschmidt
2020-01-15 13:32     ` Peter Maydell
2020-01-16  2:01       ` Benjamin Herrenschmidt
2020-01-16 11:05         ` Peter Maydell

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=3724D35F-AC4B-44A9-9537-FCCA930D463E@livius.net \
    --to=ilg@livius.net \
    --cc=alex.bennee@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=keithp@keithp.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).