mirror of
				https://git.tardis.systems/mirrors/yuzu
				synced 2025-11-04 12:45:03 +01:00 
			
		
		
		
	Added CreateSharedMemory & UNIMPLEMENTED() for non existent services. (#113)
* Added svcCreateSharedMemory * Services which are not implemented now throw UNIMPLEMENTED() * clang-format * changed perms to u32 * removed camelcase
This commit is contained in:
		
							parent
							
								
									dd62f125c3
								
							
						
					
					
						commit
						0b6da0c1ab
					
				@ -737,6 +737,18 @@ static ResultCode SetThreadCoreMask(u64, u64, u64) {
 | 
			
		||||
    return RESULT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ResultCode CreateSharedMemory(Handle* handle, u64 sz, u32 local_permissions,
 | 
			
		||||
                                     u32 remote_permissions) {
 | 
			
		||||
    LOG_TRACE(Kernel_SVC, "called, sz=0x%llx, localPerms=0x%08x, remotePerms=0x%08x", sz,
 | 
			
		||||
              local_permissions, remote_permissions);
 | 
			
		||||
    auto sharedMemHandle = SharedMemory::Create(
 | 
			
		||||
        g_handle_table.Get<Process>(KernelHandle::CurrentProcess), sz,
 | 
			
		||||
        (Kernel::MemoryPermission)local_permissions, (Kernel::MemoryPermission)remote_permissions);
 | 
			
		||||
 | 
			
		||||
    CASCADE_RESULT(*handle, g_handle_table.Create(sharedMemHandle));
 | 
			
		||||
    return RESULT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
struct FunctionDef {
 | 
			
		||||
    using Func = void();
 | 
			
		||||
@ -828,7 +840,7 @@ static const FunctionDef SVC_Table[] = {
 | 
			
		||||
    {0x4D, nullptr, "SleepSystem"},
 | 
			
		||||
    {0x4E, nullptr, "ReadWriteRegister"},
 | 
			
		||||
    {0x4F, nullptr, "SetProcessActivity"},
 | 
			
		||||
    {0x50, nullptr, "CreateSharedMemory"},
 | 
			
		||||
    {0x50, SvcWrap<CreateSharedMemory>, "CreateSharedMemory"},
 | 
			
		||||
    {0x51, nullptr, "MapTransferMemory"},
 | 
			
		||||
    {0x52, nullptr, "UnmapTransferMemory"},
 | 
			
		||||
    {0x53, nullptr, "CreateInterruptEvent"},
 | 
			
		||||
 | 
			
		||||
@ -145,6 +145,15 @@ void SvcWrap() {
 | 
			
		||||
    FuncReturn(retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <ResultCode func(Handle*, u64, u32, u32)>
 | 
			
		||||
void SvcWrap() {
 | 
			
		||||
    u32 param_1 = 0;
 | 
			
		||||
    u32 retval =
 | 
			
		||||
        func(¶m_1, PARAM(1), (u32)(PARAM(2) & 0xFFFFFFFF), (u32)(PARAM(3) & 0xFFFFFFFF)).raw;
 | 
			
		||||
    Core::CPU().SetReg(1, param_1);
 | 
			
		||||
    FuncReturn(retval);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// Function wrappers that return type u32
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -103,6 +103,7 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
 | 
			
		||||
        rb.Push(client_port.Code());
 | 
			
		||||
        LOG_ERROR(Service_SM, "called service=%s -> error 0x%08X", name.c_str(),
 | 
			
		||||
                  client_port.Code().raw);
 | 
			
		||||
        UNIMPLEMENTED();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user