what is the difference between push and push word in Assembler x64?

0

Hello everyone, I am implementing the bind system call in Assembler x64 with NASM for developing a TCP socket. I have the following code and it works:

mov rdi, [socket]           
push dword 0x6B02A8C0       
push word  0x560f           
push word  2                
mov rsi, rsp                
mov rdx, dword 32
mov rax, 49                 
syscall

The structure to follow is as follows:

rdi --> int fd
rsi --> struct sockaddr __user * umyaddr
rdx --> int addrlen
rax --> syscall

I understand quite well about implementing the system call, my problem is with system calls that need a structure, I know that the structure is inserted on the stack and then the pointer is passed to the register, but I don't understand why I need to put "push dword, 0x00000000" and not just "push, 0x00000000", I read that it was exactly the same, but because removing the "dword" and "word" and it doesn't work, the program runs, and it doesn't throw an error but when I try to connect to the socket as client is as if there were no open socket.

Anyway, what is the difference between putting "dword" and not putting it? Or am I implementing the structure wrong, is it fine or am I missing a parameter? I want to know well what it does to understand it, it is good that it works but if I do not understand it it does not work for me.

From already thank you very much!!

assembly
struct
x86-64
nasm
bind
asked on Stack Overflow Apr 12, 2021 by Franco Milich • edited Apr 12, 2021 by Peter Cordes

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0