summaryrefslogtreecommitdiff
path: root/src/common/x64/abi.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/x64/abi.h')
-rw-r--r--src/common/x64/abi.h58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/common/x64/abi.h b/src/common/x64/abi.h
deleted file mode 100644
index eaaf81d89..000000000
--- a/src/common/x64/abi.h
+++ /dev/null
@@ -1,58 +0,0 @@
1// Copyright 2008 Dolphin Emulator Project
2// Licensed under GPLv2+
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/bit_set.h"
8#include "emitter.h"
9
10// x64 ABI:s, and helpers to help follow them when JIT-ing code.
11// All convensions return values in EAX (+ possibly EDX).
12
13// Windows 64-bit
14// * 4-reg "fastcall" variant, very new-skool stack handling
15// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself
16// calls_
17// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
18// Scratch: RAX RCX RDX R8 R9 R10 R11
19// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
20// Parameters: RCX RDX R8 R9, further MOV-ed
21
22// Linux 64-bit
23// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
24// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
25// Callee-save: RBX RBP R12 R13 R14 R15
26// Parameters: RDI RSI RDX RCX R8 R9
27
28#define ABI_ALL_FPRS BitSet32(0xffff0000)
29#define ABI_ALL_GPRS BitSet32(0x0000ffff)
30
31#ifdef _WIN32 // 64-bit Windows - the really exotic calling convention
32
33#define ABI_PARAM1 RCX
34#define ABI_PARAM2 RDX
35#define ABI_PARAM3 R8
36#define ABI_PARAM4 R9
37
38// xmm0-xmm15 use the upper 16 bits in the functions that push/pop registers.
39#define ABI_ALL_CALLER_SAVED \
40 (BitSet32{RAX, RCX, RDX, R8, R9, R10, R11, XMM0 + 16, XMM1 + 16, XMM2 + 16, XMM3 + 16, \
41 XMM4 + 16, XMM5 + 16})
42#else // 64-bit Unix / OS X
43
44#define ABI_PARAM1 RDI
45#define ABI_PARAM2 RSI
46#define ABI_PARAM3 RDX
47#define ABI_PARAM4 RCX
48#define ABI_PARAM5 R8
49#define ABI_PARAM6 R9
50
51// TODO: Avoid pushing all 16 XMM registers when possible. Most functions we call probably
52// don't actually clobber them.
53#define ABI_ALL_CALLER_SAVED (BitSet32{RAX, RCX, RDX, RDI, RSI, R8, R9, R10, R11} | ABI_ALL_FPRS)
54#endif // WIN32
55
56#define ABI_ALL_CALLEE_SAVED (~ABI_ALL_CALLER_SAVED)
57
58#define ABI_RETURN RAX