diff --git a/src/console.asm b/src/console.asm index b61abf9..aac5a3f 100644 --- a/src/console.asm +++ b/src/console.asm @@ -125,8 +125,8 @@ __INTERNAL_fmt: mov %1, [printfArgs + SIZE_QWORD * r14] jmp %%continue %%fromStack: - cmp r15, FD_stdout - je %%stackNoShift + cmp r15, FD_stderr + jle %%stackNoShift ;simple jle (for test r15,2); entry of this wrapper quits early if passed FD is less than 1, so this simple check is safe enough mov %1, [rbp + (RBP_OFFSET_CALLER*2 + SIZE_QWORD) + ((r14-5) * SIZE_QWORD)] ;non-printf functions calling __INTERNAL_fmt require RDI to be FD, all args shifted and rbp+RBP_OFFSET_CALLER to r9. Also requires function prologue and a CALL to __INTERNAL_fmt (not a JMP like in printf); hence the RBP_OFFSET_CALLER*2 jmp %%continue %%stackNoShift: