Wed Jun 06 21:48:53 2012: Request 77677 was acted upon. Transaction: Correspondence added by bulk88. Queue: Win32-API Subject: x64 asm is broken for ::API, >4 param crash Broken in: 0.68 Severity: Normal Owner: Nobody Requestors: bul...@hotmail.com Status: open Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=77677 >
There are 2 separate problems here. MSVC doesn't save RSI, but it causes no ill effects since MSVC (atleast my 2008) will not use nonvolatile registers (and therefore use more stack memory) no matter what the -O flag or LTCG setting. Ask MS about that one. The GCC code saves RSI and restores it, and GCC uses RSI alot unlike MSVC, but if the stack prototype has more than 4 args, the copystack loop runs and "corrupts" RSP and then later when the POPs happen they POP garbage into RSI and R10 (why R10 is saved, its volatile, and not a fastcall register, IDK), RSP isn't the same when the PUSHes were done. Since MSVC code doesn't ever call POP and uses 100% RBP addressing, the RSP position is irrelevant but RSI is still not restored.