From 3951e50ab0d7004d6190b4b8c32fcac5aa202af1 Mon Sep 17 00:00:00 2001 From: Kwarde Date: Thu, 10 Jul 2025 01:38:25 +0200 Subject: [PATCH] Force self to sub/add rsp before/after push/pop (instead of after/before push/pop) -- prevents popping wrong values, eventually (in callee, like what printf does) --- src/console.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.asm b/src/console.asm index 737acd3..be0197b 100644 --- a/src/console.asm +++ b/src/console.asm @@ -168,10 +168,10 @@ printf: .d_fromStack: mov rsi, [rbp + RBP_OFFSET_CALLER + ((rdx-5) * SIZE_QWORD)] .checkINTorUINT: + sub rsp, SIZE_QWORD push rax push rdx push rdi - sub rsp, SIZE_QWORD cmp byte [rdi + 1], 'u' je .callUINT2STR mov rdi, rsi @@ -182,10 +182,10 @@ printf: call udec2str .loadConvertedStr: mov rsi, rax - add rsp, SIZE_QWORD pop rdi pop rdx pop rax + add rsp, SIZE_QWORD jmp .insertString ;--- '%x' / '%X' ---;