__INTERNAL_fmt: Assure correct stack arguments are loaded if FD=stderr
This commit is contained in:
@@ -125,8 +125,8 @@ __INTERNAL_fmt:
|
|||||||
mov %1, [printfArgs + SIZE_QWORD * r14]
|
mov %1, [printfArgs + SIZE_QWORD * r14]
|
||||||
jmp %%continue
|
jmp %%continue
|
||||||
%%fromStack:
|
%%fromStack:
|
||||||
cmp r15, FD_stdout
|
cmp r15, FD_stderr
|
||||||
je %%stackNoShift
|
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
|
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
|
jmp %%continue
|
||||||
%%stackNoShift:
|
%%stackNoShift:
|
||||||
|
Reference in New Issue
Block a user