Login
You're viewing the functional.cafe public feed.
  • prozacchiwawaprozacchiwawa
    Apr 4, 2025, 3:07 AM

    ok stumbled on a raymond chen article:
    devblogs.microsoft.com/oldnewt

    and now i understand... it's not va_list precisely, it's that using va_list causes the function to spill the registers. in reality, we're supposed to provide space for potential arg saves for the callee, _then_ the function subtracts from r1 (which raymond chen also mentions). this mirrors what i see in the prolog of sprintf

    771194b4 stw   r29,fff4(r1)
771194b8 stw   r31,fffc(r1)
771194bc stw   r30,fff8(r1)
0:000> u 0x771194c0
771194c0 stw   r3,18(r1) ;; Note we're in positive stack space
771194c4 stw   r4,1c(r1)
771194c8 stw   r5,20(r1)
...
771194dc stw   r10,34(r1
0:000> u 0x771194e0
CRTDLL!tanh+0x167d8:
771194e0 stwu r1,ff90(r1)
...
    💬 0🔄 1⭐ 2