[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] riscv: Add semihosting support [v4]

From: Palmer Dabbelt
Subject: Re: [PATCH] riscv: Add semihosting support [v4]
Date: Thu, 30 Jan 2020 03:38:04 -0800 (PST)

On Thu, 30 Jan 2020 10:54:37 GMT (+0000), Peter Maydell wrote:
On Wed, 29 Jan 2020 at 16:45, Keith Packard <address@hidden> wrote:

Peter Maydell <address@hidden> writes:

> True but irrelevant. You need to refer to a proper
> risc-v specification for your semihosting.

The RISC-V Foundation defined semihosting as relative to the existing
ARM specification, so using a link to that is appropriate here.

Here's the current specification of the unprivileged ISA, which includes
the definition of semihosting


While it may be nice in some abstract sense to create a "better"
semihosting spec, that's not what the RISC-V foundation has decided to

We've gone round this several times. You can't just
say "it's the arm spec", because you're not arm and
your architecture is different. You need to actually
document what the architecture-specific parts are,
even if you want to mostly say "and we follow the
Arm spec most of the time". If you really really want
to say "32 bit RISC-V is gratuitously different from
64-bit RISC-V in these areas because we just blindly
copied the way Arm happened to have historically
developed" then you can do that if you like, but you
need to actually write it down in a document somewhere.

You're trying to implement an ABI which has multiple
different implementations of both consumers and
producers; it's not a good idea to shortcut the
process of actually writing down what the requirements
between the two ends are.

I think, more concretely, the issues here are:

* The only mention of "semihosting" in the RISC-V specification is in the
 commentary, which is not considered a normative part of the specification.
* The interface that commentary contains is defined as maybe being obsolete
 already, but no new concrete interface is defined.
* The semihosting comment doesn't define the semihosting call numbers, just the
 sequence to get to a call.  That said, we haven't written down the Linux ABI
 either -- though there's a much larger breadth of software out there that
 implements it and won't break ABI compatibility, so maybe that's considered
 sufficient in Linux land where it's not for semihosting.

It seems to me like the right way to go forward is to put together a
semihosting ABI specification as a RISC-V specification.  That would give
everyone who cares about their pre-specification implementations a chance to
get together to figure out which parts they want to keep, and give us a path to
move forwards.  There's more work that needs to be done here to put together a
system that will actually work (for example, how to we insert breakpoints if
we're using ebreak to indicate semihosting and haven't reserved NOP
sequences?), so this does warrant a bit of thought.

I know it's a bit of a headache in the short term to get a specification
together, but we've had so many headaches of the "there's no spec" sort that at
least it'll be a change of pace :)

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]