2018-01-06 21:15:25 +00:00
|
|
|
/* This file is part of the dynarmic project.
|
|
|
|
* Copyright (c) 2018 MerryMage
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
|
|
|
* General Public License version 2 or any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "backend_x64/block_of_code.h"
|
|
|
|
#include "backend_x64/callback.h"
|
|
|
|
|
2018-01-26 13:51:48 +00:00
|
|
|
namespace Dynarmic::BackendX64 {
|
2018-01-06 21:15:25 +00:00
|
|
|
|
2018-02-09 15:58:16 +00:00
|
|
|
void SimpleCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) {
|
|
|
|
l({code.ABI_PARAM1, code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
2018-02-03 14:28:57 +00:00
|
|
|
code.CallFunction(fn);
|
2018-01-06 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 15:58:16 +00:00
|
|
|
void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) {
|
|
|
|
l(code.ABI_PARAM1, {code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
2018-02-03 14:28:57 +00:00
|
|
|
code.CallFunction(fn);
|
2018-01-06 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 15:58:16 +00:00
|
|
|
void ArgCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) {
|
|
|
|
l({code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
2018-02-03 14:28:57 +00:00
|
|
|
code.mov(code.ABI_PARAM1, arg);
|
|
|
|
code.CallFunction(fn);
|
2018-01-06 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2018-02-09 15:58:16 +00:00
|
|
|
void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) {
|
|
|
|
#if defined(WIN32) && !defined(__MINGW64__)
|
|
|
|
l(code.ABI_PARAM2, {code.ABI_PARAM3, code.ABI_PARAM4});
|
2018-02-03 14:28:57 +00:00
|
|
|
code.mov(code.ABI_PARAM1, arg);
|
2018-02-09 15:58:16 +00:00
|
|
|
#else
|
|
|
|
l(code.ABI_PARAM1, {code.ABI_PARAM3, code.ABI_PARAM4});
|
|
|
|
code.mov(code.ABI_PARAM2, arg);
|
|
|
|
#endif
|
2018-02-03 14:28:57 +00:00
|
|
|
code.CallFunction(fn);
|
2018-01-06 21:15:25 +00:00
|
|
|
}
|
|
|
|
|
2018-01-26 13:51:48 +00:00
|
|
|
} // namespace Dynarmic::BackendX64
|