@@ -48,22 +48,22 @@ <h1 class="sect0">Calling conventions</h1>
48
48
< div class ="paragraph ">
49
49
< p > A < strong > calling convention</ strong > is the set of contracts that compiler-generated machine
50
50
code respects and expects external functions to respect.
51
- The calling convention specifies, for example </ p >
51
+ Among other things, the calling convention specifies: </ p >
52
52
</ div >
53
53
< div class ="ulist ">
54
54
< ul >
55
55
< li >
56
- < p > how parameters are passed to functions</ p >
56
+ < p > how parameters are passed to functions; </ p >
57
57
</ li >
58
58
< li >
59
59
< p > how the stack is handled and cleaned (for example if needs to be aligned at
60
- function entry)</ p >
60
+ function entry); </ p >
61
61
</ li >
62
62
< li >
63
- < p > how structures are going to be laid out in memory</ p >
63
+ < p > how structures are going to be laid out in memory; </ p >
64
64
</ li >
65
65
< li >
66
- < p > which registers need to be restored by the caller and which by the callee</ p >
66
+ < p > which registers need to be restored by the caller and which by the callee. </ p >
67
67
</ li >
68
68
</ ul >
69
69
</ div >
@@ -74,8 +74,8 @@ <h2 id="_x86_64_calling_conventions">1. x86-64 calling conventions</h2>
74
74
< div class ="sectionbody ">
75
75
< div class ="paragraph ">
76
76
< p > The Windows (including UEFI) world and the UNIX (Linux, macOS, BSDs) world have
77
- adopted two different conventions. Note that MSVC can only generate code using
78
- the Windows calling convention.</ p >
77
+ adopted two different conventions.
78
+ Note that MSVC can only generate code using the Windows calling convention.</ p >
79
79
</ div >
80
80
< div class ="sect2 ">
81
81
< h3 id ="_microsoft_x64 "> 1.1. Microsoft x64</ h3 >
@@ -94,14 +94,14 @@ <h3 id="_microsoft_x64">1.1. Microsoft x64</h3>
94
94
</ div >
95
95
< div class ="paragraph ">
96
96
< p > The x87 register stack is unused.
97
- It may be used by the callee, but consider it volatile across function calls.
97
+ It may be used by the callee, but is considered volatile across function calls.
98
98
All floating point operations are done using the 16 XMM registers.</ p >
99
99
</ div >
100
100
< div class ="paragraph ">
101
- < p > Integer arguments are passed in registers RCX, RDX, R8, and R9. Floating point
101
+ < p > Integer arguments are passed in registers RCX, RDX, R8, and R9; floating point
102
102
arguments are passed in XMM0L, XMM1L, XMM2L, and XMM3L.
103
- 16-byte arguments are passed by reference. Parameter passing is described in
104
- detail in Parameter passing .
103
+ 16-byte arguments are passed by reference.
104
+ Parameter passing is described in detail in the parameter section .
105
105
These registers, and RAX, R10, R11, XMM4, and XMM5, are considered volatile.</ p >
106
106
</ div >
107
107
< div class ="sect3 ">
@@ -169,9 +169,9 @@ <h4 id="_parameters">1.1.3. Parameters</h4>
169
169
< div class ="sect3 ">
170
170
< h4 id ="_return_value "> 1.1.4. Return value</ h4 >
171
171
< div class ="paragraph ">
172
- < p > If the return value is an integer/ struct/ union whose size is less than or equal
173
- to 64 bits, it is returned in RAX; otherwise, the struct is allocated by the
174
- caller and a pointer to it is passed as the first parameter.</ p >
172
+ < p > If the return value is an integer, struct, or union whose size is less than or
173
+ equal to 64 bits, it is returned in RAX; otherwise, the struct is allocated by
174
+ the caller, and a pointer to it is passed as the first parameter.</ p >
175
175
</ div >
176
176
< div class ="listingblock ">
177
177
< div class ="content ">
@@ -270,11 +270,11 @@ <h4 id="_parameters_2">1.2.3. Parameters</h4>
270
270
< div class ="sect3 ">
271
271
< h4 id ="_return_value_2 "> 1.2.4. Return value</ h4 >
272
272
< div class ="paragraph ">
273
- < p > If the return value is an integer/ struct/ union whose size is less than or equal
274
- than 64 bits, it is returned in < code > RAX</ code > ; otherwise, the struct is allocated by the
275
- caller and a pointer to it is passed as the first parameter, similarly to the
273
+ < p > If the return value is an integer, struct, or union whose size is less than or
274
+ equal than 64 bits, it is returned in < code > RAX</ code > ; otherwise, the struct is allocated
275
+ by the caller and a pointer to it is passed as the first parameter, like the
276
276
Microsoft x64 ABI.
277
- Dissimilarly , the pointer is actually returned in < code > RAX</ code > upon return.</ p >
277
+ Unlike the Microsoft ABI , the pointer is actually returned in < code > RAX</ code > upon return.</ p >
278
278
</ div >
279
279
< div class ="listingblock ">
280
280
< div class ="content ">
@@ -320,7 +320,7 @@ <h4 id="_return_value_2">1.2.4. Return value</h4>
320
320
< a href ="https://stork-search.net/ "> Stork</ a > under the
321
321
Apache-2.0 license.
322
322
323
- < a href ="https://github.com/osdev-wiki/wiki/blob/cf5c2f840fb97429f5f778119267d9acef6b593d /pages/calling_conventions.adoc "> Source code</ a > .
323
+ < a href ="https://github.com/osdev-wiki/wiki/blob/fb70970fad59ae0e1d348804d826bff0801ea36a /pages/calling_conventions.adoc "> Source code</ a > .
324
324
325
325
326
326
</ footer >
0 commit comments