binary.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 05 Aug 2015 23:55:34 +0300
changeset 1729 22ffd80639c0
parent 209 c51f51e9a015
permissions -rw-r--r--
Make centered content design with adoption for mobile devices. Highlight TOC.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
207
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
-*- mode: outline; coding: utf-8 -*-
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
* Caller vs callee.
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
If routine A calls routine B then routine A is the caller and routine B is the
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
callee. i.e. the caller is the routine which is calling the callee.
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
The routine that initiates the call is the caller and the routine that is
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
being called is is the callee.
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
* Argument vs parameter.
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
From the perspective of the caller the thing which is passed is an argument.
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
From the perspective of the routine that receives the call, i.e. the callee,
be73a688eb22 Caller vs callee.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
the thing which is passed is a parameter.
209
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    16
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    17
* Linkage convention.
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    18
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    19
A linkage convention is computing term that means an agreement which is made
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    20
between a caller and a callee. The agreement describes:
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    21
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    22
 - how the caller should pass parameters to the callee
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    23
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    24
 - what assumptions the callee is allowed to make about the values in the
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    25
   machine registers at the moment of the call
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    26
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    27
 - who should preserve registers which are modified by the callee and/or which
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    28
   are important to the caller so that their original values are available
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    29
   when the caller needs them
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    30
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    31
 - how and where registers should be preserved
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    32
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    33
 - how the callee knows where to return to when it is ready to return to the
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    34
   caller
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    35
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    36
 - how the callee returns a value to the caller if the routine is a function
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    37
   (as opposed to a subroutine which has no return value)
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    38
c51f51e9a015 Linkage convention.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 207
diff changeset
    39
 - how a debugger will find the information necessary to obtain a stack trace