Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

From: Segher Boessenkool
Date: Mon Nov 02 2020 - 15:08:29 EST


On Mon, Nov 02, 2020 at 07:34:30PM +0100, Borislav Petkov wrote:
> On Mon, Nov 02, 2020 at 12:10:00PM -0600, Segher Boessenkool wrote:
> > (It does not allow *all* memory and *all* constants, btw... And the
> > condition for registers is not really "general register", whatever that
> > means...
>
> I think that means general purpose registers. I.e., it won't use, say
> FPU, XMM or whatever special regs.
>
> What does the asm() parsing code in gcc do for "g"? There should be
> some logic which constraints what register is valid...

It just asks the general_operand function, which (for registers) accepts
the hard registers that are accessible. This does include the float and
vector etc. registers, normally.

But you usually have a pseudo-register there (which is always allowed
here), unless you used some register asm variable. And pseudos usually
are allocated a simple integer register during register allocation, in
an asm that is.

> > I hope no one ever told you our documentation does not have white
> > lies!)
>
> I have convinced myself of this a couple of times already so I either go
> ask our gcc friends or go look straight at gcc source. It is useful to
> know folks which hack on it so that I can ask them stupid questions and
> not go off into the weeds, trying to figure out what the documentation
> says.
>
> But hey, if that gets the documentation improved, that's a win-win
> situation right there.

Yes :-)

> Might even make people copying from bad examples
> to go look at the docs first...

Optimism is cool :-)


Segher