mirror of https://git.suyu.dev/suyu/suyu
Added nvmemp, Added /dev/nvhost-ctrl, SetClientPID now stores pid (#114)
* Added nvmemp, Added /dev/nvhost-ctrl, SetClientPID now stores pid * used clang-format-3.9 instead * lowercase pid * Moved nvmemp handlers to cpp * Removed unnecessary logging for NvOsGetConfigU32. Cleaned up log and changed to LOG_DEBUG * using std::arrays instead of c arrays * nvhost get config now uses std::array completely * added pid logging back * updated cmakelist * missing includes * added array, removed memcpy * clang-format6.0merge-requests/60/head
parent
2403143ff1
commit
eeb3b5eed7
@ -0,0 +1,46 @@
|
||||
// Copyright 2018 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/service/nvdrv/devices/nvhost_ctrl.h"
|
||||
|
||||
namespace Service {
|
||||
namespace Nvidia {
|
||||
namespace Devices {
|
||||
|
||||
u32 nvhost_ctrl::ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) {
|
||||
LOG_DEBUG(Service_NVDRV, "called, command=0x%08x, input_size=0x%lx, output_size=0x%lx", command,
|
||||
input.size(), output.size());
|
||||
|
||||
switch (command) {
|
||||
case IocGetConfigCommand:
|
||||
return NvOsGetConfigU32(input, output);
|
||||
}
|
||||
UNIMPLEMENTED();
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||
IocGetConfigParams params;
|
||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||
LOG_DEBUG(Service_NVDRV, "called, setting=%s!%s", params.domain_str.data(),
|
||||
params.param_str.data());
|
||||
|
||||
if (!strcmp(params.domain_str.data(), "nv")) {
|
||||
if (!strcmp(params.param_str.data(), "NV_MEMORY_PROFILER")) {
|
||||
params.config_str[0] = '1';
|
||||
} else {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
} else {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
std::memcpy(output.data(), ¶ms, sizeof(params));
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace Devices
|
||||
} // namespace Nvidia
|
||||
} // namespace Service
|
@ -0,0 +1,48 @@
|
||||
// Copyright 2018 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/service/nvdrv/devices/nvdevice.h"
|
||||
|
||||
namespace Service {
|
||||
namespace Nvidia {
|
||||
namespace Devices {
|
||||
|
||||
class nvhost_ctrl final : public nvdevice {
|
||||
public:
|
||||
nvhost_ctrl() = default;
|
||||
~nvhost_ctrl() override = default;
|
||||
|
||||
u32 ioctl(u32 command, const std::vector<u8>& input, std::vector<u8>& output) override;
|
||||
|
||||
private:
|
||||
enum IoctlCommands {
|
||||
IocSyncptReadCommand = 0xC0080014,
|
||||
IocSyncptIncrCommand = 0x40040015,
|
||||
IocSyncptWaitCommand = 0xC00C0016,
|
||||
IocModuleMutexCommand = 0x40080017,
|
||||
IocModuleRegRDWRCommand = 0xC008010E,
|
||||
IocSyncptWaitexCommand = 0xC0100019,
|
||||
IocSyncptReadMaxCommand = 0xC008001A,
|
||||
IocGetConfigCommand = 0xC183001B,
|
||||
};
|
||||
|
||||
struct IocGetConfigParams {
|
||||
std::array<char, 0x41> domain_str;
|
||||
std::array<char, 0x41> param_str;
|
||||
std::array<char, 0x101> config_str;
|
||||
};
|
||||
|
||||
u32 NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output);
|
||||
};
|
||||
|
||||
} // namespace Devices
|
||||
} // namespace Nvidia
|
||||
} // namespace Service
|
@ -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/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/hle/ipc_helpers.h"
|
||||
#include "core/hle/service/nvdrv/nvdrv.h"
|
||||
#include "core/hle/service/nvdrv/nvmemp.h"
|
||||
|
||||
namespace Service {
|
||||
namespace Nvidia {
|
||||
|
||||
NVMEMP::NVMEMP() : ServiceFramework("nvmemp") {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &NVMEMP::Unknown0, "Unknown0"},
|
||||
{1, &NVMEMP::Unknown1, "Unknown1"},
|
||||
};
|
||||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
void NVMEMP::Unknown0(Kernel::HLERequestContext& ctx) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void NVMEMP::Unknown1(Kernel::HLERequestContext& ctx) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
} // namespace Nvidia
|
||||
} // namespace Service
|
@ -0,0 +1,23 @@
|
||||
// Copyright 2018 yuzu emulator team
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/hle/service/service.h"
|
||||
|
||||
namespace Service {
|
||||
namespace Nvidia {
|
||||
|
||||
class NVMEMP final : public ServiceFramework<NVMEMP> {
|
||||
public:
|
||||
NVMEMP();
|
||||
~NVMEMP() = default;
|
||||
|
||||
private:
|
||||
void Unknown0(Kernel::HLERequestContext& ctx);
|
||||
void Unknown1(Kernel::HLERequestContext& ctx);
|
||||
};
|
||||
|
||||
} // namespace Nvidia
|
||||
} // namespace Service
|
Loading…
Reference in New Issue