Article Preview
Buy Now
| Print: | |
| PDF: |
Intel corner
Calling conventions
Issue: 6.3 (March/April 2008)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 5,084
Starting Page Number: 41
RBD Number: 6320
Resource File(s): None
Related Web Link(s):
http://en.wikipedia.org/wiki/X86_calling_conventions
Known Limitations: None
Excerpt of article text...
In this article we discuss calling conventions. If a function is called in any programming language there must be some convention about how to call the function.
The calling convention defines how parameters are passed to the called function. Also it defines who cleans the stack when the function returns. The stack is the memory where functions store temporary data. If you declare a local variable in a method, this variable is put on the stack. The space for this variable is released when your method finishes.
Function parameters can be passed by registers or as parameters on the stack. Some calling conventions mix the two techniques depending on how many parameters are passed. The floating point and the integer registers are used depending on the values.
Several calling conventions exist as every combination of CPU (the processor) architectures, compiler, and operation systems has its favorite one. For example Pascal compilers prefer to pass parameters on the stack. Software on PowerPC CPUs uses all available registers (often more than 32) to pass parameters in those registers to save stack space and improve performance.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|







