bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point


From: Samuel Thibault
Subject: Re: [PATCH 5/5 v2 gnumach] x86_64: add 64-bit syscall entry point
Date: Wed, 1 Mar 2023 21:18:51 +0100
User-agent: NeoMutt/20170609 (1.8.3)

Luca Dariz, le mer. 01 mars 2023 18:40:37 +0100, a ecrit:
> +    asm volatile("wrmsr"
> +                 :
> +                 : "c" (regaddr), "a" (low), "d" (high)
> +                 : "memory"  /* wrmsr is a serializing instruction */

The comment could be misleading.

The fact that it's a serialization instruction does not *require* to
express it to the compiler.

But the fact that wrmsr needs to be a serialization instruction (because
it may depend on other writes etc.) means that one *also* wants to make
the asm snippet serialized by the compiler thanks to the memory clobber.

So I'd rather see:

                 : "memory"  /* wrmsr usage needs serialization */

> +     /* avoid leaking information in callee-clobbered registers */
> +     xorq    $0,%rdi
> +     xorq    $0,%rsi
> +     xorq    $0,%rdx
> +     xorq    $0,%r10
> +     xorq    $0,%r9
> +     xorq    $0,%r8

No, that's a no-op :)

> +     xorq    %rdi,%rdi
etc.

Samuel



reply via email to

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