Linux SYS_WRITE vs Win WriteFile from kernel32.lib

Created Diff never expires
8 removals
Words removed13
Total words41
Words removed (%)31.71
12 lines
16 additions
Words added66
Total words94
Words added (%)70.21
18 lines
inst_146:
inst_146:
;; native write
;; native write
sub rsp, 40 ; 32 bytes of shadow space + 8 bytes for fifth argument
mov ecx, STD_OUTPUT_HANDLE
call GetStdHandle
mov DWORD [stdout_handler], eax
xor r9, r9 ; 4 arg - r9 - lpNumberOfBytesWritten
mov r11, [stack_top]
mov r11, [stack_top]
sub r11, BM_WORD_SIZE
sub r11, BM_WORD_SIZE
mov rdx, [r11] ; 3 arg
mov r8, [r11] ; 3 arg - r8 - buffer size
sub r11, BM_WORD_SIZE
sub r11, BM_WORD_SIZE
mov rsi, [r11]
mov rdx, [r11]
add rsi, memory ; 2 arg
add rdx, memory ; 2 arg - rdx - buffer pointer
mov rdi, STDOUT ; 1 arg
xor ecx, ecx
mov rax, SYS_WRITE
mov ecx, dword [stdout_handler] ; 1 arg - rcx - handler
mov [stack_top], r11
mov [stack_top], r11
syscall
call WriteFile
add rsp, 40