summaryrefslogtreecommitdiff
path: root/src/common/thunk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/thunk.h')
-rw-r--r--src/common/thunk.h42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/common/thunk.h b/src/common/thunk.h
deleted file mode 100644
index 533480056..000000000
--- a/src/common/thunk.h
+++ /dev/null
@@ -1,42 +0,0 @@
1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <map>
8
9#include "common/common_types.h"
10
11// This simple class creates a wrapper around a C/C++ function that saves all fp state
12// before entering it, and restores it upon exit. This is required to be able to selectively
13// call functions from generated code, without inflicting the performance hit and increase
14// of complexity that it means to protect the generated code from this problem.
15
16// This process is called thunking.
17
18// There will only ever be one level of thunking on the stack, plus,
19// we don't want to pollute the stack, so we store away regs somewhere global.
20// NOT THREAD SAFE. This may only be used from the CPU thread.
21// Any other thread using this stuff will be FATAL.
22
23class ThunkManager : public Gen::XCodeBlock
24{
25 std::map<void *, const u8 *> thunks;
26
27 const u8 *save_regs;
28 const u8 *load_regs;
29
30public:
31 ThunkManager() {
32 Init();
33 }
34 ~ThunkManager() {
35 Shutdown();
36 }
37 void *ProtectFunction(void *function, int num_params);
38private:
39 void Init();
40 void Shutdown();
41 void Reset();
42};