equal
deleted
inserted
replaced
|
1 .. -*- coding: utf-8; -*- |
|
2 .. include:: HEADER.rst |
|
3 |
|
4 ============ |
|
5 Binary ABI |
|
6 ============ |
|
7 .. contents:: |
|
8 :local: |
|
9 |
|
10 Caller vs callee |
|
11 ================ |
|
12 |
|
13 If routine A calls routine B then routine A is the caller and routine B is the |
|
14 callee. i.e. the caller is the routine which is calling the callee. |
|
15 |
|
16 The routine that initiates the call is the caller and the routine that is |
|
17 being called is is the callee. |
|
18 |
|
19 Argument vs parameter |
|
20 ===================== |
|
21 |
|
22 From the perspective of the caller the thing which is passed is an argument. |
|
23 From the perspective of the routine that receives the call, i.e. the callee, |
|
24 the thing which is passed is a parameter. |
|
25 |
|
26 Linkage convention |
|
27 ================== |
|
28 |
|
29 A linkage convention is computing term that means an agreement which is made |
|
30 between a caller and a callee. The agreement describes: |
|
31 |
|
32 - how the caller should pass parameters to the callee |
|
33 |
|
34 - what assumptions the callee is allowed to make about the values in the |
|
35 machine registers at the moment of the call |
|
36 |
|
37 - who should preserve registers which are modified by the callee and/or which |
|
38 are important to the caller so that their original values are available |
|
39 when the caller needs them |
|
40 |
|
41 - how and where registers should be preserved |
|
42 |
|
43 - how the callee knows where to return to when it is ready to return to the |
|
44 caller |
|
45 |
|
46 - how the callee returns a value to the caller if the routine is a function |
|
47 (as opposed to a subroutine which has no return value) |
|
48 |
|
49 - how a debugger will find the information necessary to obtain a stack trace |