I am trying to implement syscall on Linux (RedHat Enterprise 8) and I am a bit confused about how it works. From what I understand, I am implementing a user-mode shell that puts the syscall number in eax and the parameters in ebx, ecx, edx, etc., and then calls int 0x80, which calls the corresponding syscall. My question is, since syscall is written like a regular C function, how does it know which registers contain which parameters? Is it a convention, or is there a mechanism for it, and if so, where and how does it do it?
EDIT: This is homework. I know there are syscall macros that can do this for me.
source
share