I am learning x86 assembly and I was wondering if someone could help me understand why the documentation is telling me a completely different thing to what I see in practice?
To invoke a system call I use int 80h software interrupt. I put the arguments in the first 3 registers in rbx,rcx,rdx registers and the number of the syscall in the rax. And it works, the read syscall for example works and I can see data going in the desired location in memory. However if I read man syscall it says I should put arguments to the syscall in rdi, rsi, rdx, r10, r8, r9 in that order from 1-6 for x86_64. Doing that does not work also seems a bit insane, I've seen a few resources online suggesting the same registers for syscall arguments. Is that just an error in documentation?
Same question for syscall numbers. Online people suggest looking at /usr/include/x86_64-linux-gnu/asm/unistd_64.h but there the number for read is 0 and it doesn't work, using 3 how the book suggests works, why is that?