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

Re: [RFC PATCH 00/25] Introduce xenbindgen to autogen hypercall structs



On Fri Nov 22, 2024 at 10:52 AM GMT, Teddy Astie wrote:
> Le 21/11/2024 à 18:46, Anthony PERARD a écrit :
> > Instead of creating your own IDL specification, did you look for
> > existing project that would do just that? That is been able to describe
> > the existing ABI in IDL and use an existing project to generate C and
> > Rust headers.
> >
> > I kind of look into this, but there's quite a few project to explore and
> > I didn't really spend enough time. Also, there's probably quite a lot
> > that are for client-server interfaces rather than syscall/hypercalls, or
> > they impose a data format.
> >
>
> I think a such IDL would be C headers, but it's easy to make C headers
> that are hard to deal with in other languages.

Well, that's how x86_64 and x86_32 came to have different ABIs. Have a look at
xen/include/public/ and xen/include/compat/

As it turns out, C is very deceptive. And the AST doesn't codify many
invariants we'd like to preserve and write down so languages capable of
enforcing them can do so. One example I'm working on now is evtchn_status. It
contains a tagged union with a external status field (used as the union tag).
In C this relationship is basically unenforced and stated via comments. For
other languages to know about it it ought to be formalized.

IOW, if we were to simply transpile C it's impossible to restrict C to only use
safe constructs in other languages.

> I checked briefly, and
> there is Fuchsia IDL that could be interesting in that matter but is
> much more complex than what we may be looking for.

Fuchsia IDL in in the same camp as Protocol Buffers, Smithy and others, I
think. It's a protocol specification rather than an ABI specification, with the
specific twist that it's tailored for Zircon channels. I don't think it creates
structs.

>
> >
> > Next, on the file format choice, is TOML the best for describing an ABI,
> > or would other existing file format make it a bit easier to read, like
> > JSON or YAML? (I quite like using YAML so I have a bias toward it 🙂,
> > and that's the format used for the CI). I don't think it mater much for
> > Serde which file format is used.
>
> It can be decided by making examples of IDL files in various formats and
> deciding on which one would be the most readable/easy to deal with.

Yeah, I'll probably do that.

>
> Teddy
>
>
> Teddy Astie | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech

Cheers,
Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.