printf() fixes: 1) Relative addresses 2) Stack alignment when calling itoa
This commit is contained in:
@ -91,11 +91,11 @@ printf:
|
||||
push r14 ;current index of printfBuff
|
||||
push r15 ;where to return after flush
|
||||
|
||||
mov [printfArgs], rsi
|
||||
mov [printfArgs+8], rdx
|
||||
mov [printfArgs+16], rcx
|
||||
mov [printfArgs+24], r8
|
||||
mov [printfArgs+32], r9
|
||||
mov [rel printfArgs], rsi
|
||||
mov [rel printfArgs+8], rdx
|
||||
mov [rel printfArgs+16], rcx
|
||||
mov [rel printfArgs+24], r8
|
||||
mov [rel printfArgs+32], r9
|
||||
|
||||
xor r10, r10
|
||||
xor r14, r14
|
||||
@ -147,7 +147,9 @@ printf:
|
||||
push rdx
|
||||
push r8
|
||||
push r10
|
||||
sub rsp, 8
|
||||
call itoa
|
||||
add rsp, 8
|
||||
pop r10
|
||||
pop r8
|
||||
pop rdx
|
||||
@ -171,9 +173,9 @@ printf:
|
||||
mov rdi, qword [rbp + 16 + (r10-5)*8]
|
||||
|
||||
.charToStr:
|
||||
mov [printfNBuff], dil
|
||||
mov [rel printfNBuff], dil
|
||||
mov dil, 0
|
||||
mov [printfNBuff+1], dil
|
||||
mov [rel printfNBuff+1], dil
|
||||
lea rsi, [rel printfNBuff]
|
||||
jmp .insertLoop
|
||||
|
||||
|
Reference in New Issue
Block a user