First of all a small intro: I am developing a TCP server in Assembler x64 with NASM, all good until there, implement the fork system call so that each client that connects is not on the waiting list, in short, that it works and I have it quite clear. Now, I wanted to implement threads, in the same way that it is done in C with pthread but pum in the list of system calls neither pthread_create, nor pthread_join nor anything similar to what is in C exist, but if it exists in C, somehow it is done in Assembler.
Reading a little, apparently a thread would be created by the sys_clone system call, now my problem is that I have no idea what its arguments refer to and I can't find examples anywhere of its implementation, if you know of any website that explains each argument of the system calls in Linux I would appreciate it because it asks me something like this int __user * parent_tidptr and makes him realize that they are speaking to me in Russian.
mov rdi, ??? ; unsigned long clone_flags
mov rsi, ??? ; unsigned long newsp
mov rdx, ??? ; int __user * parent_tidptr
mov r10, ??? ; int __user * child_tidptr
mov r8, ??? ; int tls_val
mov rax, 56
syscall
The list of system calls with their respective arguments I get them from this site: link
In Linux Programmer's Manual I try to guide myself with this: link, but I am in the same, I do not understand the arguments, the first argument I suppose is like in pthread_create that you pass a function but the truth I do not know.
Without more to say I thank you in advance, and sorry if some things seem obvious, but I have been doing this for at most 2 weeks, which I love but we must admit that finding Assembler information is not as simple as looking for C things, C++, Javascript haha, among others. Bye if you read this I love you!