2014-04-11 05:28:28 +05:30
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2014-04-12 04:14:21 +05:30
|
|
|
#include <map>
|
2014-05-19 03:22:02 +05:30
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "common/symbols.h"
|
2014-04-12 04:14:21 +05:30
|
|
|
|
2014-04-18 08:35:31 +05:30
|
|
|
#include "core/mem_map.h"
|
|
|
|
|
2014-05-28 08:11:09 +05:30
|
|
|
#include "core/hle/kernel/event.h"
|
2014-05-17 23:17:44 +05:30
|
|
|
#include "core/hle/kernel/kernel.h"
|
2014-05-21 08:27:54 +05:30
|
|
|
#include "core/hle/kernel/mutex.h"
|
2014-05-17 23:17:44 +05:30
|
|
|
#include "core/hle/kernel/thread.h"
|
|
|
|
|
2014-04-11 05:28:28 +05:30
|
|
|
#include "core/hle/function_wrappers.h"
|
2014-05-21 03:58:38 +05:30
|
|
|
#include "core/hle/svc.h"
|
2014-04-13 07:25:36 +05:30
|
|
|
#include "core/hle/service/service.h"
|
2014-04-11 05:28:28 +05:30
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2014-05-21 03:58:38 +05:30
|
|
|
// Namespace SVC
|
2014-04-11 05:28:28 +05:30
|
|
|
|
2014-05-21 03:58:38 +05:30
|
|
|
namespace SVC {
|
2014-04-11 08:56:12 +05:30
|
|
|
|
2014-04-25 09:26:06 +05:30
|
|
|
enum ControlMemoryOperation {
|
|
|
|
MEMORY_OPERATION_HEAP = 0x00000003,
|
|
|
|
MEMORY_OPERATION_GSP_HEAP = 0x00010003,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MapMemoryPermission {
|
|
|
|
MEMORY_PERMISSION_UNMAP = 0x00000000,
|
|
|
|
MEMORY_PERMISSION_NORMAL = 0x00000001,
|
|
|
|
};
|
|
|
|
|
2014-04-18 08:35:31 +05:30
|
|
|
/// Map application or GSP heap memory
|
2014-06-02 06:18:29 +05:30
|
|
|
Result ControlMemory(void* _out_addr, u32 operation, u32 addr0, u32 addr1, u32 size, u32 permissions) {
|
|
|
|
u32* out_addr = (u32*)_out_addr;
|
2014-04-18 08:35:31 +05:30
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC,"called operation=0x%08X, addr0=0x%08X, addr1=0x%08X, size=%08X, permissions=0x%08X",
|
2014-05-07 09:04:20 +05:30
|
|
|
operation, addr0, addr1, size, permissions);
|
|
|
|
|
2014-04-18 08:35:31 +05:30
|
|
|
switch (operation) {
|
|
|
|
|
2014-04-25 09:26:06 +05:30
|
|
|
// Map normal heap memory
|
|
|
|
case MEMORY_OPERATION_HEAP:
|
2014-06-02 06:18:29 +05:30
|
|
|
*out_addr = Memory::MapBlock_Heap(size, operation, permissions);
|
2014-04-25 09:26:06 +05:30
|
|
|
break;
|
|
|
|
|
|
|
|
// Map GSP heap memory
|
|
|
|
case MEMORY_OPERATION_GSP_HEAP:
|
2014-06-02 06:18:29 +05:30
|
|
|
*out_addr = Memory::MapBlock_HeapGSP(size, operation, permissions);
|
2014-04-18 08:35:31 +05:30
|
|
|
break;
|
|
|
|
|
|
|
|
// Unknown ControlMemory operation
|
|
|
|
default:
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "unknown operation=0x%08X", operation);
|
2014-04-18 08:35:31 +05:30
|
|
|
}
|
2014-04-25 09:26:06 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Maps a memory block to specified address
|
|
|
|
Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherpermission) {
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called memblock=0x08X, addr=0x%08X, mypermissions=0x%08X, otherpermission=%d",
|
2014-05-07 09:04:20 +05:30
|
|
|
memblock, addr, mypermissions, otherpermission);
|
2014-04-25 09:26:06 +05:30
|
|
|
switch (mypermissions) {
|
|
|
|
case MEMORY_PERMISSION_NORMAL:
|
|
|
|
case MEMORY_PERMISSION_NORMAL + 1:
|
|
|
|
case MEMORY_PERMISSION_NORMAL + 2:
|
|
|
|
Memory::MapBlock_Shared(memblock, addr, mypermissions);
|
|
|
|
break;
|
|
|
|
default:
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(OSHLE, "unknown permissions=0x%08X", mypermissions);
|
2014-04-25 09:26:06 +05:30
|
|
|
}
|
2014-04-18 08:35:31 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-04-13 07:25:36 +05:30
|
|
|
/// Connect to an OS service given the port name, returns the handle to the port to out
|
2014-05-30 05:54:51 +05:30
|
|
|
Result ConnectToPort(void* _out, const char* port_name) {
|
2014-06-02 06:18:29 +05:30
|
|
|
Handle* out = (Handle*)_out;
|
2014-04-13 07:25:36 +05:30
|
|
|
Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
|
2014-06-02 06:18:29 +05:30
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called port_name=%s", port_name);
|
|
|
|
_assert_msg_(KERNEL, service, "called, but service is not implemented!");
|
2014-06-02 06:18:29 +05:30
|
|
|
|
|
|
|
*out = service->GetHandle();
|
|
|
|
|
2014-04-13 07:25:36 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Synchronize to an OS service
|
2014-05-19 07:54:26 +05:30
|
|
|
Result SendSyncRequest(Handle handle) {
|
2014-05-27 07:42:46 +05:30
|
|
|
bool wait = false;
|
2014-05-27 06:47:10 +05:30
|
|
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
|
2014-05-27 07:42:46 +05:30
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X", handle);
|
|
|
|
_assert_msg_(KERNEL, object, "called, but kernel object is NULL!");
|
2014-05-27 07:42:46 +05:30
|
|
|
|
|
|
|
Result res = object->SyncRequest(&wait);
|
|
|
|
if (wait) {
|
|
|
|
Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
2014-04-11 05:28:28 +05:30
|
|
|
}
|
|
|
|
|
2014-04-17 06:11:33 +05:30
|
|
|
/// Close a handle
|
|
|
|
Result CloseHandle(Handle handle) {
|
|
|
|
// ImplementMe
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called handle=0x%08X", handle);
|
2014-04-17 06:11:33 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Wait for a handle to synchronize, timeout after the specified nanoseconds
|
2014-05-18 09:07:25 +05:30
|
|
|
Result WaitSynchronization1(Handle handle, s64 nano_seconds) {
|
2014-05-28 08:11:09 +05:30
|
|
|
// TODO(bunnei): Do something with nano_seconds, currently ignoring this
|
|
|
|
bool wait = false;
|
|
|
|
|
|
|
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
|
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X, nanoseconds=%d", handle,
|
2014-05-28 08:11:09 +05:30
|
|
|
nano_seconds);
|
2014-05-30 08:56:58 +05:30
|
|
|
_assert_msg_(KERNEL, object, "called, but kernel object is NULL!");
|
2014-05-28 08:11:09 +05:30
|
|
|
|
|
|
|
Result res = object->WaitSynchronization(&wait);
|
|
|
|
|
|
|
|
if (wait) {
|
2014-06-02 07:12:50 +05:30
|
|
|
// Set current thread to wait state if handle was not unlocked
|
2014-05-28 08:11:09 +05:30
|
|
|
Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
|
2014-06-02 07:12:50 +05:30
|
|
|
|
|
|
|
// Check for next thread to schedule
|
|
|
|
HLE::Reschedule(__func__);
|
2014-06-01 20:07:19 +05:30
|
|
|
|
|
|
|
// Context switch - Function blocked, is not actually returning (will be "called" again)
|
|
|
|
|
|
|
|
// TODO(bunnei): This saves handle to R0 so that it's correctly reloaded on context switch
|
|
|
|
// (otherwise R0 will be set to whatever is returned, and handle will be invalid when this
|
|
|
|
// thread is resumed). There is probably a better way of keeping track of state so that we
|
|
|
|
// don't necessarily have to do this.
|
|
|
|
return (Result)PARAM(0);
|
2014-05-28 08:11:09 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
2014-05-18 09:07:25 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
|
2014-05-28 08:11:09 +05:30
|
|
|
Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wait_all,
|
|
|
|
s64 nano_seconds) {
|
|
|
|
// TODO(bunnei): Do something with nano_seconds, currently ignoring this
|
|
|
|
|
2014-05-18 09:07:25 +05:30
|
|
|
Handle* handles = (Handle*)_handles;
|
2014-05-28 08:11:09 +05:30
|
|
|
bool unlock_all = true;
|
2014-05-23 05:02:45 +05:30
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called handle_count=%d, wait_all=%s, nanoseconds=%d",
|
2014-05-19 03:22:02 +05:30
|
|
|
handle_count, (wait_all ? "true" : "false"), nano_seconds);
|
2014-05-23 05:02:45 +05:30
|
|
|
|
2014-05-28 08:11:09 +05:30
|
|
|
// Iterate through each handle, synchronize kernel object
|
2014-05-19 07:13:41 +05:30
|
|
|
for (u32 i = 0; i < handle_count; i++) {
|
2014-05-28 08:11:09 +05:30
|
|
|
bool wait = false;
|
|
|
|
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); // 0 handle
|
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
_assert_msg_(KERNEL, object, "called handle=0x%08X, but kernel object "
|
2014-05-28 08:11:09 +05:30
|
|
|
"is NULL!", handles[i]);
|
|
|
|
|
2014-05-30 05:54:51 +05:30
|
|
|
DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X", i, handles[i]);
|
|
|
|
|
2014-05-28 08:11:09 +05:30
|
|
|
Result res = object->WaitSynchronization(&wait);
|
|
|
|
|
|
|
|
if (!wait && !wait_all) {
|
|
|
|
Core::g_app_core->SetReg(1, i);
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
unlock_all = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wait_all && unlock_all) {
|
|
|
|
Core::g_app_core->SetReg(1, handle_count);
|
|
|
|
return 0;
|
2014-05-19 03:22:02 +05:30
|
|
|
}
|
2014-05-28 08:11:09 +05:30
|
|
|
|
|
|
|
// Set current thread to wait state if not all handles were unlocked
|
2014-05-23 05:06:56 +05:30
|
|
|
Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
|
2014-06-02 07:12:50 +05:30
|
|
|
|
|
|
|
// Check for next thread to schedule
|
|
|
|
HLE::Reschedule(__func__);
|
2014-05-28 08:11:09 +05:30
|
|
|
|
2014-06-01 20:07:19 +05:30
|
|
|
// Context switch - Function blocked, is not actually returning (will be "called" again)
|
|
|
|
|
|
|
|
// TODO(bunnei): This saves handle to R0 so that it's correctly reloaded on context switch
|
|
|
|
// (otherwise R0 will be set to whatever is returned, and handle will be invalid when this
|
|
|
|
// thread is resumed). There is probably a better way of keeping track of state so that we
|
|
|
|
// don't necessarily have to do this.
|
|
|
|
return (Result)PARAM(0);
|
2014-04-17 06:11:33 +05:30
|
|
|
}
|
|
|
|
|
2014-05-02 04:20:36 +05:30
|
|
|
/// Create an address arbiter (to allocate access to shared resources)
|
|
|
|
Result CreateAddressArbiter(void* arbiter) {
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called");
|
2014-05-19 03:22:02 +05:30
|
|
|
Core::g_app_core->SetReg(1, 0xFABBDADD);
|
2014-05-02 04:20:36 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 05:54:51 +05:30
|
|
|
/// Arbitrate address
|
|
|
|
Result ArbitrateAddress(Handle arbiter, u32 addr, u32 _type, u32 value, s64 nanoseconds) {
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called");
|
2014-05-30 05:54:51 +05:30
|
|
|
ArbitrationType type = (ArbitrationType)_type;
|
|
|
|
Memory::Write32(addr, type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-02 04:20:36 +05:30
|
|
|
/// Used to output a message on a debug hardware unit - does nothing on a retail unit
|
|
|
|
void OutputDebugString(const char* string) {
|
2014-05-30 08:34:18 +05:30
|
|
|
OS_LOG(SVC, "%s", string);
|
2014-05-07 09:04:20 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
/// Get resource limit
|
2014-06-02 06:18:29 +05:30
|
|
|
Result GetResourceLimit(void* _resource_limit, Handle process) {
|
2014-05-07 09:04:20 +05:30
|
|
|
// With regards to proceess values:
|
|
|
|
// 0xFFFF8001 is a handle alias for the current KProcess, and 0xFFFF8000 is a handle alias for
|
|
|
|
// the current KThread.
|
2014-06-02 06:18:29 +05:30
|
|
|
Handle* resource_limit = (Handle*)_resource_limit;
|
|
|
|
*resource_limit = 0xDEADBEEF;
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called process=0x%08X", process);
|
2014-05-07 09:04:20 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Get resource limit current values
|
2014-05-30 08:56:58 +05:30
|
|
|
Result GetResourceLimitCurrentValues(void* _values, Handle resource_limit, void* names,
|
|
|
|
s32 name_count) {
|
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called resource_limit=%08X, names=%s, name_count=%d",
|
2014-05-07 09:04:20 +05:30
|
|
|
resource_limit, names, name_count);
|
|
|
|
Memory::Write32(Core::g_app_core->GetReg(0), 0); // Normmatt: Set used memory to 0 for now
|
|
|
|
return 0;
|
2014-05-02 04:20:36 +05:30
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Creates a new thread
|
2014-05-21 09:06:35 +05:30
|
|
|
Result CreateThread(u32 priority, u32 entry_point, u32 arg, u32 stack_top, u32 processor_id) {
|
2014-05-17 23:17:44 +05:30
|
|
|
std::string name;
|
2014-05-16 03:55:56 +05:30
|
|
|
if (Symbols::HasSymbol(entry_point)) {
|
|
|
|
TSymbol symbol = Symbols::GetSymbol(entry_point);
|
2014-05-17 23:17:44 +05:30
|
|
|
name = symbol.name;
|
2014-05-16 03:55:56 +05:30
|
|
|
} else {
|
|
|
|
char buff[100];
|
2014-05-17 23:17:44 +05:30
|
|
|
sprintf(buff, "%s", "unknown-%08X", entry_point);
|
|
|
|
name = buff;
|
2014-05-14 07:28:26 +05:30
|
|
|
}
|
2014-05-17 23:17:44 +05:30
|
|
|
|
2014-05-23 05:02:45 +05:30
|
|
|
Handle thread = Kernel::CreateThread(name.c_str(), entry_point, priority, arg, processor_id,
|
2014-05-17 23:17:44 +05:30
|
|
|
stack_top);
|
2014-05-21 09:06:35 +05:30
|
|
|
|
|
|
|
Core::g_app_core->SetReg(1, thread);
|
2014-05-22 07:11:40 +05:30
|
|
|
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called entrypoint=0x%08X (%s), arg=0x%08X, stacktop=0x%08X, "
|
2014-05-30 05:54:51 +05:30
|
|
|
"threadpriority=0x%08X, processorid=0x%08X : created handle=0x%08X", entry_point,
|
2014-05-22 07:11:40 +05:30
|
|
|
name.c_str(), arg, stack_top, priority, processor_id, thread);
|
2014-05-19 03:22:02 +05:30
|
|
|
|
2014-05-14 07:28:26 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-06-02 07:42:54 +05:30
|
|
|
/// Gets the priority for the specified thread
|
|
|
|
Result GetThreadPriority(void* _priority, Handle handle) {
|
|
|
|
s32* priority = (s32*)_priority;
|
|
|
|
*priority = Kernel::GetThreadPriority(handle);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Sets the priority for the specified thread
|
|
|
|
Result SetThreadPriority(Handle handle, s32 priority) {
|
|
|
|
return Kernel::SetThreadPriority(handle, priority);
|
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Create a mutex
|
2014-05-14 07:28:26 +05:30
|
|
|
Result CreateMutex(void* _mutex, u32 initial_locked) {
|
2014-06-02 06:18:29 +05:30
|
|
|
Handle* mutex = (Handle*)_mutex;
|
|
|
|
*mutex = Kernel::CreateMutex((initial_locked != 0));
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called initial_locked=%s : created handle=0x%08X",
|
2014-06-02 06:18:29 +05:30
|
|
|
initial_locked ? "true" : "false", *mutex);
|
2014-05-14 07:28:26 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Release a mutex
|
2014-05-14 07:28:26 +05:30
|
|
|
Result ReleaseMutex(Handle handle) {
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called handle=0x%08X", handle);
|
|
|
|
_assert_msg_(KERNEL, handle, "called, but handle is NULL!");
|
2014-05-21 08:33:45 +05:30
|
|
|
Kernel::ReleaseMutex(handle);
|
2014-05-14 07:28:26 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Get current thread ID
|
2014-05-16 05:47:30 +05:30
|
|
|
Result GetThreadId(void* thread_id, u32 thread) {
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called thread=0x%08X", thread);
|
2014-05-16 05:47:30 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Query memory
|
2014-05-16 05:47:30 +05:30
|
|
|
Result QueryMemory(void *_info, void *_out, u32 addr) {
|
2014-05-30 08:56:58 +05:30
|
|
|
ERROR_LOG(SVC, "(UNIMPLEMENTED) called addr=0x%08X", addr);
|
2014-05-16 05:47:30 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-21 08:27:54 +05:30
|
|
|
/// Create an event
|
2014-05-19 03:22:02 +05:30
|
|
|
Result CreateEvent(void* _event, u32 reset_type) {
|
2014-06-02 06:18:29 +05:30
|
|
|
Handle* evt = (Handle*)_event;
|
|
|
|
*evt = Kernel::CreateEvent((ResetType)reset_type);
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called reset_type=0x%08X : created handle=0x%08X",
|
2014-06-02 06:18:29 +05:30
|
|
|
reset_type, *evt);
|
2014-05-19 03:22:02 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-27 06:25:48 +05:30
|
|
|
/// Duplicates a kernel handle
|
|
|
|
Result DuplicateHandle(void* _out, Handle handle) {
|
|
|
|
Handle* out = (Handle*)_out;
|
2014-06-02 07:42:54 +05:30
|
|
|
ERROR_LOG(SVC, "called handle=0x%08X", handle);
|
|
|
|
|
|
|
|
// Translate kernel handles -> real handles
|
|
|
|
if (handle == Kernel::CurrentThread) {
|
|
|
|
handle = Kernel::GetCurrentThreadHandle();
|
|
|
|
}
|
|
|
|
_assert_msg_(KERNEL, (handle != Kernel::CurrentProcess),
|
|
|
|
"(UNIMPLEMENTED) process handle duplication!");
|
|
|
|
|
|
|
|
// TODO(bunnei): FixMe - This is a hack to return the handle that we were asked to duplicate.
|
|
|
|
*out = handle;
|
|
|
|
|
2014-05-27 06:25:48 +05:30
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-05-30 05:54:51 +05:30
|
|
|
/// Clears an event
|
|
|
|
Result ClearEvent(Handle evt) {
|
|
|
|
Result res = Kernel::ClearEvent(evt);
|
2014-05-30 08:56:58 +05:30
|
|
|
DEBUG_LOG(SVC, "called event=0x%08X", evt);
|
2014-05-30 05:54:51 +05:30
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2014-06-01 20:07:19 +05:30
|
|
|
/// Sleep the current thread
|
|
|
|
void SleepThread(s64 nanoseconds) {
|
|
|
|
DEBUG_LOG(SVC, "called nanoseconds=%d", nanoseconds);
|
|
|
|
}
|
|
|
|
|
2014-05-21 03:58:38 +05:30
|
|
|
const HLE::FunctionDef SVC_Table[] = {
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x00, NULL, "Unknown"},
|
2014-05-14 07:28:26 +05:30
|
|
|
{0x01, WrapI_VUUUUU<ControlMemory>, "ControlMemory"},
|
2014-05-16 05:47:30 +05:30
|
|
|
{0x02, WrapI_VVU<QueryMemory>, "QueryMemory"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x03, NULL, "ExitProcess"},
|
|
|
|
{0x04, NULL, "GetProcessAffinityMask"},
|
|
|
|
{0x05, NULL, "SetProcessAffinityMask"},
|
|
|
|
{0x06, NULL, "GetProcessIdealProcessor"},
|
|
|
|
{0x07, NULL, "SetProcessIdealProcessor"},
|
2014-05-21 09:06:35 +05:30
|
|
|
{0x08, WrapI_UUUUU<CreateThread>, "CreateThread"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x09, NULL, "ExitThread"},
|
2014-06-01 20:07:19 +05:30
|
|
|
{0x0A, WrapV_S64<SleepThread>, "SleepThread"},
|
2014-06-02 07:42:54 +05:30
|
|
|
{0x0B, WrapI_VU<GetThreadPriority>, "GetThreadPriority"},
|
|
|
|
{0x0C, WrapI_UI<SetThreadPriority>, "SetThreadPriority"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x0D, NULL, "GetThreadAffinityMask"},
|
|
|
|
{0x0E, NULL, "SetThreadAffinityMask"},
|
|
|
|
{0x0F, NULL, "GetThreadIdealProcessor"},
|
|
|
|
{0x10, NULL, "SetThreadIdealProcessor"},
|
|
|
|
{0x11, NULL, "GetCurrentProcessorNumber"},
|
|
|
|
{0x12, NULL, "Run"},
|
2014-05-14 07:28:26 +05:30
|
|
|
{0x13, WrapI_VU<CreateMutex>, "CreateMutex"},
|
|
|
|
{0x14, WrapI_U<ReleaseMutex>, "ReleaseMutex"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x15, NULL, "CreateSemaphore"},
|
|
|
|
{0x16, NULL, "ReleaseSemaphore"},
|
2014-05-19 03:22:02 +05:30
|
|
|
{0x17, WrapI_VU<CreateEvent>, "CreateEvent"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x18, NULL, "SignalEvent"},
|
2014-05-30 05:54:51 +05:30
|
|
|
{0x19, WrapI_U<ClearEvent>, "ClearEvent"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x1A, NULL, "CreateTimer"},
|
|
|
|
{0x1B, NULL, "SetTimer"},
|
|
|
|
{0x1C, NULL, "CancelTimer"},
|
|
|
|
{0x1D, NULL, "ClearTimer"},
|
|
|
|
{0x1E, NULL, "CreateMemoryBlock"},
|
|
|
|
{0x1F, WrapI_UUUU<MapMemoryBlock>, "MapMemoryBlock"},
|
|
|
|
{0x20, NULL, "UnmapMemoryBlock"},
|
|
|
|
{0x21, WrapI_V<CreateAddressArbiter>, "CreateAddressArbiter"},
|
2014-05-30 05:54:51 +05:30
|
|
|
{0x22, WrapI_UUUUS64<ArbitrateAddress>, "ArbitrateAddress"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x23, WrapI_U<CloseHandle>, "CloseHandle"},
|
|
|
|
{0x24, WrapI_US64<WaitSynchronization1>, "WaitSynchronization1"},
|
2014-05-18 09:07:25 +05:30
|
|
|
{0x25, WrapI_VVUUS64<WaitSynchronizationN>, "WaitSynchronizationN"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x26, NULL, "SignalAndWait"},
|
2014-05-27 06:25:48 +05:30
|
|
|
{0x27, WrapI_VU<DuplicateHandle>, "DuplicateHandle"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x28, NULL, "GetSystemTick"},
|
|
|
|
{0x29, NULL, "GetHandleInfo"},
|
|
|
|
{0x2A, NULL, "GetSystemInfo"},
|
|
|
|
{0x2B, NULL, "GetProcessInfo"},
|
|
|
|
{0x2C, NULL, "GetThreadInfo"},
|
|
|
|
{0x2D, WrapI_VC<ConnectToPort>, "ConnectToPort"},
|
|
|
|
{0x2E, NULL, "SendSyncRequest1"},
|
|
|
|
{0x2F, NULL, "SendSyncRequest2"},
|
|
|
|
{0x30, NULL, "SendSyncRequest3"},
|
|
|
|
{0x31, NULL, "SendSyncRequest4"},
|
|
|
|
{0x32, WrapI_U<SendSyncRequest>, "SendSyncRequest"},
|
|
|
|
{0x33, NULL, "OpenProcess"},
|
|
|
|
{0x34, NULL, "OpenThread"},
|
|
|
|
{0x35, NULL, "GetProcessId"},
|
|
|
|
{0x36, NULL, "GetProcessIdOfThread"},
|
2014-05-16 05:47:30 +05:30
|
|
|
{0x37, WrapI_VU<GetThreadId>, "GetThreadId"},
|
2014-05-07 09:04:20 +05:30
|
|
|
{0x38, WrapI_VU<GetResourceLimit>, "GetResourceLimit"},
|
|
|
|
{0x39, NULL, "GetResourceLimitLimitValues"},
|
|
|
|
{0x3A, WrapI_VUVI<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
|
|
|
|
{0x3B, NULL, "GetThreadContext"},
|
|
|
|
{0x3C, NULL, "Break"},
|
|
|
|
{0x3D, WrapV_C<OutputDebugString>, "OutputDebugString"},
|
|
|
|
{0x3E, NULL, "ControlPerformanceCounter"},
|
|
|
|
{0x3F, NULL, "Unknown"},
|
|
|
|
{0x40, NULL, "Unknown"},
|
|
|
|
{0x41, NULL, "Unknown"},
|
|
|
|
{0x42, NULL, "Unknown"},
|
|
|
|
{0x43, NULL, "Unknown"},
|
|
|
|
{0x44, NULL, "Unknown"},
|
|
|
|
{0x45, NULL, "Unknown"},
|
|
|
|
{0x46, NULL, "Unknown"},
|
|
|
|
{0x47, NULL, "CreatePort"},
|
|
|
|
{0x48, NULL, "CreateSessionToPort"},
|
|
|
|
{0x49, NULL, "CreateSession"},
|
|
|
|
{0x4A, NULL, "AcceptSession"},
|
|
|
|
{0x4B, NULL, "ReplyAndReceive1"},
|
|
|
|
{0x4C, NULL, "ReplyAndReceive2"},
|
|
|
|
{0x4D, NULL, "ReplyAndReceive3"},
|
|
|
|
{0x4E, NULL, "ReplyAndReceive4"},
|
|
|
|
{0x4F, NULL, "ReplyAndReceive"},
|
|
|
|
{0x50, NULL, "BindInterrupt"},
|
|
|
|
{0x51, NULL, "UnbindInterrupt"},
|
|
|
|
{0x52, NULL, "InvalidateProcessDataCache"},
|
|
|
|
{0x53, NULL, "StoreProcessDataCache"},
|
|
|
|
{0x54, NULL, "FlushProcessDataCache"},
|
|
|
|
{0x55, NULL, "StartInterProcessDma"},
|
|
|
|
{0x56, NULL, "StopDma"},
|
|
|
|
{0x57, NULL, "GetDmaState"},
|
|
|
|
{0x58, NULL, "RestartDma"},
|
|
|
|
{0x59, NULL, "Unknown"},
|
|
|
|
{0x5A, NULL, "Unknown"},
|
|
|
|
{0x5B, NULL, "Unknown"},
|
|
|
|
{0x5C, NULL, "Unknown"},
|
|
|
|
{0x5D, NULL, "Unknown"},
|
|
|
|
{0x5E, NULL, "Unknown"},
|
|
|
|
{0x5F, NULL, "Unknown"},
|
|
|
|
{0x60, NULL, "DebugActiveProcess"},
|
|
|
|
{0x61, NULL, "BreakDebugProcess"},
|
|
|
|
{0x62, NULL, "TerminateDebugProcess"},
|
|
|
|
{0x63, NULL, "GetProcessDebugEvent"},
|
|
|
|
{0x64, NULL, "ContinueDebugEvent"},
|
|
|
|
{0x65, NULL, "GetProcessList"},
|
|
|
|
{0x66, NULL, "GetThreadList"},
|
|
|
|
{0x67, NULL, "GetDebugThreadContext"},
|
|
|
|
{0x68, NULL, "SetDebugThreadContext"},
|
|
|
|
{0x69, NULL, "QueryDebugProcessMemory"},
|
|
|
|
{0x6A, NULL, "ReadProcessMemory"},
|
|
|
|
{0x6B, NULL, "WriteProcessMemory"},
|
|
|
|
{0x6C, NULL, "SetHardwareBreakPoint"},
|
|
|
|
{0x6D, NULL, "GetDebugThreadParam"},
|
|
|
|
{0x6E, NULL, "Unknown"},
|
|
|
|
{0x6F, NULL, "Unknown"},
|
|
|
|
{0x70, NULL, "ControlProcessMemory"},
|
|
|
|
{0x71, NULL, "MapProcessMemory"},
|
|
|
|
{0x72, NULL, "UnmapProcessMemory"},
|
|
|
|
{0x73, NULL, "Unknown"},
|
|
|
|
{0x74, NULL, "Unknown"},
|
|
|
|
{0x75, NULL, "Unknown"},
|
|
|
|
{0x76, NULL, "TerminateProcess"},
|
|
|
|
{0x77, NULL, "Unknown"},
|
|
|
|
{0x78, NULL, "CreateResourceLimit"},
|
|
|
|
{0x79, NULL, "Unknown"},
|
|
|
|
{0x7A, NULL, "Unknown"},
|
|
|
|
{0x7B, NULL, "Unknown"},
|
|
|
|
{0x7C, NULL, "KernelSetState"},
|
|
|
|
{0x7D, NULL, "QueryProcessMemory"},
|
2014-04-11 05:28:28 +05:30
|
|
|
};
|
|
|
|
|
2014-04-12 04:14:21 +05:30
|
|
|
void Register() {
|
2014-05-21 03:58:38 +05:30
|
|
|
HLE::RegisterModule("SVC_Table", ARRAY_SIZE(SVC_Table), SVC_Table);
|
2014-04-11 05:28:28 +05:30
|
|
|
}
|
2014-04-12 04:14:21 +05:30
|
|
|
|
|
|
|
} // namespace
|