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