diff options
author | Malfurious <m@lfurio.us> | 2023-01-15 01:07:25 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2023-01-15 01:07:25 -0500 |
commit | 37243a782b0fe4828e7b2480ea600b126d9c512a (patch) | |
tree | 8acba658212325b61aec92a7ed7ea932e55e6b81 /lace_x86.asm | |
parent | 7e8e439a6940bde2c11d30e45b950dd3ed789e60 (diff) | |
download | lace-37243a782b0fe4828e7b2480ea600b126d9c512a.tar.gz lace-37243a782b0fe4828e7b2480ea600b126d9c512a.zip |
Subtracting esp to allocate space on the stack is only necessary to
preserve data that is already lower on the stack. By the time we use
either the sockaddr struct or the temporary io buffer, we are finished
accessing older stack values, so they can be overwritten. This saves 2
unnecessary instructions from the program.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'lace_x86.asm')
-rw-r--r-- | lace_x86.asm | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lace_x86.asm b/lace_x86.asm index 687b8e0..12fc1b0 100644 --- a/lace_x86.asm +++ b/lace_x86.asm @@ -80,8 +80,6 @@ _start: mov bl, 1 jl exit - sub esp, 16 ; alloc struct sockaddr_in - mov dl, 16 ; read(argv[1], sockaddr, sizeof(sockaddr)) mov ecx, esp mov ebx, eax @@ -113,10 +111,8 @@ _start: mov bl, 3 jne exit - pop edi ; recover socket fd - sub esp, 0xff ; alloc data buffer - xor esi, esi ; pipe(sock_fd, stdin) + pop edi call pipe inc esi ; pipe(stdout, sock_fd) |