printf() don't restore rcx and r8 for (u)int2str()

This commit is contained in:
2025-07-08 17:40:02 +02:00
parent cd565f3bfa
commit ee14dbb853

View File

@@ -69,7 +69,7 @@ puts:
; <!> For all specifiers (except %%) an argument is expected. Mismatch between arguments given and specifiers provided will lead to issues
; Used registers:
; rax* (ret) amount of printed characters
; rdi* (arg) pointer to format[] to format and print
; rdi* (arg) pointer to format[] to format and print >> pointer to buffer
; rsi* (optional arg) >> Used for inserting strings to buffer
; rdx* (optional arg) >> Keeps track of amount of processed format specifiers
; rcx* (optional arg)
@@ -160,11 +160,9 @@ printf:
mov rsi, [rbp + RBP_OFFSET_CALLER + ((rdx-5) * SIZE_QWORD)]
.checkINTorUINT:
push rax
push rcx
push rdx
push rdi
;push rsi
push r8
sub rsp, SIZE_QWORD
cmp byte [rdi + 1], 'd'
je .callINT2STR
mov rdi, rsi
@@ -175,11 +173,9 @@ printf:
call int2str
.loadConvertedStr:
mov rsi, rax
pop r8
;pop rsi
add rsp, SIZE_QWORD
pop rdi
pop rdx
pop rcx
pop rax
jmp .insertString