x86 Assembly - Why is [e]bx preserved in calling conventions?

后端 未结 3 1682
心在旅途
心在旅途 2021-01-06 01:22

I\'ve noticed that a lot of calling conventions insist that [e]bx be preserved for the callee.

Now, I can understand why they\'d preserve something like [e]sp or [e]

3条回答
  •  生来不讨喜
    2021-01-06 02:21

    This is a compromise between not saving any of the registers and saving them all. Either saving none, or saving all, could have been proposed, but either extreme leads to inefficiencies caused by copying the contents to memory (the stack). Choosing to allow some registers to be preserved and some not, reduces the average cost of a function call.

提交回复
热议问题