summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-12-31 21:46:30 +0100
committerbunnei <bunneidev@gmail.com>2017-12-31 21:46:30 +0100
commitf24531b1a279e48cb119353132cee6642cb76fb4 (patch)
treeb57f94655d8365931cebcc153123663c5ba438c1 /src/core
parentsvc: Implement svcUnmapMemory. (diff)
downloadyuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar.gz
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar.bz2
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar.lz
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar.xz
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.tar.zst
yuzu-f24531b1a279e48cb119353132cee6642cb76fb4.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/function_wrappers.h222
1 files changed, 35 insertions, 187 deletions
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 5d6d0eb56..df2c3e843 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -1,4 +1,4 @@
-// Copyright 2014 Citra Emulator Project
+// Copyright 2017 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@@ -7,7 +7,6 @@
#include "common/common_types.h"
#include "core/arm/arm_interface.h"
#include "core/core.h"
-#include "core/hle/kernel/kernel.h"
#include "core/hle/result.h"
#include "core/hle/svc.h"
#include "core/memory.h"
@@ -17,7 +16,7 @@ namespace HLE {
#define PARAM(n) Core::CPU().GetReg(n)
/**
- * HLE a function return from the current ARM11 userland process
+ * HLE a function return from the current ARM userland process
* @param res Result to return
*/
static inline void FuncReturn(u64 res) {
@@ -32,112 +31,78 @@ void Wrap() {
FuncReturn(func(PARAM(0)).raw);
}
-template <ResultCode func(u32, u64, u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw);
-}
-
-template <ResultCode func(u64, u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1)).raw);
-}
-
-template <ResultCode func(u64, u64, u64)>
+template <ResultCode func(u32)>
void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw);
+ FuncReturn(func((u32)PARAM(0)).raw);
}
-template <ResultCode func(u64, u64, s64)>
+template <ResultCode func(u32, u32)>
void Wrap() {
- FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw);
+ FuncReturn(func((u32)PARAM(0), (u32)PARAM(1)).raw);
}
-template <ResultCode func(u64*, u64)>
+template <ResultCode func(u32*, u32)>
void Wrap() {
- u64 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1)).raw;
+ u32 param_1 = 0;
+ u32 retval = func(&param_1, (u32)PARAM(1)).raw;
Core::CPU().SetReg(1, param_1);
FuncReturn(retval);
}
-template <ResultCode func(u64*, u64, u64, u64)>
+template <ResultCode func(u32*, u64)>
void Wrap() {
- u64 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), PARAM(2), PARAM(3)).raw;
+ u32 param_1 = 0;
+ u32 retval = func(&param_1, PARAM(1)).raw;
Core::CPU().SetReg(1, param_1);
FuncReturn(retval);
}
-template <ResultCode func(u32, u32, u32, u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)).raw);
-}
-
-template <ResultCode func(u32*, u32, u32, u32, u32, u32)>
+template <ResultCode func(u64, u32)>
void Wrap() {
- u32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
+ FuncReturn(func(PARAM(0), (u32)PARAM(1)).raw);
}
-template <ResultCode func(u32*, u32, u32, u32, u32, s32)>
+template <ResultCode func(u64*, u64)>
void Wrap() {
- u32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)).raw;
+ u64 param_1 = 0;
+ u32 retval = func(&param_1, PARAM(1)).raw;
Core::CPU().SetReg(1, param_1);
FuncReturn(retval);
}
-template <ResultCode func(s32*, VAddr, s32, bool, s64)>
+template <ResultCode func(u32, u64, u32)>
void Wrap() {
- s32 param_1 = 0;
- s32 retval =
- func(&param_1, PARAM(1), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)))
- .raw;
-
- Core::CPU().SetReg(1, (u32)param_1);
- FuncReturn(retval);
+ FuncReturn(func((u32)PARAM(0), PARAM(1), (u32)PARAM(2)).raw);
}
-template <ResultCode func(s32*, VAddr, s32, u32)>
+template <ResultCode func(u64, u64, u64)>
void Wrap() {
- s32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), (s32)PARAM(2), PARAM(3)).raw;
-
- Core::CPU().SetReg(1, (u32)param_1);
- FuncReturn(retval);
+ FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw);
}
-template <ResultCode func(u32, u32, u32, u32, s64)>
+template <ResultCode func(u64, u64, s64)>
void Wrap() {
- FuncReturn(
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(5) << 32) | PARAM(4))).raw);
+ FuncReturn(func(PARAM(1), PARAM(2), (s64)PARAM(3)).raw);
}
-template <ResultCode func(u32, u64*)>
+template <ResultCode func(u64*, u64, u64, u64)>
void Wrap() {
u64 param_1 = 0;
- u32 retval = func(PARAM(0), &param_1).raw;
+ u32 retval = func(&param_1, PARAM(1), PARAM(2), PARAM(3)).raw;
Core::CPU().SetReg(1, param_1);
FuncReturn(retval);
}
-template <ResultCode func(u32*)>
+template <ResultCode func(u32*, u64, u64, u64, u32, s32)>
void Wrap() {
u32 param_1 = 0;
- u32 retval = func(&param_1).raw;
+ u32 retval =
+ func(&param_1, PARAM(1), PARAM(2), PARAM(3), (u32)PARAM(4), (s32)(PARAM(5) & 0xFFFFFFFF))
+ .raw;
Core::CPU().SetReg(1, param_1);
FuncReturn(retval);
}
-template <ResultCode func(u32, s64)>
-void Wrap() {
- s32 retval = func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))).raw;
-
- FuncReturn(retval);
-}
-
template <ResultCode func(MemoryInfo*, PageInfo*, u64)>
void Wrap() {
MemoryInfo memory_info = {};
@@ -153,120 +118,6 @@ void Wrap() {
FuncReturn(retval);
}
-template <ResultCode func(s32*, u32)>
-void Wrap() {
- s32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32, s32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), (s32)PARAM(1)).raw);
-}
-
-template <ResultCode func(u32*, u64)>
-void Wrap() {
- u32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32*, Kernel::Handle)>
-void Wrap() {
- u32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0)).raw);
-}
-
-template <ResultCode func(u32*, s32, s32)>
-void Wrap() {
- u32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), PARAM(2)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(s32*, u32, s32)>
-void Wrap() {
- s32 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), PARAM(2)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(s64*, u32, s32)>
-void Wrap() {
- s64 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), PARAM(2)).raw;
- Core::CPU().SetReg(1, (u32)param_1);
- Core::CPU().SetReg(2, (u32)(param_1 >> 32));
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32*, u32, u32, u32, u32)>
-void Wrap() {
- u32 param_1 = 0;
- // The last parameter is passed in R0 instead of R4
- u32 retval = func(&param_1, PARAM(1), PARAM(2), PARAM(3), PARAM(0)).raw;
- Core::CPU().SetReg(1, param_1);
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32, s64, s64)>
-void Wrap() {
- s64 param1 = ((u64)PARAM(3) << 32) | PARAM(2);
- s64 param2 = ((u64)PARAM(4) << 32) | PARAM(1);
- FuncReturn(func(PARAM(0), param1, param2).raw);
-}
-
-template <ResultCode func(s64*, Kernel::Handle, u32)>
-void Wrap() {
- s64 param_1 = 0;
- u32 retval = func(&param_1, PARAM(1), PARAM(2)).raw;
- Core::CPU().SetReg(1, (u32)param_1);
- Core::CPU().SetReg(2, (u32)(param_1 >> 32));
- FuncReturn(retval);
-}
-
-template <ResultCode func(Kernel::Handle, u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1)).raw);
-}
-
-template <ResultCode func(Kernel::Handle*, Kernel::Handle*, VAddr, u32)>
-void Wrap() {
- Kernel::Handle param_1 = 0;
- Kernel::Handle param_2 = 0;
- u32 retval = func(&param_1, &param_2, PARAM(2), PARAM(3)).raw;
- Core::CPU().SetReg(1, param_1);
- Core::CPU().SetReg(2, param_2);
- FuncReturn(retval);
-}
-
-template <ResultCode func(Kernel::Handle*, Kernel::Handle*)>
-void Wrap() {
- Kernel::Handle param_1 = 0;
- Kernel::Handle param_2 = 0;
- u32 retval = func(&param_1, &param_2).raw;
- Core::CPU().SetReg(1, param_1);
- Core::CPU().SetReg(2, param_2);
- FuncReturn(retval);
-}
-
-template <ResultCode func(u32, u32, u32)>
-void Wrap() {
- FuncReturn(func(PARAM(0), PARAM(1), PARAM(2)).raw);
-}
-
////////////////////////////////////////////////////////////////////////////////////////////////////
// Function wrappers that return type u32
@@ -276,24 +127,21 @@ void Wrap() {
}
////////////////////////////////////////////////////////////////////////////////////////////////////
-// Function wrappers that return type s64
+/// Function wrappers that return type void
-template <s64 func()>
+template <void func()>
void Wrap() {
- FuncReturn64(func());
+ func();
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-/// Function wrappers that return type void
-
template <void func(s64)>
void Wrap() {
- func(((s64)PARAM(1) << 32) | PARAM(0));
+ func((s64)PARAM(0));
}
-template <void func(VAddr, int len)>
+template <void func(u64, s32 len)>
void Wrap() {
- func(PARAM(0), PARAM(1));
+ func(PARAM(0), (s32)(PARAM(1) & 0xFFFFFFFF));
}
template <void func(u64, u64, u64)>