Compare commits

...

5 Commits

Author SHA1 Message Date
David
10d85d4c87 Merge branch 'master' into master 2018-01-16 03:55:53 -08:00
David
e59e724c78 Merge branch 'master' into master 2018-01-16 03:55:11 -08:00
David Marcec
8342ae0c3f few fixups 2018-01-16 03:46:31 -08:00
David Marcec
34aac48e02 SetThreadCoreMask stub, acc:u0, fatal:u, nvdrv:a->nvdrv, DuplicateSessionEx 2018-01-16 03:00:24 -08:00
David Marcec
957883de73 merge + more game support 2018-01-16 01:29:22 -08:00
15 changed files with 256 additions and 34 deletions

View File

@@ -314,10 +314,10 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
*result = g_current_process->allowed_processor_mask; *result = g_current_process->allowed_processor_mask;
break; break;
case GetInfoType::TotalMemoryUsage: case GetInfoType::TotalMemoryUsage:
*result = vm_manager.GetTotalMemoryUsage(); *result = 0xBE000000;//vm_manager.GetTotalMemoryUsage();
break; break;
case GetInfoType::TotalHeapUsage: case GetInfoType::TotalHeapUsage:
*result = vm_manager.GetTotalHeapUsage(); *result = 0;//vm_manager.GetTotalHeapUsage();
break; break;
case GetInfoType::RandomEntropy: case GetInfoType::RandomEntropy:
*result = 0; *result = 0;
@@ -328,12 +328,22 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
case GetInfoType::AddressSpaceSize: case GetInfoType::AddressSpaceSize:
*result = vm_manager.GetAddressSpaceSize(); *result = vm_manager.GetAddressSpaceSize();
break; break;
case GetInfoType::MapRegionBaseAddr:
*result = vm_manager.GetAddressSpaceBaseAddr();
break;
case GetInfoType::MapRegionSize:
*result = vm_manager.GetAddressSpaceSize();
break;
case GetInfoType::NewMapRegionBaseAddr: case GetInfoType::NewMapRegionBaseAddr:
*result = vm_manager.GetNewMapRegionBaseAddr(); *result = vm_manager.GetNewMapRegionBaseAddr();
break; break;
case GetInfoType::NewMapRegionSize: case GetInfoType::NewMapRegionSize:
*result = vm_manager.GetNewMapRegionSize(); *result = vm_manager.GetNewMapRegionSize();
break; break;
case GetInfoType::IsVirtualAddressMemoryEnabled:
*result = 1;
break;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
@@ -709,6 +719,16 @@ static ResultCode CreateTransferMemory(Handle* handle, VAddr addr, u64 size, u32
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
static ResultCode MapPhysicalMemory(VAddr addr, u64 size) {
LOG_WARNING(Kernel_SVC, "(STUBBED) called addr 0x%llx size 0x%llx", addr, size);
return RESULT_SUCCESS;
}
static ResultCode SetThreadCoreMask(u32 in0, u64 in1) {
LOG_WARNING(Kernel_SVC, "(STUBBED) called in0 0x%llx in1 0x%llx", in0, in1);
return RESULT_SUCCESS;
}
namespace { namespace {
struct FunctionDef { struct FunctionDef {
using Func = void(); using Func = void();
@@ -735,7 +755,7 @@ static const FunctionDef SVC_Table[] = {
{0x0C, SvcWrap<GetThreadPriority>, "GetThreadPriority"}, {0x0C, SvcWrap<GetThreadPriority>, "GetThreadPriority"},
{0x0D, SvcWrap<SetThreadPriority>, "SetThreadPriority"}, {0x0D, SvcWrap<SetThreadPriority>, "SetThreadPriority"},
{0x0E, nullptr, "GetThreadCoreMask"}, {0x0E, nullptr, "GetThreadCoreMask"},
{0x0F, nullptr, "SetThreadCoreMask"}, {0x0F, SvcWrap<SetThreadCoreMask>, "SetThreadCoreMask"},
{0x10, SvcWrap<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"}, {0x10, SvcWrap<GetCurrentProcessorNumber>, "GetCurrentProcessorNumber"},
{0x11, nullptr, "SignalEvent"}, {0x11, nullptr, "SignalEvent"},
{0x12, nullptr, "ClearEvent"}, {0x12, nullptr, "ClearEvent"},
@@ -764,7 +784,7 @@ static const FunctionDef SVC_Table[] = {
{0x29, SvcWrap<GetInfo>, "GetInfo"}, {0x29, SvcWrap<GetInfo>, "GetInfo"},
{0x2A, nullptr, "FlushEntireDataCache"}, {0x2A, nullptr, "FlushEntireDataCache"},
{0x2B, nullptr, "FlushDataCache"}, {0x2B, nullptr, "FlushDataCache"},
{0x2C, nullptr, "MapPhysicalMemory"}, {0x2C, SvcWrap<MapPhysicalMemory>, "MapPhysicalMemory"},
{0x2D, nullptr, "UnmapPhysicalMemory"}, {0x2D, nullptr, "UnmapPhysicalMemory"},
{0x2E, nullptr, "Unknown"}, {0x2E, nullptr, "Unknown"},
{0x2F, nullptr, "GetLastThreadInfo"}, {0x2F, nullptr, "GetLastThreadInfo"},

View File

@@ -24,6 +24,8 @@ struct PageInfo {
enum class GetInfoType : u64 { enum class GetInfoType : u64 {
// 1.0.0+ // 1.0.0+
AllowedCpuIdBitmask = 0, AllowedCpuIdBitmask = 0,
MapRegionBaseAddr = 2,
MapRegionSize = 3,
TotalMemoryUsage = 6, TotalMemoryUsage = 6,
TotalHeapUsage = 7, TotalHeapUsage = 7,
RandomEntropy = 11, RandomEntropy = 11,
@@ -32,6 +34,8 @@ enum class GetInfoType : u64 {
AddressSpaceSize = 13, AddressSpaceSize = 13,
NewMapRegionBaseAddr = 14, NewMapRegionBaseAddr = 14,
NewMapRegionSize = 15, NewMapRegionSize = 15,
IsVirtualAddressMemoryEnabled = 16,
}; };
void CallSVC(u32 immediate); void CallSVC(u32 immediate);

View File

@@ -169,6 +169,16 @@ void SvcWrap() {
func(); func();
} }
template <ResultCode func(VAddr, u64)>
void SvcWrap() {
func(PARAM(0), PARAM(1));
}
template <ResultCode func(u32, u64)>
void SvcWrap() {
func(PARAM(0), PARAM(1));
}
template <void func(s64)> template <void func(s64)>
void SvcWrap() { void SvcWrap() {
func((s64)PARAM(0)); func((s64)PARAM(0));

View File

@@ -0,0 +1,31 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/acc/acc.h"
namespace Service {
namespace Account {
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<Acc_U0>()->InstallAsService(service_manager);
}
Acc_U0::Acc_U0() : ServiceFramework("acc:u0") {
static const FunctionInfo functions[] = {
{100, &Acc_U0::InitializeApplicationInfo, "InitializeApplicationInfo" },
};
RegisterHandlers(functions);
}
void Acc_U0::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called");
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
}
}
}

View File

@@ -0,0 +1,23 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/service.h"
namespace Service {
namespace Account {
void InstallInterfaces(SM::ServiceManager& service_manager);
class Acc_U0 final : public ServiceFramework<Acc_U0> {
public:
Acc_U0();
~Acc_U0() = default;
private:
void InitializeApplicationInfo(Kernel::HLERequestContext& ctx);
};
}
}

View File

@@ -54,7 +54,12 @@ class ISelfController final : public ServiceFramework<ISelfController> {
public: public:
ISelfController() : ServiceFramework("ISelfController") { ISelfController() : ServiceFramework("ISelfController") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{11, &ISelfController::SetOperationModeChangedNotification, "SetOperationModeChangedNotification"},
{12, &ISelfController::SetPerformanceModeChangedNotification, "SetPerformanceModeChangedNotification" },
{13, &ISelfController::SetFocusHandlingMode, "SetFocusHandlingMode"}, {13, &ISelfController::SetFocusHandlingMode, "SetFocusHandlingMode"},
{14, &ISelfController::SetRestartMessageEnabled, "SetRestartMessageEnabled"},
{16, &ISelfController::SetOutOfFocusSuspendingEnabled, "SetOutOfFocusSuspendingEnabled"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }
@@ -69,6 +74,38 @@ private:
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
} }
void SetRestartMessageEnabled(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called");
}
void SetPerformanceModeChangedNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called");
}
void SetOperationModeChangedNotification(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called");
}
void SetOutOfFocusSuspendingEnabled(Kernel::HLERequestContext& ctx) {
// Takes 3 input u8s with each field located immediately after the previous u8, these are
// bool flags. No output.
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service, "(STUBBED) called");
}
}; };
class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> { class ICommonStateGetter final : public ServiceFramework<ICommonStateGetter> {

View File

@@ -4,6 +4,8 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h"
#include "core/hle/service/apm/apm.h" #include "core/hle/service/apm/apm.h"
namespace Service { namespace Service {
@@ -13,13 +15,47 @@ void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<APM>()->InstallAsService(service_manager); std::make_shared<APM>()->InstallAsService(service_manager);
} }
class ISession final : public ServiceFramework<ISession> {
public:
ISession() : ServiceFramework("ISession") {
static const FunctionInfo functions[] = {
{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration" },
};
RegisterHandlers(functions);
}
private:
void SetPerformanceConfiguration(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called");
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
}
};
void APM::OpenSession(Kernel::HLERequestContext& ctx) {
auto client_port = std::make_shared<ISession>()->CreatePort();
auto session = client_port->Connect();
if (session.Succeeded()) {
LOG_DEBUG(Service_SM, "called, initialized ISession -> session=%u",
(*session)->GetObjectId());
IPC::RequestBuilder rb{ ctx, 2, 0, 1 };
rb.Push(RESULT_SUCCESS);
rb.PushMoveObjects(std::move(session).Unwrap());
}
else {
UNIMPLEMENTED();
}
LOG_INFO(Service_SM, "called");
}
APM::APM() : ServiceFramework("apm") { APM::APM() : ServiceFramework("apm") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0x00000000, nullptr, "OpenSession"}, {0x00000000, &APM::OpenSession, "OpenSession"},
{0x00000001, nullptr, "GetPerformanceMode"}, {0x00000001, nullptr, "GetPerformanceMode"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }
} // namespace APM } // namespace APM
} // namespace Service } // namespace Service

View File

@@ -13,6 +13,8 @@ class APM final : public ServiceFramework<APM> {
public: public:
APM(); APM();
~APM() = default; ~APM() = default;
private:
void OpenSession(Kernel::HLERequestContext& ctx);
}; };
/// Registers all AM services with the specified service manager. /// Registers all AM services with the specified service manager.

View File

@@ -0,0 +1,31 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/logging/log.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/service/fatal/fatal.h"
namespace Service {
namespace Fatal {
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<Fatal_U>()->InstallAsService(service_manager);
}
Fatal_U::Fatal_U() : ServiceFramework("fatal:u") {
static const FunctionInfo functions[] = {
{ 2, &Fatal_U::TransitionToFatalError, "TransitionToFatalError" },
};
RegisterHandlers(functions);
}
void Fatal_U::TransitionToFatalError(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called");
IPC::RequestBuilder rb{ ctx, 2 };
rb.Push(RESULT_SUCCESS);
}
}
}

View File

@@ -0,0 +1,23 @@
// Copyright 2018 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/service/service.h"
namespace Service {
namespace Fatal {
void InstallInterfaces(SM::ServiceManager& service_manager);
class Fatal_U final : public ServiceFramework<Fatal_U> {
public:
Fatal_U();
~Fatal_U() = default;
private:
void TransitionToFatalError(Kernel::HLERequestContext& ctx);
};
}
}

View File

@@ -30,6 +30,7 @@ void NVDRV_A::Open(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(fd); rb.Push<u32>(fd);
rb.Push<u32>(0); rb.Push<u32>(0);
LOG_WARNING(Service, "Opened!!!");
} }
void NVDRV_A::Ioctl(Kernel::HLERequestContext& ctx) { void NVDRV_A::Ioctl(Kernel::HLERequestContext& ctx) {
@@ -66,7 +67,7 @@ void NVDRV_A::Initialize(Kernel::HLERequestContext& ctx) {
rb.Push<u32>(0); rb.Push<u32>(0);
} }
NVDRV_A::NVDRV_A() : ServiceFramework("nvdrv:a") { NVDRV_A::NVDRV_A() : ServiceFramework("nvdrv") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &NVDRV_A::Open, "Open"}, {0, &NVDRV_A::Open, "Open"},
{1, &NVDRV_A::Ioctl, "Ioctl"}, {1, &NVDRV_A::Ioctl, "Ioctl"},

View File

@@ -14,10 +14,12 @@
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/service/acc/acc.h"
#include "core/hle/service/am/am.h" #include "core/hle/service/am/am.h"
#include "core/hle/service/aoc/aoc_u.h" #include "core/hle/service/aoc/aoc_u.h"
#include "core/hle/service/apm/apm.h" #include "core/hle/service/apm/apm.h"
#include "core/hle/service/audio/audio.h" #include "core/hle/service/audio/audio.h"
#include "core/hle/service/fatal/fatal.h"
#include "core/hle/service/hid/hid.h" #include "core/hle/service/hid/hid.h"
#include "core/hle/service/lm/lm.h" #include "core/hle/service/lm/lm.h"
#include "core/hle/service/nvdrv/nvdrv.h" #include "core/hle/service/nvdrv/nvdrv.h"
@@ -164,10 +166,12 @@ void Init() {
SM::g_service_manager = std::make_shared<SM::ServiceManager>(); SM::g_service_manager = std::make_shared<SM::ServiceManager>();
SM::ServiceManager::InstallInterfaces(SM::g_service_manager); SM::ServiceManager::InstallInterfaces(SM::g_service_manager);
Account::InstallInterfaces(*SM::g_service_manager);
AM::InstallInterfaces(*SM::g_service_manager); AM::InstallInterfaces(*SM::g_service_manager);
AOC::InstallInterfaces(*SM::g_service_manager); AOC::InstallInterfaces(*SM::g_service_manager);
APM::InstallInterfaces(*SM::g_service_manager); APM::InstallInterfaces(*SM::g_service_manager);
Audio::InstallInterfaces(*SM::g_service_manager); Audio::InstallInterfaces(*SM::g_service_manager);
Fatal::InstallInterfaces(*SM::g_service_manager);
HID::InstallInterfaces(*SM::g_service_manager); HID::InstallInterfaces(*SM::g_service_manager);
LM::InstallInterfaces(*SM::g_service_manager); LM::InstallInterfaces(*SM::g_service_manager);
NVDRV::InstallInterfaces(*SM::g_service_manager); NVDRV::InstallInterfaces(*SM::g_service_manager);

View File

@@ -46,7 +46,7 @@ Controller::Controller() : ServiceFramework("IpcController") {
{0x00000001, nullptr, "ConvertDomainToSession"}, {0x00000001, nullptr, "ConvertDomainToSession"},
{0x00000002, &Controller::DuplicateSession, "DuplicateSession"}, {0x00000002, &Controller::DuplicateSession, "DuplicateSession"},
{0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"}, {0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
{0x00000004, nullptr, "DuplicateSessionEx"}, {0x00000004, &Controller::DuplicateSession, "DuplicateSessionEx"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
} }

View File

@@ -8,23 +8,23 @@
#include "core/hle/service/vi/vi_m.h" #include "core/hle/service/vi/vi_m.h"
namespace Service { namespace Service {
namespace VI { namespace VI {
void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) { void VI_M::GetDisplayService(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service, "(STUBBED) called"); LOG_WARNING(Service, "(STUBBED) called");
IPC::RequestBuilder rb{ctx, 2, 0, 0, 1}; IPC::RequestBuilder rb{ ctx, 2, 0, 0, 1 };
rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger); rb.PushIpcInterface<IApplicationDisplayService>(nv_flinger);
} }
VI_M::VI_M() : ServiceFramework("vi:m") { VI_M::VI_M() : ServiceFramework("vi:m") {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{2, &VI_M::GetDisplayService, "GetDisplayService"}, { 2, &VI_M::GetDisplayService, "GetDisplayService" },
{3, nullptr, "GetDisplayServiceWithProxyNameExchange"}, { 3, nullptr, "GetDisplayServiceWithProxyNameExchange" },
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
nv_flinger = std::make_shared<NVFlinger>(); nv_flinger = std::make_shared<NVFlinger>();
} }
} // namespace VI } // namespace VI
} // namespace Service } // namespace Service

View File

@@ -124,19 +124,19 @@ enum : PAddr {
/// Virtual user-space memory regions /// Virtual user-space memory regions
enum : VAddr { enum : VAddr {
/// Where the application text, data and bss reside. /// Where the application text, data and bss reside.
PROCESS_IMAGE_VADDR = 0x08000000, PROCESS_IMAGE_VADDR = 0x08000000,
PROCESS_IMAGE_MAX_SIZE = 0x08000000, PROCESS_IMAGE_MAX_SIZE = 0x08000000,
PROCESS_IMAGE_VADDR_END = PROCESS_IMAGE_VADDR + PROCESS_IMAGE_MAX_SIZE, PROCESS_IMAGE_VADDR_END = PROCESS_IMAGE_VADDR + PROCESS_IMAGE_MAX_SIZE,
/// Area where IPC buffers are mapped onto. /// Area where IPC buffers are mapped onto.
IPC_MAPPING_VADDR = 0x04000000, IPC_MAPPING_VADDR = 0x04000000,
IPC_MAPPING_SIZE = 0x04000000, IPC_MAPPING_SIZE = 0x04000000,
IPC_MAPPING_VADDR_END = IPC_MAPPING_VADDR + IPC_MAPPING_SIZE, IPC_MAPPING_VADDR_END = IPC_MAPPING_VADDR + IPC_MAPPING_SIZE,
/// Application heap (includes stack). /// Application heap (includes stack).
HEAP_VADDR = 0x108000000, HEAP_VADDR = 0x108000000,
HEAP_SIZE = 0x18000000, HEAP_SIZE = 0xF0000000,//0x18000000,
HEAP_VADDR_END = HEAP_VADDR + HEAP_SIZE, HEAP_VADDR_END = HEAP_VADDR + HEAP_SIZE,
/// Area where shared memory buffers are mapped onto. /// Area where shared memory buffers are mapped onto.
@@ -177,7 +177,7 @@ enum : VAddr {
SHARED_PAGE_VADDR_END = SHARED_PAGE_VADDR + SHARED_PAGE_SIZE, SHARED_PAGE_VADDR_END = SHARED_PAGE_VADDR + SHARED_PAGE_SIZE,
/// Area where TLS (Thread-Local Storage) buffers are allocated. /// Area where TLS (Thread-Local Storage) buffers are allocated.
TLS_AREA_VADDR = 0x1FF82000, TLS_AREA_VADDR = 0x228000000,//0x1FF82000,
TLS_ENTRY_SIZE = 0x200, TLS_ENTRY_SIZE = 0x200,
/// Equivalent to LINEAR_HEAP_VADDR, but expanded to cover the extra memory in the New 3DS. /// Equivalent to LINEAR_HEAP_VADDR, but expanded to cover the extra memory in the New 3DS.