summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar bunnei2018-04-04 16:50:12 -0400
committerGravatar GitHub2018-04-04 16:50:12 -0400
commit20bd26dc7d322cc6409c9e09ee6c8908658d3bbd (patch)
treec7a28e58e2b7cba62faa6e6989dc240f28f021c9 /src/core/hle/kernel
parentMerge pull request #306 from daniellimws/new-fmt-macros (diff)
parentsvc: Stub out SetThreadActivity, GetThreadContext. (diff)
downloadyuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.gz
yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.tar.xz
yuzu-20bd26dc7d322cc6409c9e09ee6c8908658d3bbd.zip
Merge pull request #308 from bunnei/misc-fixes-2
Implement and stub several SVC/VI/Audio/Friend/etc. funcs
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/shared_memory.cpp12
-rw-r--r--src/core/hle/kernel/svc.cpp16
-rw-r--r--src/core/hle/kernel/svc_wrap.h5
3 files changed, 19 insertions, 14 deletions
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index 88230bdd9..bc99993c8 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -120,18 +120,6 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi
120 return ERR_WRONG_PERMISSION; 120 return ERR_WRONG_PERMISSION;
121 } 121 }
122 122
123 // TODO(Subv): The same process that created a SharedMemory object
124 // can not map it in its own address space unless it was created with addr=0, result 0xD900182C.
125
126 if (address != 0) {
127 // TODO(shinyquagsire23): Check for virtual/mappable memory here too?
128 if (address >= Memory::HEAP_VADDR && address < Memory::HEAP_VADDR_END) {
129 LOG_ERROR(Kernel, "cannot map id=%u, address=0x%lx name=%s, invalid address",
130 GetObjectId(), address, name.c_str());
131 return ERR_INVALID_ADDRESS;
132 }
133 }
134
135 VAddr target_address = address; 123 VAddr target_address = address;
136 124
137 if (base_address == 0 && target_address == 0) { 125 if (base_address == 0 && target_address == 0) {
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 171bbd956..36ea23cd9 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -371,6 +371,18 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
371 return RESULT_SUCCESS; 371 return RESULT_SUCCESS;
372} 372}
373 373
374/// Sets the thread activity
375static ResultCode SetThreadActivity(Handle handle, u32 unknown) {
376 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, unknown=0x%08X", handle, unknown);
377 return RESULT_SUCCESS;
378}
379
380/// Gets the thread context
381static ResultCode GetThreadContext(Handle handle, VAddr addr) {
382 LOG_WARNING(Kernel_SVC, "(STUBBED) called, handle=0x%08X, addr=0x%" PRIx64, handle, addr);
383 return RESULT_SUCCESS;
384}
385
374/// Gets the priority for the specified thread 386/// Gets the priority for the specified thread
375static ResultCode GetThreadPriority(u32* priority, Handle handle) { 387static ResultCode GetThreadPriority(u32* priority, Handle handle) {
376 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle); 388 const SharedPtr<Thread> thread = g_handle_table.Get<Thread>(handle);
@@ -853,8 +865,8 @@ static const FunctionDef SVC_Table[] = {
853 {0x2F, nullptr, "GetLastThreadInfo"}, 865 {0x2F, nullptr, "GetLastThreadInfo"},
854 {0x30, nullptr, "GetResourceLimitLimitValue"}, 866 {0x30, nullptr, "GetResourceLimitLimitValue"},
855 {0x31, nullptr, "GetResourceLimitCurrentValue"}, 867 {0x31, nullptr, "GetResourceLimitCurrentValue"},
856 {0x32, nullptr, "SetThreadActivity"}, 868 {0x32, SvcWrap<SetThreadActivity>, "SetThreadActivity"},
857 {0x33, nullptr, "GetThreadContext"}, 869 {0x33, SvcWrap<GetThreadContext>, "GetThreadContext"},
858 {0x34, nullptr, "Unknown"}, 870 {0x34, nullptr, "Unknown"},
859 {0x35, nullptr, "Unknown"}, 871 {0x35, nullptr, "Unknown"},
860 {0x36, nullptr, "Unknown"}, 872 {0x36, nullptr, "Unknown"},
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h
index 5da4f5269..c86ad3e04 100644
--- a/src/core/hle/kernel/svc_wrap.h
+++ b/src/core/hle/kernel/svc_wrap.h
@@ -70,6 +70,11 @@ void SvcWrap() {
70 FuncReturn(retval); 70 FuncReturn(retval);
71} 71}
72 72
73template <ResultCode func(u32, u64)>
74void SvcWrap() {
75 FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), PARAM(1)).raw);
76}
77
73template <ResultCode func(u32, u32, u64)> 78template <ResultCode func(u32, u32, u64)>
74void SvcWrap() { 79void SvcWrap() {
75 FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), (u32)(PARAM(1) & 0xFFFFFFFF), PARAM(2)).raw); 80 FuncReturn(func((u32)(PARAM(0) & 0xFFFFFFFF), (u32)(PARAM(1) & 0xFFFFFFFF), PARAM(2)).raw);