summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2020-06-18 20:33:04 -0400
committerGravatar Fernando Sahmkow2020-06-27 11:36:27 -0400
commitce350e7ce03b8d9e3e2c8ff8774f9b929a70047f (patch)
tree2777de79bcedb99e0c16d9db3891478beaae0aaf
parentARM: Update Dynarmic and Setup A32 according to latest interface. (diff)
downloadyuzu-ce350e7ce03b8d9e3e2c8ff8774f9b929a70047f.tar.gz
yuzu-ce350e7ce03b8d9e3e2c8ff8774f9b929a70047f.tar.xz
yuzu-ce350e7ce03b8d9e3e2c8ff8774f9b929a70047f.zip
SVC: Add GetCurrentProcessorNumber32, CreateTransferMemory32, SetMemoryAttribute32
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/svc.cpp29
-rw-r--r--src/core/hle/kernel/svc_wrap.h16
2 files changed, 39 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 5674d9558..1d47a2779 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -232,6 +232,12 @@ static ResultCode SetMemoryAttribute(Core::System& system, VAddr address, u64 si
232 static_cast<Memory::MemoryAttribute>(attribute)); 232 static_cast<Memory::MemoryAttribute>(attribute));
233} 233}
234 234
235static ResultCode SetMemoryAttribute32(Core::System& system, u32 address, u32 size, u32 mask,
236 u32 attribute) {
237 return SetMemoryAttribute(system, static_cast<VAddr>(address), static_cast<std::size_t>(size),
238 mask, attribute);
239}
240
235/// Maps a memory range into a different range. 241/// Maps a memory range into a different range.
236static ResultCode MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) { 242static ResultCode MapMemory(Core::System& system, VAddr dst_addr, VAddr src_addr, u64 size) {
237 std::lock_guard lock{HLE::g_hle_lock}; 243 std::lock_guard lock{HLE::g_hle_lock};
@@ -1136,7 +1142,7 @@ static ResultCode SetThreadPriority(Core::System& system, Handle handle, u32 pri
1136} 1142}
1137 1143
1138static ResultCode SetThreadPriority32(Core::System& system, Handle handle, u32 priority) { 1144static ResultCode SetThreadPriority32(Core::System& system, Handle handle, u32 priority) {
1139 return SetThreadPriority(system, handle, priority); 1145 return SetThreadPriority(system, handle, priority);
1140} 1146}
1141 1147
1142/// Get which CPU core is executing the current thread 1148/// Get which CPU core is executing the current thread
@@ -1145,6 +1151,10 @@ static u32 GetCurrentProcessorNumber(Core::System& system) {
1145 return static_cast<u32>(system.CurrentPhysicalCore().CoreIndex()); 1151 return static_cast<u32>(system.CurrentPhysicalCore().CoreIndex());
1146} 1152}
1147 1153
1154static u32 GetCurrentProcessorNumber32(Core::System& system) {
1155 return GetCurrentProcessorNumber(system);
1156}
1157
1148static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_handle, VAddr addr, 1158static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_handle, VAddr addr,
1149 u64 size, u32 permissions) { 1159 u64 size, u32 permissions) {
1150 std::lock_guard lock{HLE::g_hle_lock}; 1160 std::lock_guard lock{HLE::g_hle_lock};
@@ -1861,6 +1871,12 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* handle, VAd
1861 return RESULT_SUCCESS; 1871 return RESULT_SUCCESS;
1862} 1872}
1863 1873
1874static ResultCode CreateTransferMemory32(Core::System& system, Handle* handle, u32 addr, u32 size,
1875 u32 permissions) {
1876 return CreateTransferMemory(system, handle, static_cast<VAddr>(addr),
1877 static_cast<std::size_t>(size), permissions);
1878}
1879
1864static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle, u32* core, 1880static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle, u32* core,
1865 u64* mask) { 1881 u64* mask) {
1866 LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle); 1882 LOG_TRACE(Kernel_SVC, "called, handle=0x{:08X}", thread_handle);
@@ -1938,8 +1954,9 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle,
1938} 1954}
1939 1955
1940static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, u32 core, 1956static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, u32 core,
1941 u32 affinity_mask_low, u32 affinity_mask_high) { 1957 u32 affinity_mask_low, u32 affinity_mask_high) {
1942 const u64 affinity_mask = static_cast<u64>(affinity_mask_low) | (static_cast<u64>(affinity_mask_high) << 32); 1958 const u64 affinity_mask =
1959 static_cast<u64>(affinity_mask_low) | (static_cast<u64>(affinity_mask_high) << 32);
1943 return SetThreadCoreMask(system, thread_handle, core, affinity_mask); 1960 return SetThreadCoreMask(system, thread_handle, core, affinity_mask);
1944} 1961}
1945 1962
@@ -2206,7 +2223,7 @@ static const FunctionDef SVC_Table_32[] = {
2206 {0x00, nullptr, "Unknown"}, 2223 {0x00, nullptr, "Unknown"},
2207 {0x01, SvcWrap32<SetHeapSize32>, "SetHeapSize32"}, 2224 {0x01, SvcWrap32<SetHeapSize32>, "SetHeapSize32"},
2208 {0x02, nullptr, "Unknown"}, 2225 {0x02, nullptr, "Unknown"},
2209 {0x03, nullptr, "SetMemoryAttribute32"}, 2226 {0x03, SvcWrap32<SetMemoryAttribute32>, "SetMemoryAttribute32"},
2210 {0x04, nullptr, "MapMemory32"}, 2227 {0x04, nullptr, "MapMemory32"},
2211 {0x05, nullptr, "UnmapMemory32"}, 2228 {0x05, nullptr, "UnmapMemory32"},
2212 {0x06, SvcWrap32<QueryMemory32>, "QueryMemory32"}, 2229 {0x06, SvcWrap32<QueryMemory32>, "QueryMemory32"},
@@ -2219,12 +2236,12 @@ static const FunctionDef SVC_Table_32[] = {
2219 {0x0d, SvcWrap32<SetThreadPriority32>, "SetThreadPriority32"}, 2236 {0x0d, SvcWrap32<SetThreadPriority32>, "SetThreadPriority32"},
2220 {0x0e, nullptr, "GetThreadCoreMask32"}, 2237 {0x0e, nullptr, "GetThreadCoreMask32"},
2221 {0x0f, SvcWrap32<SetThreadCoreMask32>, "SetThreadCoreMask32"}, 2238 {0x0f, SvcWrap32<SetThreadCoreMask32>, "SetThreadCoreMask32"},
2222 {0x10, nullptr, "GetCurrentProcessorNumber32"}, 2239 {0x10, SvcWrap32<GetCurrentProcessorNumber32>, "GetCurrentProcessorNumber32"},
2223 {0x11, nullptr, "SignalEvent32"}, 2240 {0x11, nullptr, "SignalEvent32"},
2224 {0x12, nullptr, "ClearEvent32"}, 2241 {0x12, nullptr, "ClearEvent32"},
2225 {0x13, nullptr, "MapSharedMemory32"}, 2242 {0x13, nullptr, "MapSharedMemory32"},
2226 {0x14, nullptr, "UnmapSharedMemory32"}, 2243 {0x14, nullptr, "UnmapSharedMemory32"},
2227 {0x15, nullptr, "CreateTransferMemory32"}, 2244 {0x15, SvcWrap32<CreateTransferMemory32>, "CreateTransferMemory32"},
2228 {0x16, SvcWrap32<CloseHandle32>, "CloseHandle32"}, 2245 {0x16, SvcWrap32<CloseHandle32>, "CloseHandle32"},
2229 {0x17, nullptr, "ResetSignal32"}, 2246 {0x17, nullptr, "ResetSignal32"},
2230 {0x18, SvcWrap32<WaitSynchronization32>, "WaitSynchronization32"}, 2247 {0x18, SvcWrap32<WaitSynchronization32>, "WaitSynchronization32"},
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h
index fd4edba2a..ba90c354f 100644
--- a/src/core/hle/kernel/svc_wrap.h
+++ b/src/core/hle/kernel/svc_wrap.h
@@ -357,6 +357,12 @@ void SvcWrap32(Core::System& system) {
357 func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2)).raw); 357 func(system, Param32(system, 0), Param32(system, 1), Param32(system, 2)).raw);
358} 358}
359 359
360// Used by GetCurrentProcessorNumber32
361template <u32 func(Core::System&)>
362void SvcWrap32(Core::System& system) {
363 FuncReturn(system, func(system));
364}
365
360// Used by GetInfo32 366// Used by GetInfo32
361template <ResultCode func(Core::System&, u32*, u32*, u32, u32, u32, u32)> 367template <ResultCode func(Core::System&, u32*, u32*, u32, u32, u32, u32)>
362void SvcWrap32(Core::System& system) { 368void SvcWrap32(Core::System& system) {
@@ -423,6 +429,16 @@ void SvcWrap32(Core::System& system) {
423 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw); 429 FuncReturn(system, func(system, static_cast<u32>(Param(system, 0))).raw);
424} 430}
425 431
432// Used by CreateTransferMemory32
433template <ResultCode func(Core::System&, Handle*, u32, u32, u32)>
434void SvcWrap32(Core::System& system) {
435 Handle handle = 0;
436 const u32 retval =
437 func(system, &handle, Param32(system, 1), Param32(system, 2), Param32(system, 3)).raw;
438 system.CurrentArmInterface().SetReg(1, handle);
439 FuncReturn(system, retval);
440}
441
426// Used by WaitSynchronization32 442// Used by WaitSynchronization32
427template <ResultCode func(Core::System&, u32, u32, s32, u32, Handle*)> 443template <ResultCode func(Core::System&, u32, u32, s32, u32, Handle*)>
428void SvcWrap32(Core::System& system) { 444void SvcWrap32(Core::System& system) {