Comment by im3w1l
3 months ago
Or just
int main(void) {
asm volatile("syscall" : : "a"(1), "d"(14), "D"(1), "S"("hello world!\n"));
return 0;
}
Though the clobber list is weak spot, I don't know exactly what it should have in this case.
You want:
You can also say:
https://justine.lol/dox/rmsiface.txt
Got some sleep and took a second look. You actually want:
Sorry folks! Note also this only works on Linux. On BSDs for example, even if you change the magic number, BSDs may clobber all the call-clobbered registers. So with those OSes it's usually simplest to write an assembly stub like this:
I don't suppose you know the syscall clobbered list for aarch64 Linux? Can't find it documented anywhere and not sure how to dig it out of the kernel
A sibling comment pointed at https://chromium.googlesource.com/linux-syscall-support/+/re... which suggests none are clobbered outside of the arguments used by a given call which is possible but seems unlikely
1 reply →