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

From: Borislav Petkov
Date: Mon Nov 02 2020 - 13:34:44 EST


On Mon, Nov 02, 2020 at 12:10:00PM -0600, Segher Boessenkool wrote:
> movl works for moving anything g->r.

Right.

> This is not true for most insns, and not for most architectures at
> all (usually loading from memory has a separate mnemonic; moving an
> immediate number often as well (and it does not usually allow *every*
> immediate anyway, not even all numbers!)

So I've heard from other architectures. Every arch has its own problems.
:-)

> Most people do not read the documentation, they just copy from (bad)
> examples (and arguably, any example you do not really understand is a
> bad example).

Unfortunately.

> (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...

> 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. Might even make people copying from bad examples
to go look at the docs first...

:-)

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette