Why does Windows64 use a different calling convention from all other OSes on x86-64?

前端 未结 4 1812
予麋鹿
予麋鹿 2020-11-22 04:12

AMD has an ABI specification that describes the calling convention to use on x86-64. All OSes follow it, except for Windows which has it\'s own x86-64 calling convention. Wh

4条回答
  •  别那么骄傲
    2020-11-22 04:39

    Win32 has its own uses for ESI and EDI, and requires that they not be modified (or at least that they be restored before calling into the API). I'd imagine 64-bit code does the same with RSI and RDI, which would explain why they're not used to pass function arguments around.

    I couldn't tell you why RCX and RDX are switched, though.

提交回复
热议问题