Am 05.06.25 um 13:43 schrieb Xi Ruoyao via Gcc-help:
Hi, When we write syscall wrappers with inline assembly, we often need to assign one register for both an input variable and an output variable. Per https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html, such an inline assembly can be written register int *p1 asm ("r0") = …; register int *p2 asm ("r1") = …; register int *result asm ("r0"); asm ("sysint" : "=r" (result) : "0" (p1), "r" (p2)); Note the use of constraint "0" for p1 which shares the same register as result. But currently in the Linux kernel vDSO, they are actually written like asm ("sysint" : "=r" (result) : "r" (p1), "r" (p2)); So the question here: is using "r" for p1 valid or not? Do we need to "fix" this everywhere for the vDSO?
That code is perfectly fine, since the register numbers for p1 and result are the same "r0" at the point of the inline asm. Johann