On Tue, Feb 28, 2023 at 5:37 PM Samuel Thibault <samuel.thiba...@gnu.org> wrote: > Now it also has another meaning: since it clobbers memory, gcc is > not allowed to keep values in registers, i.e. this is a memory > synchronization barrier concerning the compiler. If for instance we have > prepared some data in memory before issuing the wrmsr, we need it for > the data preparation to be actually written. At least Linux does have > this clobber in its wrmsr inlines.
Ah yes, this makes sense. Guess a comment making this intention explicit wouldn't hurt :) On Tue, Feb 28, 2023 at 5:39 PM Samuel Thibault <samuel.thiba...@gnu.org> wrote: > Sergey Bugaev, le mar. 28 févr. 2023 17:14:05 +0300, a ecrit: > > Do I understand it right that for the most interesting syscall (which > > takes 7 args!), I *am* supposed to pass the 7th arg on the stack (in > > mem[rsp + 8]) > > That's the x86_64 ABI, yes. > > > -- unlike on Linux? > > ? Linux does put only 6 args in registers, too. It does not look like Linux has any syscalls that take 7 args or more, at least not on x86_64. 7th arg location is specified as just "-" in syscall(2) for x86_64 (as well as most other architectures). The only mention of using the stack on that man page is: "The mips/o32 system call convention passes arguments 5 through 8 on the user stack." Sergey