You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The [!INCLUDE[vcprx64](../assembler/inline/includes/vcprx64_md.md)] architecture provides for 16 general-purpose registers (hereafter referred to as integer registers) as well as 16 XMM/YMM registers available for floating-point use. Volatile registers are scratch registers presumed by the caller to be destroyed across a call. Nonvolatile registers are required to retain their values across a function call and must be saved by the callee if used.
15
-
16
-
The following table describes how each register is used across function calls:
17
-
18
-
||||
19
-
|-|-|-|
20
-
|Register|Status|Use|
21
-
|RAX|Volatile|Return value register|
22
-
|RCX|Volatile|First integer argument|
23
-
|RDX|Volatile|Second integer argument|
24
-
|R8|Volatile|Third integer argument|
25
-
|R9|Volatile|Fourth integer argument|
26
-
|R10:R11|Volatile|Must be preserved as needed by caller; used in syscall/sysret instructions|
27
-
|R12:R15|Nonvolatile|Must be preserved by callee|
28
-
|RDI|Nonvolatile|Must be preserved by callee|
29
-
|RSI|Nonvolatile|Must be preserved by callee|
30
-
|RBX|Nonvolatile|Must be preserved by callee|
31
-
|RBP|Nonvolatile|May be used as a frame pointer; must be preserved by callee|
32
-
|RSP|Nonvolatile|Stack pointer|
33
-
|XMM0, YMM0|Volatile|First FP argument; first vector-type argument when `__vectorcall` is used|
34
-
|XMM1, YMM1|Volatile|Second FP argument; second vector-type argument when `__vectorcall` is used|
35
-
|XMM2, YMM2|Volatile|Third FP argument; third vector-type argument when `__vectorcall` is used|
36
-
|XMM3, YMM3|Volatile|Fourth FP argument; fourth vector-type argument when `__vectorcall` is used|
37
-
|XMM4, YMM4|Volatile|Must be preserved as needed by caller; fifth vector-type argument when `__vectorcall` is used|
38
-
|XMM5, YMM5|Volatile|Must be preserved as needed by caller; sixth vector-type argument when `__vectorcall` is used|
39
-
|XMM6:XMM15, YMM6:YMM15|Nonvolatile (XMM), Volatile (upper half of YMM)|Must be preserved by callee. YMM registers must be preserved as needed by caller.|
The x64 architecture provides for 16 general-purpose registers (hereafter referred to as integer registers) as well as 16 XMM/YMM registers available for floating-point use. Volatile registers are scratch registers presumed by the caller to be destroyed across a call. Nonvolatile registers are required to retain their values across a function call and must be saved by the callee if used.
16
+
17
+
## Register volatility and preservation
18
+
19
+
The following table describes how each register is used across function calls:
20
+
21
+
||||
22
+
|-|-|-|
23
+
|Register|Status|Use|
24
+
|RAX|Volatile|Return value register|
25
+
|RCX|Volatile|First integer argument|
26
+
|RDX|Volatile|Second integer argument|
27
+
|R8|Volatile|Third integer argument|
28
+
|R9|Volatile|Fourth integer argument|
29
+
|R10:R11|Volatile|Must be preserved as needed by caller; used in syscall/sysret instructions|
30
+
|R12:R15|Nonvolatile|Must be preserved by callee|
31
+
|RDI|Nonvolatile|Must be preserved by callee|
32
+
|RSI|Nonvolatile|Must be preserved by callee|
33
+
|RBX|Nonvolatile|Must be preserved by callee|
34
+
|RBP|Nonvolatile|May be used as a frame pointer; must be preserved by callee|
35
+
|RSP|Nonvolatile|Stack pointer|
36
+
|XMM0, YMM0|Volatile|First FP argument; first vector-type argument when `__vectorcall` is used|
37
+
|XMM1, YMM1|Volatile|Second FP argument; second vector-type argument when `__vectorcall` is used|
38
+
|XMM2, YMM2|Volatile|Third FP argument; third vector-type argument when `__vectorcall` is used|
39
+
|XMM3, YMM3|Volatile|Fourth FP argument; fourth vector-type argument when `__vectorcall` is used|
40
+
|XMM4, YMM4|Volatile|Must be preserved as needed by caller; fifth vector-type argument when `__vectorcall` is used|
41
+
|XMM5, YMM5|Volatile|Must be preserved as needed by caller; sixth vector-type argument when `__vectorcall` is used|
42
+
|XMM6:XMM15, YMM6:YMM15|Nonvolatile (XMM), Volatile (upper half of YMM)|Must be preserved by callee. YMM registers must be preserved as needed by caller.|
43
+
44
+
On function exit and on function entry to C Runtime Library calls and Windows system calls, the direction flag in the CPU flags register is expected to be cleared.
0 commit comments