4 ms·
I'm merely referring to the fact that I specified rdi by writing "rdi" not "D". I can specify r10 by writing "r10", but I can't remember how to specify that dir
by dundarious 3y ago
I'm merely referring to the fact that I specified rdi by writing "rdi" not "D". I can specify r10 by writing "r10", but I can't remember how to specify that directly in the inputs/outputs constraints -- a glance at https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html didn't show me how either, but I'm guessing it's there.
[Edit: Although, on second glance, from https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Input-Operands https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Input-O...:
> If you must use a specific register, but your Machine Constraints do not provide sufficient control to select the specific register you want, local register variables may provide a solution (see Specifying Registers for Local Variables).
indicates in the r10 case maybe you _must_ use the syntax I gave?]
My preference is for the syntax that requires looking up fewer tables in GCC docs, but as I said, the version you prefer is fine too.
- LegionMammal978 3y agoIndeed, the register variable syntax is necessary for many of the registers; there are only so many of them that have been stuffed into the one-letter constraint. I've used it before for making raw x86-64 Linux syscalls (which can use r10, r8, and r9) without going through errno, as part of a silly little project ([0]) to read from a file descriptor without writing to process memory. [0] https://pastebin.com/mepsedCC https://pastebin.com/mepsedCC
- dundarious 3y agoNice. Yes, linux/tools/include/nolibc has syscall macros that look near identical.