Fix stack alignment in printf; flushing buffer would have unaligned stack if format specifier wasn't %d (only .convertInt aligned the stack)
This commit is contained in:
@ -117,6 +117,7 @@ printf:
|
||||
cmp byte [rdi+1], 0x0
|
||||
je .continue
|
||||
push rdi
|
||||
sub rsp, 8
|
||||
cmp byte [rdi+1], 'd'
|
||||
je .rep_d
|
||||
cmp byte [rdi+1], '%'
|
||||
@ -147,9 +148,7 @@ printf:
|
||||
push rdx
|
||||
push r8
|
||||
push r10
|
||||
sub rsp, 8
|
||||
call itoa
|
||||
add rsp, 8
|
||||
pop r10
|
||||
pop r8
|
||||
pop rdx
|
||||
@ -204,10 +203,12 @@ printf:
|
||||
jmp .insertLoop
|
||||
.s0f:
|
||||
inc r10
|
||||
add rsp, 8
|
||||
pop rdi
|
||||
add rdi, 2
|
||||
jmp .makeStr
|
||||
.continue_poprdi:
|
||||
add rsp, 8
|
||||
pop rdi
|
||||
.continue:
|
||||
inc rdi
|
||||
|
Reference in New Issue
Block a user