Knowledge (XXG)

Calling convention

Source đź“ť

1169:* 1130 subroutine example ENT SUB Declare "SUB" an external entry point SUB DC 0 Reserved word at entry point, conventionally coded "DC *-*" * Subroutine code begins here * If there were arguments the addresses can be loaded indirectly from the return address LDX I 1 SUB Load X1 with the address of the first argument (for example) ... * Return sequence LD RES Load integer result into ACC * If no arguments were provided, indirect branch to the stored return address B I SUB If no arguments were provided END SUB 772:. However, space is always allocated by the called function to handle a potential register window overflow, local variables, and (on 32-bit SPARC) returning a struct by value. To call a function, one places the arguments for the function to be called in the "out" registers; when the function is called, the "out" registers become the "in" registers and the called function accesses the arguments in its "in" registers. When the called function completes, it places the return value in the first "in" register, which becomes the first "out" register when the called function returns. 1166:‍—‌usually these are one-word addresses of arguments‍—‌the called routine must know how many arguments to expect so that it can skip over them on return. Alternatively, arguments can be passed in registers. Function routines returned the result in ACC for real arguments, or in a memory location referred to as the Real Number Pseudo-Accumulator (FAC). Arguments and the return address were addressed using an offset to the IAR value stored in the first location of the subroutine. 683:
another routine and restore it before it returns, saving it by using the Move From Special Purpose Register instruction to move the link register to a general-purpose register and, if necessary, then saving it to the stack, and restoring it by, if it was saved to the stack, loading the saved link register value to a general-purpose register, and then using the Move To Special Purpose Register instruction to move the register containing the saved link-register value to the link register.
63:. There are design choices for how the tasks of preparing for a function call and restoring the environment after the function has completed are divided between the caller and the callee. Some calling convention specifies the way every function should get called. The correct calling convention should be used for every function call, to allow the correct and reliable execution of the whole program using these functions. 1314: 1218: 1286:, although other conventions may optionally be specified. The arguments are handled differently for different compilers and platforms, but typically the argument addresses are passed via an argument list in memory. A final, hidden, address may be passed pointing to an area to contain the return value. Because of the wide variety of data types supported by PL/I a 768:. There are 24 accessible registers in each register window: 8 are the "in" registers (%i0-%i7), 8 are the "local" registers (%l0-%l7), and 8 are the "out" registers (%o0-%o7). The "in" registers are used to pass arguments to the function being called, and any additional arguments need to be pushed onto the 725:) by Silicon Graphics is most commonly used. The most important improvement is that eight registers are now available for argument passing; It also increases the number of floating-point registers to 32. There is also an ILP32 version called N32, which uses 32-bit pointers for smaller code, analogous to the 310:
is used with many different calling conventions. Due to the small number of architectural registers, and historical focus on simplicity and small code-size, many x86 calling conventions pass arguments on the stack. The return value (or a pointer to it) is returned in a register. Some conventions use
732:
A few attempts have been made to replace O32 with a 32-bit ABI that resembles N32 more. A 1995 conference came up with MIPS EABI, for which the 32-bit version was quite similar. EABI inspired MIPS Technologies to propose a more radical "NUBI" ABI that additionally reuses argument registers for the
223:
Sometimes multiple calling conventions appear on a single platform; a given platform and language implementation may offer a choice of calling conventions. Reasons for this include performance, adaptation of conventions of other popular languages, and restrictions or conventions imposed by various
91:(API, as opposed to ABI), which is a separate though related concept to ABI and calling convention. The names of members within passed structures and objects would also be considered part of the API, and not ABI. Sometimes APIs do include keywords to specify the calling convention for functions. 682:
separate from the general-purpose registers; a routine returns to its caller with a branch instruction that uses the link register as the destination address. Leaf routines do not need to save or restore the link register; non-leaf routines must save the return address before making a call to
1203:
Threaded code passes all arguments on the stack. All return values are returned on the stack. This makes naive implementations slower than calling conventions that keep more values in registers. However, threaded code implementations that cache several of the top stack values in registers—in
713:
available to pass arguments. This perceived slowness, along with an antique floating-point model with 16 registers only, has encouraged the proliferation of many other calling conventions. The ABI took shape in 1990 and was never updated since 1994. It is only defined for 32-bit MIPS, but
1199:
Threaded code places all the responsibility for setting up for and cleaning up after a function call on the called code. The calling code does nothing but list the subroutines to be called. This puts all the function setup and clean-up code in one place—the prologue and epilogue of the
666:
calls. Additional arguments are passed on the stack, and space for register-based arguments is also always allocated on the stack as a convenience to the called function in case multi-level calls are used (recursive or otherwise) and the registers must be saved. This is also of use in
286:
Some languages allow the calling convention for a function to be explicitly specified with that function; other languages will have some calling convention but it will be hidden from the users of that language, and therefore will not typically be a consideration for the programmer.
54:
a result. When some code calls a function, design choices have been taken for where and how parameters are passed to that function, and where and how results are returned from that function, with these transfers typically done via certain registers or within a
813:
LA 1,ARGS Load argument list address L 15,=A(SUB) Load subroutine address BALR 14,15 Branch to called routine ... ARGS DC A(FIRST) Address of 1st argument DC A(SECOND) ... DC A(THIRD)+X'80000000' Last argument
131:, but most often are not considered part of it (or vice versa), as the evaluation strategy is usually defined on a higher abstraction level and seen as a part of the language rather than as a low-level implementation detail of a particular language's 537:
save the return address in the link register r14 to the stack before calling those other subroutines. However, such subroutines do not need to return that value to r14—they merely need to load that value into r15, the program counter, to return.
94:
Calling conventions do not typically include information on handling lifespan of dynamically-allocated structures and objects. Other supplementary documentation may state where the responsibility for freeing up allocated memory lies.
521:
If the type of value returned is too large to fit in r0 to r3, or whose size cannot be determined statically at compile time, then the caller must allocate space for that value at run time, and pass a pointer to that space in r0.
255:, reflecting their use for parameter passing in the standard calling convention. (RISC CPUs have many equivalent general-purpose registers so there's typically no hardware reason for giving them names other than numbers.) 1475: 210:
Where any static scope links for the routine's non-local data access are placed (typically at one or more positions in the stack frame, but sometimes in a general register, or, for some architectures, in special-purpose
871:
pointed to by register 13. The called routine provides its own save area for use by subroutines it calls; the address of this area is normally kept in register 13 throughout the routine. The instructions following
1450: 541:
The ARM calling convention mandates using a full-descending stack. In addition, the stack pointer must always be 4-byte aligned, and must always be 8-byte aligned at a function call with a public interface.
478:, AMD64, and Intel 64, has two calling sequences in common use. One calling sequence, defined by Microsoft, is used on Windows; the other calling sequence, specified in the AMD64 System V ABI, is used by 850:
instruction stores the address of the next instruction (return address) in the register specified by the first argument—register 14—and branches to the second argument address in register 15.
282:
will include additional platform-specific keywords that indicate the calling convention to be used. When handled correctly, the compiler will generate code to call functions in the appropriate manner.
853:
The caller passes the address of a list of argument addresses in register 1. The last address has the high-order bit set to indicate the end of the list. This limits programs using this convention to
207:
is stored, which is used to restore the stack frame when the subroutine ends. Options include within the call stack, or in a specific register. Sometimes frame pointers are not used at all.
357:
Typical callee structure: (some or all (except ret) of the instructions below may be optimized away in simple procedures). Some conventions leave the parameter space allocated, using plain
311:
registers for the first few parameters which may improve performance, especially for short and simple leaf-routines very frequently invoked (i.e. routines that do not call other routines).
1916: 830:
USING *,15 STM 14,12,12(13) Save registers ST 13,SAVE+4 Save caller's savearea addr LA 12,SAVE Chain saveareas ST 12,8(13) LR 13,12 ...
258:
The calling convention of a given program's language may differ from the calling convention of the underlying platform, OS, or of some library being linked to. For example, on
278:
calling convention. To accommodate these differences in calling convention, compilers often permit keywords that specify the calling convention for a given function. The
1839:
Although direct-threaded interpreters are known to have poor branch prediction properties... the latency of a call and return may be greater than an indirect jump.
168:
How return values are delivered from the callee back to the caller. Options include on the stack, in a register, or reference to something allocated on the heap.
1879: 786:-like systems follow, passes the first six arguments in "in" registers %i0 through %i5, reserving %i6 for the frame pointer and %i7 for the return address. 1909: 1328: 564:
In the epilogue, pull r4 to r11 from the stack, and pull the return address to the program counter r15. This can be done with a single LDM instruction.
174:
Which registers are guaranteed to have the same value when the callee returns as they did when the callee was called. These registers are said to be
1022:
First four words of integer arguments. The argument build area provides space into which R4 through R7 holding arguments may spill. Not preserved.
860:
The address of the called routine is in register 15. Normally this is loaded into another register and register 15 is not used as a base register.
165:) are handled. Options include just passed in order (presuming the first parameter is in an obvious position) or the variable parts in an array. 1204:
particular, the return address—are usually faster than subroutine calling conventions that always push and pop the return address to the stack.
549:
In the prologue, push r4 to r11 to the stack, and push the return address in r14 to the stack (this can be done with a single STM instruction);
1902: 171:
How long or complex values are handled, perhaps by splitting across multiple registers, within the stack frame, or with reference to memory.
98:
Calling conventions are unlikely to specify the layout of items within structures and objects, such as byte ordering or structure packing.
1436: 979: 189:
How the task of setting up for and cleaning up after a function call is divided between the caller and the callee. In particular, how the
1239: 994:
Return values. Temporary for expanding assembly pseudo-instructions. Implicit source/destination for 8/16-bit operations. Not preserved.
39: 1664: 642:
has a defined calling convention with two flavors, with or without floating point. It passes arguments in registers whenever possible.
1544: 1265: 675:, where the function's arguments need to be accessed as an array. A single calling convention is used for all procedural languages. 88: 1123:
was a small 16-bit word-addressable machine. It had only six registers plus condition indicators, and no stack. The registers are
47: 1200:
function—rather than in the many places that function is called. This makes threaded code the most compact calling convention.
1243: 593:
x18 (PR): Platform register. Used for some operating-system-specific special purpose, or an additional caller-saved register.
121: 1302:
are created for arguments which are constants or which do not agree with the type of argument the called procedure expects.
1135:, and three index registers X1–X3. The calling program is responsible for saving ACC, EXT, X1, and X2. There are two 1050:
Default frame pointer. (R8-R13 may also serve as frame pointer and leaf routines may use R1–R3 as frame pointer.) Preserved.
158:
The order in which parameters are passed. Options include left-to-right order, or right-to-left, or something more complex.
1697: 838:
L 13,SAVE+4 LM 14,12,12(13) L 15,RETVAL BR 14 Return to caller SAVE DS 18F Savearea
1159:) machine instruction that stores the address of the next instruction at its effective address (EA) and branches to EA+1. 486:. As x86-64 has more general-purpose registers than does 16-bit x86, both conventions pass some arguments in registers. 1925: 1290:
may also be passed to define, for example, the lengths of character or bit strings, the dimension and bounds of arrays (
894: 779: 698: 72: 558:
Do calculations and call other subroutines as necessary using BL, assuming r0 to r3, r12 and r14 will not be preserved;
1830: 1319: 525:
Subroutines must preserve the contents of r4 to r11 and the stack pointer (perhaps by saving them to the stack in the
1228: 2030: 1536: 1338: 1333: 1411: 1247: 1232: 901:, acquired either from the operating system and freed upon returning, or in storage passed by the calling program. 2025: 1994: 1517: 1942: 1884: 1649: 798:
is another architecture without a hardware stack. The examples below illustrate the calling convention used by
269: 1180:(all three computers were introduced in 1965) store the return address in the first location of a subroutine. 505:
r14: Link register. The BL instruction, used in a subroutine call, stores the return address in this register.
715: 469: 301: 274: 264: 1999: 1363: 890: 651: 1716: 662:
architectures have a large number of registers so most functions can pass all arguments in registers for
1085: 799: 231:
Many architectures only have one widely-used calling convention, often suggested by the architect. For
117: 984: 867:
instruction saves registers 14, 15, and 0 through 12 in a 72-byte area provided by the caller called a
2078: 2009: 279: 1974: 1957: 1387: 1283: 128: 1578: 941:
Floating-point registers 4 and 6 are for use by the callee, and must be saved and restored by them
101:
For some languages, the calling convention includes details of error or exception handling, (e.g.
2052: 2040: 1855: 1500: 225: 148: 239:, registers names based on this calling convention are often used. For example, MIPS registers 944:
In z/Architecture, floating-point registers 1, 3, 5, and 7 through 15 are for use by the callee
508:
r13: Stack pointer. The Push/Pop instructions in "Thumb" operating mode use this register only.
2057: 1867: 1635: 1619: 1540: 1136: 692: 668: 530: 526: 2035: 1343: 854: 495: 307: 51: 31: 1717:"Subroutines Continued: Passing Arguments, Returning Values and Allocating Local Variables" 1353: 1287: 765: 974: 929:
Registers 7 through 13 are for use by the callee, and must be saved and restored by them
517:
r0 to r3: Argument values passed to a subroutine and results returned from a subroutine.
2045: 1989: 1962: 1859: 1295: 910: 803: 795: 1782: 926:
Register 6 is used for parameter passing, and must be saved and restored by the callee
2072: 1979: 1894: 1348: 1194: 776: 679: 106: 1815: 1678: 876:
update forward and backward chains linking this save area to the caller's save area.
555:
Allocate other local variables to the remaining local scratch registers (r4 to r11);
1969: 1889: 1874: 806:; other operating systems for System/360 might have different calling conventions. 552:
Copy any passed arguments (in r0 to r3) to the local scratch registers (r4 to r11);
17: 1863: 1797: 938:
Floating-point registers 0 and 2 are used for parameter passing and return values
733:
return value. MIPS EABI is supported by GCC but not LLVM; neither supports NUBI.
2004: 1984: 1583: 1313: 1291: 1217: 722: 190: 102: 56: 1701: 1143:
to code non-relocatable subroutines directly linked with the main program, and
1952: 1563: 1309: 906: 769: 529:, then using them as scratch space, then restoring them from the stack in the 204: 152: 60: 43: 1864:"Computing Science Technical Report No. 102: The C Language Calling Sequence" 1721:
all registers except d0, d1, a0, a1 and a7 should be preserved across a call.
87:
The names or meanings of the parameters and return values are defined in the
659: 479: 624:
v0 to v7: Argument values passed to and results returned from a subroutine.
605:
x0 to x7: Argument values passed to and results returned from a subroutine.
627:
v8 to v15: callee-saved, but only the bottom 64 bits need to be preserved.
127:
Calling conventions may be related to a particular programming language's
1173: 1120: 1114: 1076:
Note: "preserved" reserves to callee saving; same goes for "guaranteed".
706: 197: 162: 132: 1736:
IBM 1130 Disk Monitor System, Version 2 System Introduction (C26-3709-0)
726: 655: 574: 483: 214:
For object-oriented languages, how the function's object is referenced
1762: 1734: 963: 639: 475: 236: 193:
is restored so the caller may continue after the callee has finished.
577:) calling convention allocates the 31 general-purpose registers as: 1098:
a6 is the frame pointer, which can be disabled by a compiler option
709:
ABI for MIPS. It is strictly stack-based, with only four registers
678:
Branch-and-link instructions store the return address in a special
584:
x30 (LR): Procedure link register, used to return from subroutines.
110: 1890:
Embedded Programming with the GNU Toolchain, Section 10. C Startup
1831:"Chapter 4: Design and Implementation of Efficient Interpretation" 1605: 1177: 920:
Registers 2 and 3 are used for parameter passing and return values
757: 748:(jump and link register) instructions. The stack grows downwards. 498:
calling convention allocates the 16 general-purpose registers as:
259: 1011:
Caller saved scratch. Structure address (caller save, by default)
581:
x31 (SP): Stack pointer or a zero register, depending on context.
1621:
System V Application Binary Interface SPARC Processor Supplement
1358: 1279: 822:
SUB EQU * This is the entry point of the subprogram
783: 761: 596:
x16 (IP0) and x17 (IP1): Intra-Procedure-call scratch registers.
502:
r15: Program counter (as per the instruction set specification).
232: 1898: 1211: 1064:
Serves as stack pointer or as a permanent register. Preserved.
736:
For all of O32 and N32/N64, the return address is stored in a
545:
This calling convention causes a "typical" ARM subroutine to:
620:
Similarly, the 32 floating-point registers are allocated as:
1798:"Moving Forth, Part 1: Design Decisions in the Forth Kernel" 1680:
XGCC: The Gnu C/C++ Language System for Embedded Development
705:
most commonly-used ABI, owing to its status as the original
1278:
The default calling convention for programs written in the
369:
in this example, or otherwise deal with the change to ESP.
533:). In particular, subroutines that call other subroutines 1698:"COLDFIRE/68K: ThreadX for the Freescale ColdFire Family" 470:
x86 calling conventions § x86-64 calling conventions
1101:
Parameters are pushed onto the stack, from right to left
740:
register. This is automatically set with the use of the
161:
How functions that take a variable number of arguments (
1686:. Embedded Support Tools Corporation. 2000. p. 59. 950:
Access registers 1 through 15 are for use by the callee
71:
Calling conventions are usually considered part of the
1783:"Subroutine and procedure call support: Early history" 1650:"zSeries ELF Application Binary Interface Supplement" 923:
Registers 4 and 5 are also used for parameter passing
474:
The 64-bit version of the x86 architecture, known as
1802:
On the 6809 or Zilog Super8, DTC is faster than STC.
879:
The return sequence restores the caller's registers.
2018: 1933: 1636:"S/390 ELF Application Binary Interface Supplement" 1163: 1156: 1144: 1140: 882:
Register 15 is usually used to pass a return value.
873: 864: 847: 745: 741: 737: 710: 672: 613:have a corresponding 32-bit register prefixed with 366: 362: 358: 252: 248: 244: 240: 1816:"Speed of various interpreter dispatch techniques" 1455:ARM Cortex-A Series Programmer’s Guide for ARMv8-A 1437:"Procedure Call Standard for the ARM Architecture" 1147:to call relocatable library subroutines through a 1476:"Parameters in NEON and floating-point registers" 1184:Calling conventions outside machine architectures 1885:Procedure Call Standard for the ARM Architecture 155:, a mix of both, or in other memory structures. 1835:YETI: a graduallY Extensible Trace Interpreter 954:Additional arguments are passed on the stack. 334:; pass some memory variable (FASM/TASM syntax) 147:Where parameters are placed. Options include 1910: 1008:Serves as temporary registers. Not preserved. 729:. Both run under the 64-bit mode of the CPU. 8: 1558: 1556: 1382: 1380: 947:Access register 0 is reserved for system use 693:MIPS architecture § Calling conventions 79:between the caller and the called function. 1246:. Unsourced material may be challenged and 1084:The most common calling convention for the 718:has created a 64-bit variation called O64. 511:r12: Intra-Procedure-call scratch register. 422:; perform calculations, leave result in EAX 1917: 1903: 1895: 1329:Comparison of application virtual machines 932:Register 14 is used for the return address 889:statically in the called routine makes it 630:v16 to v31: Local variables, caller saved. 1665:"SHARC (21k) and 68k Register Comparison" 1451:"Parameters in general-purpose registers" 1266:Learn how and when to remove this message 1036:Serves as permanent registers. Preserved. 599:x9 to x15: Local variables, caller saved. 1764:IBM 1130 Assembler Language (C26-5927-4) 1518:"MIPS32 Instruction Set Quick Reference" 967: 935:Register 15 is used as the stack pointer 721:For 64-bit, the N64 ABI (not related to 27:Ways subroutines get called in computers 1875:Introduction to assembly on the PowerPC 1376: 1092:d0, d1, a0 and a1 are scratch registers 602:x8 (XR): Indirect return value address. 219:Calling conventions within one platform 120:, there is an analogous concept called 897:; a reentrant program uses a dynamic 7: 1244:adding citations to reliable sources 1095:All other registers are callee-saved 1014:Variables/temporary. Not guaranteed 1000:Variables/temporary. Not guaranteed 802:prior to the introduction of 64-bit 143:Calling conventions may differ in: 109:) and for others, it does not (e.g. 1294:), or the layout and contents of a 482:systems and, with some changes, by 352:; the returned result is now in EAX 1577:Christopher, Eric (11 June 2003). 1125:Instruction Address Register (IAR) 617:. Thus, a 32-bit x0 is called w0. 458:; free parameter space and return. 365:. In that case, the caller could 262:, operating system calls have the 200:describing the arguments is passed 42:-level (low-level) scheme for how 25: 1056:Variables/temporary. Guaranteed. 1042:Variables/temporary. Guaranteed. 268:calling convention, whereas many 89:application programming interface 75:(ABI). They may be considered a 1880:Mac OS X ABI Function Call Guide 1312: 1216: 413:; reserve stack space for locals 272:programs that run there use the 203:Where the previous value of the 1151:. Both pseudo-ops resolve to a 1067:Stack Pointer, SP, callee saves 1053:Frame Pointer, FP, callee saves 1025:Parameter passing, caller saves 50:from their caller and how they 1412:"/Oy (Frame-Pointer Omission)" 1282:language passes all arguments 917:Registers 0 and 1 are volatile 1: 790:IBM System/360 and successors 646:POWER, PowerPC, and Power ISA 139:Different calling conventions 1926:Application binary interface 1104:Return value is stored in d0 609:All registers starting with 73:application binary interface 1860:Ritchie, Dennis MacAlistair 1501:"RISC-V calling convention" 1320:Computer programming portal 1133:Accumulator Extension (EXT) 1070:Stack pointer. Guaranteed. 1028:Arguments. Not guaranteed. 764:architectures, is built on 514:r4 to r11: Local variables. 449:; restore old frame pointer 325:; pass some register result 235:including SPARC, MIPS, and 2095: 2031:Foreign function interface 1537:Morgan Kaufmann Publishers 1339:Foreign function interface 1334:Continuation-passing style 1192: 1112: 997:Return value, caller saves 961: 834:Standard return sequence: 760:architecture, unlike most 690: 467: 306:The 32-bit version of the 299: 2026:Binary-code compatibility 1995:Position-independent code 1781:Smotherman, Mark (2004). 1579:"mips eabi documentation" 1172:Subroutines in IBM 1130, 1139:for calling subroutines, 826:Standard entry sequence: 590:x19 to x28: Callee-saved. 1829:Zaleski, Mathew (2008). 1761:IBM Corporation (1968). 1733:IBM Corporation (1967). 587:x29 (FP): Frame pointer. 383:; save old frame pointer 371: 316: 1856:Johnson, Stephen Curtis 440:; free space for locals 398:; get new frame pointer 302:x86 calling conventions 1364:Tail call optimization 118:Remote procedure calls 1388:"Calling Conventions" 1162:Arguments follow the 1086:Motorola 68000 series 800:OS/360 and successors 561:Put the result in r0; 280:function declarations 46:or functions receive 2010:Virtual method table 1240:improve this section 1153:Branch and Store IAR 913:ABI, used in Linux: 782:, which most modern 494:The standard 32-bit 343:; pass some constant 1975:Memory segmentation 1715:Moshovos, Andreas. 1531:Sweetman, Dominic. 1416:learn.microsoft.com 744:(jump and link) or 226:computing platforms 129:evaluation strategy 18:Calling conventions 1948:Calling convention 1862:(September 1981). 1564:"MIPS ABI History" 669:variadic functions 182:, so they are not 163:variadic functions 36:calling convention 2066: 2065: 2058:Year 2038 problem 1868:Bell Laboratories 1796:Rodriguez, Brad. 1770:. pp. 24–25. 1663:Smith, Dr. Mike. 1480:developer.arm.com 1276: 1275: 1268: 1137:pseudo-operations 1129:Accumulator (ACC) 1074: 1073: 809:Calling program: 531:function epilogue 527:function prologue 247:have "ABI names" 16:(Redirected from 2086: 2036:Language binding 1919: 1912: 1905: 1896: 1871: 1842: 1841: 1826: 1820: 1819: 1811: 1805: 1804: 1793: 1787: 1786: 1778: 1772: 1771: 1769: 1758: 1752: 1751: 1749: 1747: 1741: 1730: 1724: 1723: 1712: 1706: 1705: 1700:. Archived from 1694: 1688: 1687: 1685: 1675: 1669: 1668: 1660: 1654: 1653: 1646: 1640: 1639: 1632: 1626: 1625: 1616: 1610: 1609: 1602: 1596: 1595: 1593: 1591: 1574: 1568: 1567: 1560: 1551: 1550: 1528: 1522: 1521: 1514: 1508: 1507: 1505: 1497: 1491: 1490: 1488: 1486: 1472: 1466: 1465: 1463: 1461: 1447: 1441: 1440: 1433: 1427: 1426: 1424: 1423: 1408: 1402: 1401: 1399: 1398: 1384: 1344:Language binding 1322: 1317: 1316: 1271: 1264: 1260: 1257: 1251: 1220: 1212: 1165: 1158: 1146: 1142: 968: 900: 888: 875: 866: 849: 818:Called program: 766:register windows 747: 743: 739: 712: 674: 573:The 64-bit ARM ( 459: 456: 453: 450: 447: 444: 441: 438: 435: 432: 429: 426: 423: 420: 417: 414: 411: 408: 405: 402: 399: 396: 393: 390: 387: 384: 381: 378: 375: 368: 364: 360: 353: 350: 347: 344: 341: 338: 335: 332: 329: 326: 323: 320: 308:x86 architecture 254: 250: 246: 242: 196:Whether and how 83:Related concepts 32:computer science 21: 2094: 2093: 2089: 2088: 2087: 2085: 2084: 2083: 2069: 2068: 2067: 2062: 2014: 1935: 1929: 1923: 1854: 1851: 1846: 1845: 1828: 1827: 1823: 1813: 1812: 1808: 1795: 1794: 1790: 1780: 1779: 1775: 1767: 1760: 1759: 1755: 1745: 1743: 1739: 1732: 1731: 1727: 1714: 1713: 1709: 1696: 1695: 1691: 1683: 1677: 1676: 1672: 1662: 1661: 1657: 1648: 1647: 1643: 1634: 1633: 1629: 1618: 1617: 1613: 1604: 1603: 1599: 1589: 1587: 1576: 1575: 1571: 1562: 1561: 1554: 1547: 1530: 1529: 1525: 1516: 1515: 1511: 1503: 1499: 1498: 1494: 1484: 1482: 1474: 1473: 1469: 1459: 1457: 1449: 1448: 1444: 1435: 1434: 1430: 1421: 1419: 1418:. 3 August 2021 1410: 1409: 1405: 1396: 1394: 1386: 1385: 1378: 1373: 1368: 1354:Spaghetti stack 1318: 1311: 1308: 1300:Dummy arguments 1288:data descriptor 1272: 1261: 1255: 1252: 1237: 1221: 1210: 1197: 1191: 1186: 1170: 1149:transfer vector 1117: 1111: 1082: 966: 960: 898: 886: 840: 839: 832: 831: 824: 823: 816: 815: 792: 754: 695: 689: 648: 637: 571: 492: 472: 466: 461: 460: 457: 454: 451: 448: 445: 442: 439: 436: 433: 430: 427: 424: 421: 418: 415: 412: 409: 406: 403: 400: 397: 394: 391: 388: 385: 382: 379: 376: 373: 355: 354: 351: 348: 345: 342: 339: 336: 333: 330: 327: 324: 321: 318: 304: 298: 293: 221: 141: 85: 69: 28: 23: 22: 15: 12: 11: 5: 2092: 2090: 2082: 2081: 2071: 2070: 2064: 2063: 2061: 2060: 2055: 2050: 2049: 2048: 2038: 2033: 2028: 2022: 2020: 2019:Related topics 2016: 2015: 2013: 2012: 2007: 2002: 1997: 1992: 1990:Opaque pointer 1987: 1982: 1977: 1972: 1967: 1966: 1965: 1955: 1950: 1945: 1939: 1937: 1931: 1930: 1924: 1922: 1921: 1914: 1907: 1899: 1893: 1892: 1887: 1882: 1877: 1872: 1850: 1849:External links 1847: 1844: 1843: 1821: 1806: 1788: 1773: 1753: 1725: 1707: 1704:on 2015-10-02. 1689: 1670: 1655: 1641: 1627: 1611: 1597: 1586:(Mailing list) 1569: 1552: 1545: 1535:(2 ed.). 1523: 1509: 1492: 1467: 1442: 1428: 1403: 1392:cs.cornell.edu 1375: 1374: 1372: 1369: 1367: 1366: 1361: 1356: 1351: 1346: 1341: 1336: 1331: 1325: 1324: 1323: 1307: 1304: 1296:data structure 1274: 1273: 1224: 1222: 1215: 1209: 1206: 1193:Main article: 1190: 1187: 1185: 1182: 1168: 1113:Main article: 1110: 1107: 1106: 1105: 1102: 1099: 1096: 1093: 1081: 1078: 1072: 1071: 1068: 1065: 1062: 1058: 1057: 1054: 1051: 1048: 1044: 1043: 1040: 1037: 1034: 1030: 1029: 1026: 1023: 1020: 1016: 1015: 1012: 1009: 1006: 1002: 1001: 998: 995: 992: 988: 987: 982: 977: 975:Windows CE 5.0 972: 962:Main article: 959: 956: 952: 951: 948: 945: 942: 939: 936: 933: 930: 927: 924: 921: 918: 911:z/Architecture 903: 902: 883: 880: 877: 861: 858: 851: 837: 836: 829: 828: 821: 820: 812: 811: 804:z/Architecture 796:IBM System/360 791: 788: 753: 750: 691:Main article: 688: 685: 647: 644: 636: 633: 632: 631: 628: 625: 607: 606: 603: 600: 597: 594: 591: 588: 585: 582: 570: 567: 566: 565: 562: 559: 556: 553: 550: 519: 518: 515: 512: 509: 506: 503: 491: 488: 468:Main article: 465: 462: 372: 317: 314:Example call: 300:Main article: 297: 294: 292: 289: 260:32-bit Windows 220: 217: 216: 215: 212: 208: 201: 194: 187: 172: 169: 166: 159: 156: 140: 137: 84: 81: 68: 65: 40:implementation 26: 24: 14: 13: 10: 9: 6: 4: 3: 2: 2091: 2080: 2077: 2076: 2074: 2059: 2056: 2054: 2051: 2047: 2044: 2043: 2042: 2039: 2037: 2034: 2032: 2029: 2027: 2024: 2023: 2021: 2017: 2011: 2008: 2006: 2003: 2001: 1998: 1996: 1993: 1991: 1988: 1986: 1983: 1981: 1980:Name mangling 1978: 1976: 1973: 1971: 1968: 1964: 1961: 1960: 1959: 1956: 1954: 1951: 1949: 1946: 1944: 1941: 1940: 1938: 1932: 1927: 1920: 1915: 1913: 1908: 1906: 1901: 1900: 1897: 1891: 1888: 1886: 1883: 1881: 1878: 1876: 1873: 1869: 1865: 1861: 1857: 1853: 1852: 1848: 1840: 1836: 1832: 1825: 1822: 1817: 1814:Ertl, Anton. 1810: 1807: 1803: 1799: 1792: 1789: 1784: 1777: 1774: 1766: 1765: 1757: 1754: 1738: 1737: 1729: 1726: 1722: 1718: 1711: 1708: 1703: 1699: 1693: 1690: 1682: 1681: 1674: 1671: 1666: 1659: 1656: 1651: 1645: 1642: 1637: 1631: 1628: 1624:(3 ed.). 1623: 1622: 1615: 1612: 1607: 1601: 1598: 1585: 1584: 1580: 1573: 1570: 1565: 1559: 1557: 1553: 1548: 1546:0-12088-421-6 1542: 1538: 1534: 1527: 1524: 1519: 1513: 1510: 1502: 1496: 1493: 1481: 1477: 1471: 1468: 1456: 1452: 1446: 1443: 1438: 1432: 1429: 1417: 1413: 1407: 1404: 1393: 1389: 1383: 1381: 1377: 1370: 1365: 1362: 1360: 1357: 1355: 1352: 1350: 1349:Name mangling 1347: 1345: 1342: 1340: 1337: 1335: 1332: 1330: 1327: 1326: 1321: 1315: 1310: 1305: 1303: 1301: 1297: 1293: 1289: 1285: 1281: 1270: 1267: 1259: 1249: 1245: 1241: 1235: 1234: 1230: 1225:This section 1223: 1219: 1214: 1213: 1207: 1205: 1201: 1196: 1195:Threaded code 1189:Threaded code 1188: 1183: 1181: 1179: 1175: 1167: 1160: 1154: 1150: 1138: 1134: 1130: 1126: 1122: 1116: 1108: 1103: 1100: 1097: 1094: 1091: 1090: 1089: 1087: 1079: 1077: 1069: 1066: 1063: 1060: 1059: 1055: 1052: 1049: 1046: 1045: 1041: 1038: 1035: 1032: 1031: 1027: 1024: 1021: 1018: 1017: 1013: 1010: 1007: 1004: 1003: 999: 996: 993: 990: 989: 986: 983: 981: 978: 976: 973: 970: 969: 965: 957: 955: 949: 946: 943: 940: 937: 934: 931: 928: 925: 922: 919: 916: 915: 914: 912: 908: 896: 895:non-recursive 892: 891:non-reentrant 884: 881: 878: 870: 862: 859: 856: 852: 845: 844: 843: 835: 827: 819: 810: 807: 805: 801: 797: 789: 787: 785: 781: 778: 777:System V 773: 771: 767: 763: 759: 751: 749: 734: 730: 728: 724: 719: 717: 708: 704: 700: 694: 686: 684: 681: 680:link register 676: 670: 665: 661: 657: 653: 645: 643: 641: 634: 629: 626: 623: 622: 621: 618: 616: 612: 604: 601: 598: 595: 592: 589: 586: 583: 580: 579: 578: 576: 568: 563: 560: 557: 554: 551: 548: 547: 546: 543: 539: 536: 532: 528: 523: 516: 513: 510: 507: 504: 501: 500: 499: 497: 489: 487: 485: 481: 477: 471: 463: 370: 315: 312: 309: 303: 295: 291:Architectures 290: 288: 284: 281: 277: 276: 271: 267: 266: 261: 256: 238: 234: 229: 227: 218: 213: 209: 206: 205:frame pointer 202: 199: 195: 192: 188: 185: 181: 177: 173: 170: 167: 164: 160: 157: 154: 150: 146: 145: 144: 138: 136: 134: 130: 125: 123: 119: 114: 112: 108: 104: 99: 96: 92: 90: 82: 80: 78: 74: 66: 64: 62: 58: 53: 49: 45: 41: 37: 33: 19: 1970:Machine code 1947: 1838: 1834: 1824: 1809: 1801: 1791: 1776: 1763: 1756: 1744:. Retrieved 1742:. p. 67 1735: 1728: 1720: 1710: 1702:the original 1692: 1679: 1673: 1658: 1644: 1630: 1620: 1614: 1600: 1588:. Retrieved 1582: 1572: 1533:See MIPS Run 1532: 1526: 1512: 1495: 1483:. Retrieved 1479: 1470: 1458:. Retrieved 1454: 1445: 1431: 1420:. Retrieved 1415: 1406: 1395:. Retrieved 1391: 1299: 1292:dope vectors 1284:by reference 1277: 1262: 1253: 1238:Please help 1226: 1202: 1198: 1171: 1161: 1152: 1148: 1132: 1128: 1124: 1118: 1083: 1075: 1039:Callee Saves 953: 909:ABI and the 904: 885:Declaring a 868: 841: 833: 825: 817: 808: 793: 774: 755: 735: 731: 720: 702: 696: 677: 664:single level 663: 649: 638: 619: 614: 610: 608: 572: 544: 540: 534: 524: 520: 493: 473: 356: 313: 305: 296:x86 (32-bit) 285: 273: 263: 257: 230: 222: 183: 179: 175: 142: 126: 115: 100: 97: 93: 86: 76: 70: 67:Introduction 35: 29: 2079:Subroutines 2005:System call 1985:Object code 1936:conventions 1746:21 December 1485:13 November 1460:12 November 857:addressing. 723:Nintendo 64 361:instead of 191:stack frame 122:Marshalling 57:stack frame 44:subroutines 2000:Relocation 1953:Call stack 1422:2024-06-14 1397:2024-03-05 1371:References 907:System/390 671:, such as 635:RISC-V ISA 367:add esp,12 211:registers) 153:call stack 61:call stack 48:parameters 1943:Alignment 1227:does not 869:save area 711:$ a0-$ a3 660:Power ISA 569:ARM (A64) 490:ARM (A32) 480:Unix-like 455:paramsize 410:localsize 363:ret imm16 180:preserved 151:, on the 149:registers 2073:Category 1306:See also 1256:May 2016 1174:CDC 6600 1121:IBM 1130 1115:IBM 1130 1109:IBM 1130 971:Register 899:savearea 887:savearea 707:System V 697:The O32 673:printf() 251:through 243:through 198:metadata 184:volatile 133:compiler 77:contract 2046:dynamic 1958:Library 1590:19 June 1439:. 2021. 1248:removed 1233:sources 1033:R8..R13 985:Renesas 905:In the 842:Notes: 727:x32 ABI 656:PowerPC 575:AArch64 484:OpenVMS 265:stdcall 59:on the 2053:Loader 2041:Linker 1963:static 1934:Parts, 1606:"NUBI" 1543:  1019:R4..R7 1005:R1..R3 964:SuperH 958:SuperH 855:31-bit 658:, and 640:RISC-V 476:x86-64 464:x86-64 237:RISC-V 52:return 38:is an 1928:(ABI) 1768:(PDF) 1740:(PDF) 1684:(PDF) 1504:(PDF) 1178:PDP-8 770:stack 758:SPARC 752:SPARC 652:POWER 374:calc: 331:dword 275:cdecl 233:RISCs 228:". 176:saved 1748:2014 1592:2020 1541:ISBN 1487:2020 1462:2020 1359:SWIG 1280:PL/I 1231:any 1229:cite 1208:PL/I 1176:and 1145:LIBF 1141:CALL 1119:The 1088:is: 893:and 863:The 848:BALR 846:The 794:The 784:Unix 775:The 762:RISC 756:The 746:JALR 738:$ ra 687:MIPS 650:The 535:must 377:push 349:calc 346:call 337:push 328:push 319:push 253:$ a3 249:$ a0 116:For 113:). 107:Java 34:, a 1242:by 1164:BSI 1157:BSI 1080:68k 1061:R15 1047:R14 980:gcc 874:STM 865:STM 780:ABI 742:JAL 716:GCC 703:the 701:is 699:ABI 496:ARM 452:ret 446:EBP 443:pop 437:EBP 431:ESP 428:mov 404:ESP 401:sub 395:ESP 389:EBP 386:mov 380:EBP 359:ret 322:EAX 245:$ 7 241:$ 4 178:or 124:. 111:C++ 30:In 2075:: 1866:. 1858:; 1837:. 1833:. 1800:. 1719:. 1581:. 1555:^ 1539:. 1478:. 1453:. 1414:. 1390:. 1379:^ 1298:. 1131:, 1127:, 991:R0 654:, 135:. 105:, 103:Go 1918:e 1911:t 1904:v 1870:. 1818:. 1785:. 1750:. 1667:. 1652:. 1638:. 1608:. 1594:. 1566:. 1549:. 1520:. 1506:. 1489:. 1464:. 1425:. 1400:. 1269:) 1263:( 1258:) 1254:( 1250:. 1236:. 1155:( 615:w 611:x 434:, 425:. 419:. 416:. 407:, 392:, 340:3 270:C 224:" 186:. 20:)

Index

Calling conventions
computer science
implementation
subroutines
parameters
return
stack frame
call stack
application binary interface
application programming interface
Go
Java
C++
Remote procedure calls
Marshalling
evaluation strategy
compiler
registers
call stack
variadic functions
stack frame
metadata
frame pointer
computing platforms
RISCs
RISC-V
32-bit Windows
stdcall
C
cdecl

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑