mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-26 03:13:15 -06:00
Merge pull request #9718 from yuzu-emu/revert-9508-hle-ipc-buffer-span
Revert "hle_ipc: Use std::span to avoid heap allocations/copies when calling ReadBuffer"
This commit is contained in:
commit
25fc5c0e11
61 changed files with 326 additions and 368 deletions
|
@ -30,7 +30,7 @@ std::string ToUpper(std::string str) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string StringFromBuffer(std::span<const u8> data) {
|
std::string StringFromBuffer(const std::vector<u8>& data) {
|
||||||
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
|
return std::string(data.begin(), std::find(data.begin(), data.end(), '\0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <span>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -18,7 +17,7 @@ namespace Common {
|
||||||
/// Make a string uppercase
|
/// Make a string uppercase
|
||||||
[[nodiscard]] std::string ToUpper(std::string str);
|
[[nodiscard]] std::string ToUpper(std::string str);
|
||||||
|
|
||||||
[[nodiscard]] std::string StringFromBuffer(std::span<const u8> data);
|
[[nodiscard]] std::string StringFromBuffer(const std::vector<u8>& data);
|
||||||
|
|
||||||
[[nodiscard]] std::string StripSpaces(const std::string& s);
|
[[nodiscard]] std::string StripSpaces(const std::string& s);
|
||||||
[[nodiscard]] std::string StripQuotes(const std::string& s);
|
[[nodiscard]] std::string StripQuotes(const std::string& s);
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scratch_buffer.h"
|
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/hle_ipc.h"
|
#include "core/hle/kernel/hle_ipc.h"
|
||||||
#include "core/hle/kernel/k_auto_object.h"
|
#include "core/hle/kernel/k_auto_object.h"
|
||||||
|
@ -326,7 +325,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa
|
||||||
return ResultSuccess;
|
return ResultSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const {
|
std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
|
||||||
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
||||||
BufferDescriptorA()[buffer_index].Size()};
|
BufferDescriptorA()[buffer_index].Size()};
|
||||||
if (is_buffer_a) {
|
if (is_buffer_a) {
|
||||||
|
@ -346,33 +345,6 @@ std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {
|
|
||||||
static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_a;
|
|
||||||
static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_x;
|
|
||||||
|
|
||||||
const bool is_buffer_a{BufferDescriptorA().size() > buffer_index &&
|
|
||||||
BufferDescriptorA()[buffer_index].Size()};
|
|
||||||
if (is_buffer_a) {
|
|
||||||
ASSERT_OR_EXECUTE_MSG(
|
|
||||||
BufferDescriptorA().size() > buffer_index, { return {}; },
|
|
||||||
"BufferDescriptorA invalid buffer_index {}", buffer_index);
|
|
||||||
auto& read_buffer = read_buffer_a[buffer_index];
|
|
||||||
read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size());
|
|
||||||
memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(),
|
|
||||||
read_buffer.size());
|
|
||||||
return read_buffer;
|
|
||||||
} else {
|
|
||||||
ASSERT_OR_EXECUTE_MSG(
|
|
||||||
BufferDescriptorX().size() > buffer_index, { return {}; },
|
|
||||||
"BufferDescriptorX invalid buffer_index {}", buffer_index);
|
|
||||||
auto& read_buffer = read_buffer_x[buffer_index];
|
|
||||||
read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size());
|
|
||||||
memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(),
|
|
||||||
read_buffer.size());
|
|
||||||
return read_buffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,
|
std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size,
|
||||||
std::size_t buffer_index) const {
|
std::size_t buffer_index) const {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <span>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -271,11 +270,8 @@ public:
|
||||||
return domain_message_header.has_value();
|
return domain_message_header.has_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function to get a span of a buffer using the appropriate buffer descriptor
|
/// Helper function to read a buffer using the appropriate buffer descriptor
|
||||||
[[nodiscard]] std::span<const u8> ReadBuffer(std::size_t buffer_index = 0) const;
|
[[nodiscard]] std::vector<u8> ReadBuffer(std::size_t buffer_index = 0) const;
|
||||||
|
|
||||||
/// Helper function to read a copy of a buffer using the appropriate buffer descriptor
|
|
||||||
[[nodiscard]] std::vector<u8> ReadBufferCopy(std::size_t buffer_index = 0) const;
|
|
||||||
|
|
||||||
/// Helper function to write a buffer using the appropriate buffer descriptor
|
/// Helper function to write a buffer using the appropriate buffer descriptor
|
||||||
std::size_t WriteBuffer(const void* buffer, std::size_t size,
|
std::size_t WriteBuffer(const void* buffer, std::size_t size,
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
|
||||||
const u64 offset{rp.Pop<u64>()};
|
const u64 offset{rp.Pop<u64>()};
|
||||||
const auto data{ctx.ReadBuffer()};
|
const std::vector<u8> data{ctx.ReadBuffer()};
|
||||||
const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)};
|
const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)};
|
||||||
|
|
||||||
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
|
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
|
||||||
|
|
|
@ -112,7 +112,7 @@ private:
|
||||||
void RequestUpdate(Kernel::HLERequestContext& ctx) {
|
void RequestUpdate(Kernel::HLERequestContext& ctx) {
|
||||||
LOG_TRACE(Service_Audio, "called");
|
LOG_TRACE(Service_Audio, "called");
|
||||||
|
|
||||||
const auto input{ctx.ReadBuffer(0)};
|
std::vector<u8> input{ctx.ReadBuffer(0)};
|
||||||
|
|
||||||
// These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
|
// These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
|
||||||
// checking size 0. Performance size is 0 for most games.
|
// checking size 0. Performance size is 0 for most games.
|
||||||
|
|
|
@ -93,7 +93,7 @@ private:
|
||||||
ctx.WriteBuffer(samples);
|
ctx.WriteBuffer(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DecodeOpusData(u32& consumed, u32& sample_count, std::span<const u8> input,
|
bool DecodeOpusData(u32& consumed, u32& sample_count, const std::vector<u8>& input,
|
||||||
std::vector<opus_int16>& output, u64* out_performance_time) const {
|
std::vector<opus_int16>& output, u64* out_performance_time) const {
|
||||||
const auto start_time = std::chrono::steady_clock::now();
|
const auto start_time = std::chrono::steady_clock::now();
|
||||||
const std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
|
const std::size_t raw_output_sz = output.size() * sizeof(opus_int16);
|
||||||
|
|
|
@ -122,7 +122,7 @@ private:
|
||||||
|
|
||||||
void ImportTicket(Kernel::HLERequestContext& ctx) {
|
void ImportTicket(Kernel::HLERequestContext& ctx) {
|
||||||
const auto ticket = ctx.ReadBuffer();
|
const auto ticket = ctx.ReadBuffer();
|
||||||
[[maybe_unused]] const auto cert = ctx.ReadBuffer(1);
|
const auto cert = ctx.ReadBuffer(1);
|
||||||
|
|
||||||
if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
|
if (ticket.size() < sizeof(Core::Crypto::Ticket)) {
|
||||||
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
|
LOG_ERROR(Service_ETicket, "The input buffer is not large enough!");
|
||||||
|
|
|
@ -190,7 +190,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto data = ctx.ReadBuffer();
|
const std::vector<u8> data = ctx.ReadBuffer();
|
||||||
|
|
||||||
ASSERT_MSG(
|
ASSERT_MSG(
|
||||||
static_cast<s64>(data.size()) <= length,
|
static_cast<s64>(data.size()) <= length,
|
||||||
|
@ -401,8 +401,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenameFile(Kernel::HLERequestContext& ctx) {
|
void RenameFile(Kernel::HLERequestContext& ctx) {
|
||||||
const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0));
|
std::vector<u8> buffer = ctx.ReadBuffer(0);
|
||||||
const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1));
|
const std::string src_name = Common::StringFromBuffer(buffer);
|
||||||
|
|
||||||
|
buffer = ctx.ReadBuffer(1);
|
||||||
|
const std::string dst_name = Common::StringFromBuffer(buffer);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name);
|
LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name);
|
||||||
|
|
||||||
|
|
|
@ -228,8 +228,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Can this be a span?
|
control = ctx.ReadBuffer();
|
||||||
control = ctx.ReadBufferCopy();
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
|
|
|
@ -758,12 +758,11 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const {
|
||||||
return hid_core.GetSupportedStyleTag();
|
return hid_core.GetSupportedStyleTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) {
|
void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) {
|
||||||
const auto length = data.size();
|
|
||||||
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
|
ASSERT(length > 0 && (length % sizeof(u32)) == 0);
|
||||||
supported_npad_id_types.clear();
|
supported_npad_id_types.clear();
|
||||||
supported_npad_id_types.resize(length / sizeof(u32));
|
supported_npad_id_types.resize(length / sizeof(u32));
|
||||||
std::memcpy(supported_npad_id_types.data(), data.data(), length);
|
std::memcpy(supported_npad_id_types.data(), data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
|
void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <span>
|
|
||||||
|
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -96,7 +95,7 @@ public:
|
||||||
void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set);
|
void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set);
|
||||||
Core::HID::NpadStyleTag GetSupportedStyleSet() const;
|
Core::HID::NpadStyleTag GetSupportedStyleSet() const;
|
||||||
|
|
||||||
void SetSupportedNpadIdTypes(std::span<const u8> data);
|
void SetSupportedNpadIdTypes(u8* data, std::size_t length);
|
||||||
void GetSupportedNpadIdTypes(u32* data, std::size_t max_length);
|
void GetSupportedNpadIdTypes(u32* data, std::size_t max_length);
|
||||||
std::size_t GetSupportedNpadIdTypesSize() const;
|
std::size_t GetSupportedNpadIdTypesSize() const;
|
||||||
|
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) {
|
||||||
const auto applet_resource_user_id{rp.Pop<u64>()};
|
const auto applet_resource_user_id{rp.Pop<u64>()};
|
||||||
|
|
||||||
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
applet_resource->GetController<Controller_NPad>(HidController::NPad)
|
||||||
.SetSupportedNpadIdTypes(ctx.ReadBuffer());
|
.SetSupportedNpadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize());
|
||||||
|
|
||||||
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id);
|
||||||
|
|
||||||
|
@ -2104,7 +2104,7 @@ void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) {
|
||||||
const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
|
const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()};
|
||||||
const auto unknown{rp.Pop<u64>()};
|
const auto unknown{rp.Pop<u64>()};
|
||||||
|
|
||||||
[[maybe_unused]] const auto buffer = ctx.ReadBuffer();
|
const auto buffer = ctx.ReadBuffer();
|
||||||
|
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}",
|
LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}",
|
||||||
connection_handle.npad_id, unknown);
|
connection_handle.npad_id, unknown);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <span>
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assigns a command from data
|
// Assigns a command from data
|
||||||
virtual bool SetCommand(std::span<const u8> data) {
|
virtual bool SetCommand(const std::vector<u8>& data) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ std::vector<u8> RingController::GetReply() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RingController::SetCommand(std::span<const u8> data) {
|
bool RingController::SetCommand(const std::vector<u8>& data) {
|
||||||
if (data.size() < 4) {
|
if (data.size() < 4) {
|
||||||
LOG_ERROR(Service_HID, "Command size not supported {}", data.size());
|
LOG_ERROR(Service_HID, "Command size not supported {}", data.size());
|
||||||
command = RingConCommands::Error;
|
command = RingConCommands::Error;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <span>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/hid/hidbus/hidbus_base.h"
|
#include "core/hle/service/hid/hidbus/hidbus_base.h"
|
||||||
|
@ -32,7 +31,7 @@ public:
|
||||||
u8 GetDeviceId() const override;
|
u8 GetDeviceId() const override;
|
||||||
|
|
||||||
// Assigns a command from data
|
// Assigns a command from data
|
||||||
bool SetCommand(std::span<const u8> data) override;
|
bool SetCommand(const std::vector<u8>& data) override;
|
||||||
|
|
||||||
// Returns a reply from a command
|
// Returns a reply from a command
|
||||||
std::vector<u8> GetReply() const override;
|
std::vector<u8> GetReply() const override;
|
||||||
|
|
|
@ -42,7 +42,7 @@ std::vector<u8> Starlink::GetReply() const {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Starlink::SetCommand(std::span<const u8> data) {
|
bool Starlink::SetCommand(const std::vector<u8>& data) {
|
||||||
LOG_ERROR(Service_HID, "Command not implemented");
|
LOG_ERROR(Service_HID, "Command not implemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
u8 GetDeviceId() const override;
|
u8 GetDeviceId() const override;
|
||||||
|
|
||||||
// Assigns a command from data
|
// Assigns a command from data
|
||||||
bool SetCommand(std::span<const u8> data) override;
|
bool SetCommand(const std::vector<u8>& data) override;
|
||||||
|
|
||||||
// Returns a reply from a command
|
// Returns a reply from a command
|
||||||
std::vector<u8> GetReply() const override;
|
std::vector<u8> GetReply() const override;
|
||||||
|
|
|
@ -43,7 +43,7 @@ std::vector<u8> HidbusStubbed::GetReply() const {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HidbusStubbed::SetCommand(std::span<const u8> data) {
|
bool HidbusStubbed::SetCommand(const std::vector<u8>& data) {
|
||||||
LOG_ERROR(Service_HID, "Command not implemented");
|
LOG_ERROR(Service_HID, "Command not implemented");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
u8 GetDeviceId() const override;
|
u8 GetDeviceId() const override;
|
||||||
|
|
||||||
// Assigns a command from data
|
// Assigns a command from data
|
||||||
bool SetCommand(std::span<const u8> data) override;
|
bool SetCommand(const std::vector<u8>& data) override;
|
||||||
|
|
||||||
// Returns a reply from a command
|
// Returns a reply from a command
|
||||||
std::vector<u8> GetReply() const override;
|
std::vector<u8> GetReply() const override;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
const auto parameters{rp.PopRaw<InputParameters>()};
|
const auto parameters{rp.PopRaw<InputParameters>()};
|
||||||
|
|
||||||
// Optional input/output buffers
|
// Optional input/output buffers
|
||||||
const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span<const u8>()};
|
std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()};
|
||||||
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
||||||
|
|
||||||
// Function call prototype:
|
// Function call prototype:
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
const auto command{rp.PopRaw<u64>()};
|
const auto command{rp.PopRaw<u64>()};
|
||||||
|
|
||||||
// Optional input/output buffers
|
// Optional input/output buffers
|
||||||
const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span<const u8>()};
|
std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()};
|
||||||
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0);
|
||||||
|
|
||||||
// Function call prototype:
|
// Function call prototype:
|
||||||
|
|
|
@ -412,7 +412,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAdvertiseData(Kernel::HLERequestContext& ctx) {
|
void SetAdvertiseData(Kernel::HLERequestContext& ctx) {
|
||||||
const auto read_buffer = ctx.ReadBuffer();
|
std::vector<u8> read_buffer = ctx.ReadBuffer();
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
|
rb.Push(lan_discovery.SetAdvertiseData(read_buffer));
|
||||||
|
@ -464,7 +464,7 @@ public:
|
||||||
parameters.security_config.passphrase_size,
|
parameters.security_config.passphrase_size,
|
||||||
parameters.security_config.security_mode, parameters.local_communication_version);
|
parameters.security_config.security_mode, parameters.local_communication_version);
|
||||||
|
|
||||||
const auto read_buffer = ctx.ReadBuffer();
|
const std::vector<u8> read_buffer = ctx.ReadBuffer();
|
||||||
if (read_buffer.size() != sizeof(NetworkInfo)) {
|
if (read_buffer.size() != sizeof(NetworkInfo)) {
|
||||||
LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!");
|
LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!");
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <span>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/hle/service/nvdrv/nvdata.h"
|
#include "core/hle/service/nvdrv/nvdata.h"
|
||||||
|
|
||||||
|
@ -33,7 +31,7 @@ public:
|
||||||
* @param output A buffer where the output data will be written to.
|
* @param output A buffer where the output data will be written to.
|
||||||
* @returns The result code of the ioctl.
|
* @returns The result code of the ioctl.
|
||||||
*/
|
*/
|
||||||
virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) = 0;
|
std::vector<u8>& output) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,8 +42,8 @@ public:
|
||||||
* @param output A buffer where the output data will be written to.
|
* @param output A buffer where the output data will be written to.
|
||||||
* @returns The result code of the ioctl.
|
* @returns The result code of the ioctl.
|
||||||
*/
|
*/
|
||||||
virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) = 0;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles an ioctl3 request.
|
* Handles an ioctl3 request.
|
||||||
|
@ -55,7 +53,7 @@ public:
|
||||||
* @param inline_output A buffer where the inlined output data will be written to.
|
* @param inline_output A buffer where the inlined output data will be written to.
|
||||||
* @returns The result code of the ioctl.
|
* @returns The result code of the ioctl.
|
||||||
*/
|
*/
|
||||||
virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) = 0;
|
std::vector<u8>& output, std::vector<u8>& inline_output) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,19 +17,19 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system_, NvCore::Container& core)
|
||||||
: nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {}
|
: nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {}
|
||||||
nvdisp_disp0::~nvdisp_disp0() = default;
|
nvdisp_disp0::~nvdisp_disp0() = default;
|
||||||
|
|
||||||
NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
|
|
@ -25,12 +25,12 @@ public:
|
||||||
explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core);
|
explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core);
|
||||||
~nvdisp_disp0() override;
|
~nvdisp_disp0() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
|
@ -27,7 +27,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system_, Module& module_, NvCore::Con
|
||||||
|
|
||||||
nvhost_as_gpu::~nvhost_as_gpu() = default;
|
nvhost_as_gpu::~nvhost_as_gpu() = default;
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'A':
|
case 'A':
|
||||||
|
@ -60,13 +60,13 @@ NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> i
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'A':
|
case 'A':
|
||||||
|
@ -87,7 +87,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> i
|
||||||
void nvhost_as_gpu::OnOpen(DeviceFD fd) {}
|
void nvhost_as_gpu::OnOpen(DeviceFD fd) {}
|
||||||
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_as_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::AllocAsEx(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlAllocAsEx params{};
|
IoctlAllocAsEx params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ NvResult nvhost_as_gpu::AllocAsEx(std::span<const u8> input, std::vector<u8>& ou
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::AllocateSpace(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlAllocSpace params{};
|
IoctlAllocSpace params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
|
||||||
mapping_map.erase(offset);
|
mapping_map.erase(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::FreeSpace(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::FreeSpace(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlFreeSpace params{};
|
IoctlFreeSpace params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ NvResult nvhost_as_gpu::FreeSpace(std::span<const u8> input, std::vector<u8>& ou
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::Remap(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
const auto num_entries = input.size() / sizeof(IoctlRemapEntry);
|
const auto num_entries = input.size() / sizeof(IoctlRemapEntry);
|
||||||
|
|
||||||
LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries);
|
LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries);
|
||||||
|
@ -320,7 +320,7 @@ NvResult nvhost_as_gpu::Remap(std::span<const u8> input, std::vector<u8>& output
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::MapBufferEx(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlMapBufferEx params{};
|
IoctlMapBufferEx params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ NvResult nvhost_as_gpu::MapBufferEx(std::span<const u8> input, std::vector<u8>&
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::UnmapBuffer(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlUnmapBuffer params{};
|
IoctlUnmapBuffer params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(std::span<const u8> input, std::vector<u8>&
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::BindChannel(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlBindChannel params{};
|
IoctlBindChannel params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
|
LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd);
|
||||||
|
@ -492,7 +492,7 @@ void nvhost_as_gpu::GetVARegionsImpl(IoctlGetVaRegions& params) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::GetVARegions(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlGetVaRegions params{};
|
IoctlGetVaRegions params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ NvResult nvhost_as_gpu::GetVARegions(std::span<const u8> input, std::vector<u8>&
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_as_gpu::GetVARegions(std::span<const u8> input, std::vector<u8>& output,
|
NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output) {
|
std::vector<u8>& inline_output) {
|
||||||
IoctlGetVaRegions params{};
|
IoctlGetVaRegions params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
|
|
@ -47,12 +47,12 @@ public:
|
||||||
explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core);
|
explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core);
|
||||||
~nvhost_as_gpu() override;
|
~nvhost_as_gpu() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -138,17 +138,17 @@ private:
|
||||||
static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(VaRegion) * 2,
|
static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(VaRegion) * 2,
|
||||||
"IoctlGetVaRegions is incorrect size");
|
"IoctlGetVaRegions is incorrect size");
|
||||||
|
|
||||||
NvResult AllocAsEx(std::span<const u8> input, std::vector<u8>& output);
|
NvResult AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult AllocateSpace(std::span<const u8> input, std::vector<u8>& output);
|
NvResult AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult Remap(std::span<const u8> input, std::vector<u8>& output);
|
NvResult Remap(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult MapBufferEx(std::span<const u8> input, std::vector<u8>& output);
|
NvResult MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult UnmapBuffer(std::span<const u8> input, std::vector<u8>& output);
|
NvResult UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult FreeSpace(std::span<const u8> input, std::vector<u8>& output);
|
NvResult FreeSpace(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult BindChannel(std::span<const u8> input, std::vector<u8>& output);
|
NvResult BindChannel(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
void GetVARegionsImpl(IoctlGetVaRegions& params);
|
void GetVARegionsImpl(IoctlGetVaRegions& params);
|
||||||
NvResult GetVARegions(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetVARegions(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetVARegions(std::span<const u8> input, std::vector<u8>& output,
|
NvResult GetVARegions(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output);
|
std::vector<u8>& inline_output);
|
||||||
|
|
||||||
void FreeMappingLocked(u64 offset);
|
void FreeMappingLocked(u64 offset);
|
||||||
|
|
|
@ -34,7 +34,7 @@ nvhost_ctrl::~nvhost_ctrl() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
|
@ -63,13 +63,13 @@ NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> inp
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_outpu) {
|
std::vector<u8>& output, std::vector<u8>& inline_outpu) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
@ -79,7 +79,7 @@ void nvhost_ctrl::OnOpen(DeviceFD fd) {}
|
||||||
|
|
||||||
void nvhost_ctrl::OnClose(DeviceFD fd) {}
|
void nvhost_ctrl::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::NvOsGetConfigU32(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocGetConfigParams params{};
|
IocGetConfigParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
LOG_TRACE(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(),
|
LOG_TRACE(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(),
|
||||||
|
@ -87,7 +87,7 @@ NvResult nvhost_ctrl::NvOsGetConfigU32(std::span<const u8> input, std::vector<u8
|
||||||
return NvResult::ConfigVarNotFound; // Returns error on production mode
|
return NvResult::ConfigVarNotFound; // Returns error on production mode
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::IocCtrlEventWait(std::span<const u8> input, std::vector<u8>& output,
|
NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
bool is_allocation) {
|
bool is_allocation) {
|
||||||
IocCtrlEventWaitParams params{};
|
IocCtrlEventWaitParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
@ -231,7 +231,7 @@ NvResult nvhost_ctrl::FreeEvent(u32 slot) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::IocCtrlEventRegister(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocCtrlEventRegisterParams params{};
|
IocCtrlEventRegisterParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
const u32 event_id = params.user_event_id;
|
const u32 event_id = params.user_event_id;
|
||||||
|
@ -252,7 +252,8 @@ NvResult nvhost_ctrl::IocCtrlEventRegister(std::span<const u8> input, std::vecto
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::IocCtrlEventUnregister(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl::IocCtrlEventUnregister(const std::vector<u8>& input,
|
||||||
|
std::vector<u8>& output) {
|
||||||
IocCtrlEventUnregisterParams params{};
|
IocCtrlEventUnregisterParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
const u32 event_id = params.user_event_id & 0x00FF;
|
const u32 event_id = params.user_event_id & 0x00FF;
|
||||||
|
@ -262,7 +263,7 @@ NvResult nvhost_ctrl::IocCtrlEventUnregister(std::span<const u8> input, std::vec
|
||||||
return FreeEvent(event_id);
|
return FreeEvent(event_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(std::span<const u8> input,
|
NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
IocCtrlEventUnregisterBatchParams params{};
|
IocCtrlEventUnregisterBatchParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
@ -281,7 +282,7 @@ NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(std::span<const u8> input,
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl::IocCtrlClearEventWait(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocCtrlEventClearParams params{};
|
IocCtrlEventClearParams params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ public:
|
||||||
NvCore::Container& core);
|
NvCore::Container& core);
|
||||||
~nvhost_ctrl() override;
|
~nvhost_ctrl() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -186,13 +186,13 @@ private:
|
||||||
static_assert(sizeof(IocCtrlEventUnregisterBatchParams) == 8,
|
static_assert(sizeof(IocCtrlEventUnregisterBatchParams) == 8,
|
||||||
"IocCtrlEventKill is incorrect size");
|
"IocCtrlEventKill is incorrect size");
|
||||||
|
|
||||||
NvResult NvOsGetConfigU32(std::span<const u8> input, std::vector<u8>& output);
|
NvResult NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocCtrlEventWait(std::span<const u8> input, std::vector<u8>& output,
|
NvResult IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
bool is_allocation);
|
bool is_allocation);
|
||||||
NvResult IocCtrlEventRegister(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocCtrlEventUnregister(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocCtrlEventUnregister(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocCtrlEventUnregisterBatch(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocCtrlEventUnregisterBatch(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocCtrlClearEventWait(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocCtrlClearEventWait(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
NvResult FreeEvent(u32 slot);
|
NvResult FreeEvent(u32 slot);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ nvhost_ctrl_gpu::~nvhost_ctrl_gpu() {
|
||||||
events_interface.FreeEvent(unknown_event);
|
events_interface.FreeEvent(unknown_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'G':
|
case 'G':
|
||||||
|
@ -53,13 +53,13 @@ NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8>
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'G':
|
case 'G':
|
||||||
|
@ -82,7 +82,8 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8>
|
||||||
void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {}
|
void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {}
|
||||||
void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input,
|
||||||
|
std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
IoctlCharacteristics params{};
|
IoctlCharacteristics params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
@ -127,7 +128,7 @@ NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vec
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vector<u8>& output,
|
NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output) {
|
std::vector<u8>& inline_output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
IoctlCharacteristics params{};
|
IoctlCharacteristics params{};
|
||||||
|
@ -175,7 +176,7 @@ NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vec
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlGpuGetTpcMasksArgs params{};
|
IoctlGpuGetTpcMasksArgs params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "called, mask_buffer_size=0x{:X}", params.mask_buffer_size);
|
LOG_DEBUG(Service_NVDRV, "called, mask_buffer_size=0x{:X}", params.mask_buffer_size);
|
||||||
|
@ -186,7 +187,7 @@ NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>& output,
|
NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output) {
|
std::vector<u8>& inline_output) {
|
||||||
IoctlGpuGetTpcMasksArgs params{};
|
IoctlGpuGetTpcMasksArgs params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
|
@ -199,7 +200,7 @@ NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetActiveSlotMask(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlActiveSlotMask params{};
|
IoctlActiveSlotMask params{};
|
||||||
|
@ -212,7 +213,7 @@ NvResult nvhost_ctrl_gpu::GetActiveSlotMask(std::span<const u8> input, std::vect
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlZcullGetCtxSize params{};
|
IoctlZcullGetCtxSize params{};
|
||||||
|
@ -224,7 +225,7 @@ NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(std::span<const u8> input, std::vector
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::ZCullGetInfo(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlNvgpuGpuZcullGetInfoArgs params{};
|
IoctlNvgpuGpuZcullGetInfoArgs params{};
|
||||||
|
@ -247,7 +248,7 @@ NvResult nvhost_ctrl_gpu::ZCullGetInfo(std::span<const u8> input, std::vector<u8
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::ZBCSetTable(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
||||||
|
|
||||||
IoctlZbcSetTable params{};
|
IoctlZbcSetTable params{};
|
||||||
|
@ -263,7 +264,7 @@ NvResult nvhost_ctrl_gpu::ZBCSetTable(std::span<const u8> input, std::vector<u8>
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::ZBCQueryTable(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
||||||
|
|
||||||
IoctlZbcQueryTable params{};
|
IoctlZbcQueryTable params{};
|
||||||
|
@ -273,7 +274,7 @@ NvResult nvhost_ctrl_gpu::ZBCQueryTable(std::span<const u8> input, std::vector<u
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::FlushL2(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
||||||
|
|
||||||
IoctlFlushL2 params{};
|
IoctlFlushL2 params{};
|
||||||
|
@ -283,7 +284,7 @@ NvResult nvhost_ctrl_gpu::FlushL2(std::span<const u8> input, std::vector<u8>& ou
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_ctrl_gpu::GetGpuTime(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_ctrl_gpu::GetGpuTime(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlGetGpuTime params{};
|
IoctlGetGpuTime params{};
|
||||||
|
|
|
@ -21,12 +21,12 @@ public:
|
||||||
explicit nvhost_ctrl_gpu(Core::System& system_, EventInterface& events_interface_);
|
explicit nvhost_ctrl_gpu(Core::System& system_, EventInterface& events_interface_);
|
||||||
~nvhost_ctrl_gpu() override;
|
~nvhost_ctrl_gpu() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -151,21 +151,21 @@ private:
|
||||||
};
|
};
|
||||||
static_assert(sizeof(IoctlGetGpuTime) == 0x10, "IoctlGetGpuTime is incorrect size");
|
static_assert(sizeof(IoctlGetGpuTime) == 0x10, "IoctlGetGpuTime is incorrect size");
|
||||||
|
|
||||||
NvResult GetCharacteristics(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetCharacteristics(std::span<const u8> input, std::vector<u8>& output,
|
NvResult GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output);
|
std::vector<u8>& inline_output);
|
||||||
|
|
||||||
NvResult GetTPCMasks(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetTPCMasks(std::span<const u8> input, std::vector<u8>& output,
|
NvResult GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
std::vector<u8>& inline_output);
|
std::vector<u8>& inline_output);
|
||||||
|
|
||||||
NvResult GetActiveSlotMask(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ZCullGetCtxSize(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ZCullGetInfo(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ZBCSetTable(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ZBCQueryTable(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult FlushL2(std::span<const u8> input, std::vector<u8>& output);
|
NvResult FlushL2(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetGpuTime(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetGpuTime(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
EventInterface& events_interface;
|
EventInterface& events_interface;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ nvhost_gpu::~nvhost_gpu() {
|
||||||
syncpoint_manager.FreeSyncpoint(channel_syncpoint);
|
syncpoint_manager.FreeSyncpoint(channel_syncpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
|
@ -98,8 +98,8 @@ NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
};
|
};
|
||||||
|
|
||||||
NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'H':
|
case 'H':
|
||||||
switch (command.cmd) {
|
switch (command.cmd) {
|
||||||
|
@ -112,7 +112,7 @@ NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
@ -121,7 +121,7 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
||||||
void nvhost_gpu::OnOpen(DeviceFD fd) {}
|
void nvhost_gpu::OnOpen(DeviceFD fd) {}
|
||||||
void nvhost_gpu::OnClose(DeviceFD fd) {}
|
void nvhost_gpu::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlSetNvmapFD params{};
|
IoctlSetNvmapFD params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
||||||
|
@ -130,7 +130,7 @@ NvResult nvhost_gpu::SetNVMAPfd(std::span<const u8> input, std::vector<u8>& outp
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SetClientData(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlClientData params{};
|
IoctlClientData params{};
|
||||||
|
@ -139,7 +139,7 @@ NvResult nvhost_gpu::SetClientData(std::span<const u8> input, std::vector<u8>& o
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::GetClientData(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
LOG_DEBUG(Service_NVDRV, "called");
|
LOG_DEBUG(Service_NVDRV, "called");
|
||||||
|
|
||||||
IoctlClientData params{};
|
IoctlClientData params{};
|
||||||
|
@ -149,7 +149,7 @@ NvResult nvhost_gpu::GetClientData(std::span<const u8> input, std::vector<u8>& o
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::ZCullBind(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
std::memcpy(&zcull_params, input.data(), input.size());
|
std::memcpy(&zcull_params, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va,
|
LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va,
|
||||||
zcull_params.mode);
|
zcull_params.mode);
|
||||||
|
@ -158,7 +158,7 @@ NvResult nvhost_gpu::ZCullBind(std::span<const u8> input, std::vector<u8>& outpu
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SetErrorNotifier(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlSetErrorNotifier params{};
|
IoctlSetErrorNotifier params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset,
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset,
|
||||||
|
@ -168,14 +168,14 @@ NvResult nvhost_gpu::SetErrorNotifier(std::span<const u8> input, std::vector<u8>
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SetChannelPriority(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
std::memcpy(&channel_priority, input.data(), input.size());
|
std::memcpy(&channel_priority, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority);
|
LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority);
|
||||||
|
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::AllocGPFIFOEx2(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlAllocGpfifoEx2 params{};
|
IoctlAllocGpfifoEx2 params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_WARNING(Service_NVDRV,
|
LOG_WARNING(Service_NVDRV,
|
||||||
|
@ -197,7 +197,7 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(std::span<const u8> input, std::vector<u8>&
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::AllocateObjectContext(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlAllocObjCtx params{};
|
IoctlAllocObjCtx params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num,
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num,
|
||||||
|
@ -293,7 +293,7 @@ NvResult nvhost_gpu::SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector<u8>
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::vector<u8>& output,
|
NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
bool kickoff) {
|
bool kickoff) {
|
||||||
if (input.size() < sizeof(IoctlSubmitGpfifo)) {
|
if (input.size() < sizeof(IoctlSubmitGpfifo)) {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
|
@ -314,7 +314,8 @@ NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::vector<u8>
|
||||||
return SubmitGPFIFOImpl(params, output, std::move(entries));
|
return SubmitGPFIFOImpl(params, output, std::move(entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::span<const u8> input_inline,
|
NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input,
|
||||||
|
const std::vector<u8>& input_inline,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
if (input.size() < sizeof(IoctlSubmitGpfifo)) {
|
if (input.size() < sizeof(IoctlSubmitGpfifo)) {
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
|
@ -327,7 +328,7 @@ NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::span<const
|
||||||
return SubmitGPFIFOImpl(params, output, std::move(entries));
|
return SubmitGPFIFOImpl(params, output, std::move(entries));
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::GetWaitbase(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlGetWaitbase params{};
|
IoctlGetWaitbase params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase));
|
||||||
LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown);
|
LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown);
|
||||||
|
@ -337,7 +338,7 @@ NvResult nvhost_gpu::GetWaitbase(std::span<const u8> input, std::vector<u8>& out
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::ChannelSetTimeout(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlChannelSetTimeout params{};
|
IoctlChannelSetTimeout params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlChannelSetTimeout));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlChannelSetTimeout));
|
||||||
LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout);
|
LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout);
|
||||||
|
@ -345,7 +346,7 @@ NvResult nvhost_gpu::ChannelSetTimeout(std::span<const u8> input, std::vector<u8
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_gpu::ChannelSetTimeslice(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_gpu::ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlSetTimeslice params{};
|
IoctlSetTimeslice params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlSetTimeslice));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlSetTimeslice));
|
||||||
LOG_INFO(Service_NVDRV, "called, timeslice=0x{:X}", params.timeslice);
|
LOG_INFO(Service_NVDRV, "called, timeslice=0x{:X}", params.timeslice);
|
||||||
|
|
|
@ -40,12 +40,12 @@ public:
|
||||||
NvCore::Container& core);
|
NvCore::Container& core);
|
||||||
~nvhost_gpu() override;
|
~nvhost_gpu() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -186,23 +186,23 @@ private:
|
||||||
u32_le channel_priority{};
|
u32_le channel_priority{};
|
||||||
u32_le channel_timeslice{};
|
u32_le channel_timeslice{};
|
||||||
|
|
||||||
NvResult SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult SetClientData(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetClientData(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetClientData(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetClientData(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ZCullBind(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ZCullBind(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult SetErrorNotifier(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult SetChannelPriority(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult AllocGPFIFOEx2(std::span<const u8> input, std::vector<u8>& output);
|
NvResult AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult AllocateObjectContext(std::span<const u8> input, std::vector<u8>& output);
|
NvResult AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector<u8>& output,
|
NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector<u8>& output,
|
||||||
Tegra::CommandList&& entries);
|
Tegra::CommandList&& entries);
|
||||||
NvResult SubmitGPFIFOBase(std::span<const u8> input, std::vector<u8>& output,
|
NvResult SubmitGPFIFOBase(const std::vector<u8>& input, std::vector<u8>& output,
|
||||||
bool kickoff = false);
|
bool kickoff = false);
|
||||||
NvResult SubmitGPFIFOBase(std::span<const u8> input, std::span<const u8> input_inline,
|
NvResult SubmitGPFIFOBase(const std::vector<u8>& input, const std::vector<u8>& input_inline,
|
||||||
std::vector<u8>& output);
|
std::vector<u8>& output);
|
||||||
NvResult GetWaitbase(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ChannelSetTimeout(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult ChannelSetTimeslice(std::span<const u8> input, std::vector<u8>& output);
|
NvResult ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
EventInterface& events_interface;
|
EventInterface& events_interface;
|
||||||
NvCore::Container& core;
|
NvCore::Container& core;
|
||||||
|
|
|
@ -15,7 +15,7 @@ nvhost_nvdec::nvhost_nvdec(Core::System& system_, NvCore::Container& core_)
|
||||||
: nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {}
|
: nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {}
|
||||||
nvhost_nvdec::~nvhost_nvdec() = default;
|
nvhost_nvdec::~nvhost_nvdec() = default;
|
||||||
|
|
||||||
NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
|
@ -55,13 +55,13 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> in
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
|
|
@ -13,12 +13,12 @@ public:
|
||||||
explicit nvhost_nvdec(Core::System& system_, NvCore::Container& core);
|
explicit nvhost_nvdec(Core::System& system_, NvCore::Container& core);
|
||||||
~nvhost_nvdec() override;
|
~nvhost_nvdec() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace {
|
||||||
// Copies count amount of type T from the input vector into the dst vector.
|
// Copies count amount of type T from the input vector into the dst vector.
|
||||||
// Returns the number of bytes written into dst.
|
// Returns the number of bytes written into dst.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::size_t SliceVectors(std::span<const u8> input, std::vector<T>& dst, std::size_t count,
|
std::size_t SliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count,
|
||||||
std::size_t offset) {
|
std::size_t offset) {
|
||||||
if (dst.empty()) {
|
if (dst.empty()) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,7 +63,7 @@ nvhost_nvdec_common::~nvhost_nvdec_common() {
|
||||||
core.Host1xDeviceFile().syncpts_accumulated.push_back(channel_syncpoint);
|
core.Host1xDeviceFile().syncpts_accumulated.push_back(channel_syncpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::SetNVMAPfd(std::span<const u8> input) {
|
NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) {
|
||||||
IoctlSetNvmapFD params{};
|
IoctlSetNvmapFD params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlSetNvmapFD));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlSetNvmapFD));
|
||||||
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
||||||
|
@ -72,7 +72,7 @@ NvResult nvhost_nvdec_common::SetNVMAPfd(std::span<const u8> input) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::Submit(DeviceFD fd, std::span<const u8> input,
|
NvResult nvhost_nvdec_common::Submit(DeviceFD fd, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
IoctlSubmit params{};
|
IoctlSubmit params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlSubmit));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlSubmit));
|
||||||
|
@ -121,7 +121,7 @@ NvResult nvhost_nvdec_common::Submit(DeviceFD fd, std::span<const u8> input,
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::GetSyncpoint(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvdec_common::GetSyncpoint(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlGetSyncpoint params{};
|
IoctlGetSyncpoint params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint));
|
||||||
LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param);
|
LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param);
|
||||||
|
@ -133,7 +133,7 @@ NvResult nvhost_nvdec_common::GetSyncpoint(std::span<const u8> input, std::vecto
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::GetWaitbase(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvdec_common::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlGetWaitbase params{};
|
IoctlGetWaitbase params{};
|
||||||
LOG_CRITICAL(Service_NVDRV, "called WAITBASE");
|
LOG_CRITICAL(Service_NVDRV, "called WAITBASE");
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase));
|
||||||
|
@ -142,7 +142,7 @@ NvResult nvhost_nvdec_common::GetWaitbase(std::span<const u8> input, std::vector
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::MapBuffer(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlMapBuffer params{};
|
IoctlMapBuffer params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer));
|
||||||
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
|
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
|
||||||
|
@ -159,7 +159,7 @@ NvResult nvhost_nvdec_common::MapBuffer(std::span<const u8> input, std::vector<u
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::UnmapBuffer(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlMapBuffer params{};
|
IoctlMapBuffer params{};
|
||||||
std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer));
|
std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer));
|
||||||
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
|
std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries);
|
||||||
|
@ -173,7 +173,8 @@ NvResult nvhost_nvdec_common::UnmapBuffer(std::span<const u8> input, std::vector
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvdec_common::SetSubmitTimeout(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvdec_common::SetSubmitTimeout(const std::vector<u8>& input,
|
||||||
|
std::vector<u8>& output) {
|
||||||
std::memcpy(&submit_timeout, input.data(), input.size());
|
std::memcpy(&submit_timeout, input.data(), input.size());
|
||||||
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
LOG_WARNING(Service_NVDRV, "(STUBBED) called");
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
|
|
|
@ -107,13 +107,13 @@ protected:
|
||||||
static_assert(sizeof(IoctlMapBuffer) == 0x0C, "IoctlMapBuffer is incorrect size");
|
static_assert(sizeof(IoctlMapBuffer) == 0x0C, "IoctlMapBuffer is incorrect size");
|
||||||
|
|
||||||
/// Ioctl command implementations
|
/// Ioctl command implementations
|
||||||
NvResult SetNVMAPfd(std::span<const u8> input);
|
NvResult SetNVMAPfd(const std::vector<u8>& input);
|
||||||
NvResult Submit(DeviceFD fd, std::span<const u8> input, std::vector<u8>& output);
|
NvResult Submit(DeviceFD fd, const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetSyncpoint(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetSyncpoint(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult GetWaitbase(std::span<const u8> input, std::vector<u8>& output);
|
NvResult GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult MapBuffer(std::span<const u8> input, std::vector<u8>& output);
|
NvResult MapBuffer(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult UnmapBuffer(std::span<const u8> input, std::vector<u8>& output);
|
NvResult UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult SetSubmitTimeout(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetSubmitTimeout(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
Kernel::KEvent* QueryEvent(u32 event_id) override;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Service::Nvidia::Devices {
|
||||||
nvhost_nvjpg::nvhost_nvjpg(Core::System& system_) : nvdevice{system_} {}
|
nvhost_nvjpg::nvhost_nvjpg(Core::System& system_) : nvdevice{system_} {}
|
||||||
nvhost_nvjpg::~nvhost_nvjpg() = default;
|
nvhost_nvjpg::~nvhost_nvjpg() = default;
|
||||||
|
|
||||||
NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 'H':
|
case 'H':
|
||||||
|
@ -31,13 +31,13 @@ NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> in
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
@ -46,7 +46,7 @@ NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> in
|
||||||
void nvhost_nvjpg::OnOpen(DeviceFD fd) {}
|
void nvhost_nvjpg::OnOpen(DeviceFD fd) {}
|
||||||
void nvhost_nvjpg::OnClose(DeviceFD fd) {}
|
void nvhost_nvjpg::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvhost_nvjpg::SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IoctlSetNvmapFD params{};
|
IoctlSetNvmapFD params{};
|
||||||
std::memcpy(¶ms, input.data(), input.size());
|
std::memcpy(¶ms, input.data(), input.size());
|
||||||
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd);
|
||||||
|
|
|
@ -15,12 +15,12 @@ public:
|
||||||
explicit nvhost_nvjpg(Core::System& system_);
|
explicit nvhost_nvjpg(Core::System& system_);
|
||||||
~nvhost_nvjpg() override;
|
~nvhost_nvjpg() override;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -33,7 +33,7 @@ private:
|
||||||
|
|
||||||
s32_le nvmap_fd{};
|
s32_le nvmap_fd{};
|
||||||
|
|
||||||
NvResult SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output);
|
NvResult SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::Nvidia::Devices
|
} // namespace Service::Nvidia::Devices
|
||||||
|
|
|
@ -15,7 +15,7 @@ nvhost_vic::nvhost_vic(Core::System& system_, NvCore::Container& core_)
|
||||||
|
|
||||||
nvhost_vic::~nvhost_vic() = default;
|
nvhost_vic::~nvhost_vic() = default;
|
||||||
|
|
||||||
NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
|
@ -55,13 +55,13 @@ NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> inpu
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
|
|
@ -12,12 +12,12 @@ public:
|
||||||
explicit nvhost_vic(Core::System& system_, NvCore::Container& core);
|
explicit nvhost_vic(Core::System& system_, NvCore::Container& core);
|
||||||
~nvhost_vic();
|
~nvhost_vic();
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
|
|
@ -25,7 +25,7 @@ nvmap::nvmap(Core::System& system_, NvCore::Container& container_)
|
||||||
|
|
||||||
nvmap::~nvmap() = default;
|
nvmap::~nvmap() = default;
|
||||||
|
|
||||||
NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
switch (command.group) {
|
switch (command.group) {
|
||||||
case 0x1:
|
case 0x1:
|
||||||
|
@ -54,13 +54,13 @@ NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw);
|
||||||
return NvResult::NotImplemented;
|
return NvResult::NotImplemented;
|
||||||
|
@ -69,7 +69,7 @@ NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
||||||
void nvmap::OnOpen(DeviceFD fd) {}
|
void nvmap::OnOpen(DeviceFD fd) {}
|
||||||
void nvmap::OnClose(DeviceFD fd) {}
|
void nvmap::OnClose(DeviceFD fd) {}
|
||||||
|
|
||||||
NvResult nvmap::IocCreate(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocCreateParams params;
|
IocCreateParams params;
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
LOG_DEBUG(Service_NVDRV, "called, size=0x{:08X}", params.size);
|
LOG_DEBUG(Service_NVDRV, "called, size=0x{:08X}", params.size);
|
||||||
|
@ -89,7 +89,7 @@ NvResult nvmap::IocCreate(std::span<const u8> input, std::vector<u8>& output) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::IocAlloc(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocAllocParams params;
|
IocAllocParams params;
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.address);
|
LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.address);
|
||||||
|
@ -137,7 +137,7 @@ NvResult nvmap::IocAlloc(std::span<const u8> input, std::vector<u8>& output) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::IocGetId(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocGetIdParams params;
|
IocGetIdParams params;
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ NvResult nvmap::IocGetId(std::span<const u8> input, std::vector<u8>& output) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::IocFromId(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocFromIdParams params;
|
IocFromIdParams params;
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ NvResult nvmap::IocFromId(std::span<const u8> input, std::vector<u8>& output) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::IocParam(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
enum class ParamTypes { Size = 1, Alignment = 2, Base = 3, Heap = 4, Kind = 5, Compr = 6 };
|
enum class ParamTypes { Size = 1, Alignment = 2, Base = 3, Heap = 4, Kind = 5, Compr = 6 };
|
||||||
|
|
||||||
IocParamParams params;
|
IocParamParams params;
|
||||||
|
@ -241,7 +241,7 @@ NvResult nvmap::IocParam(std::span<const u8> input, std::vector<u8>& output) {
|
||||||
return NvResult::Success;
|
return NvResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult nvmap::IocFree(std::span<const u8> input, std::vector<u8>& output) {
|
NvResult nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) {
|
||||||
IocFreeParams params;
|
IocFreeParams params;
|
||||||
std::memcpy(¶ms, input.data(), sizeof(params));
|
std::memcpy(¶ms, input.data(), sizeof(params));
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ public:
|
||||||
nvmap(const nvmap&) = delete;
|
nvmap(const nvmap&) = delete;
|
||||||
nvmap& operator=(const nvmap&) = delete;
|
nvmap& operator=(const nvmap&) = delete;
|
||||||
|
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) override;
|
std::vector<u8>& output) override;
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) override;
|
const std::vector<u8>& inline_input, std::vector<u8>& output) override;
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output) override;
|
std::vector<u8>& output, std::vector<u8>& inline_output) override;
|
||||||
|
|
||||||
void OnOpen(DeviceFD fd) override;
|
void OnOpen(DeviceFD fd) override;
|
||||||
void OnClose(DeviceFD fd) override;
|
void OnClose(DeviceFD fd) override;
|
||||||
|
@ -106,12 +106,12 @@ private:
|
||||||
};
|
};
|
||||||
static_assert(sizeof(IocGetIdParams) == 8, "IocGetIdParams has wrong size");
|
static_assert(sizeof(IocGetIdParams) == 8, "IocGetIdParams has wrong size");
|
||||||
|
|
||||||
NvResult IocCreate(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocCreate(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocAlloc(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocAlloc(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocGetId(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocGetId(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocFromId(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocFromId(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocParam(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocParam(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
NvResult IocFree(std::span<const u8> input, std::vector<u8>& output);
|
NvResult IocFree(const std::vector<u8>& input, std::vector<u8>& output);
|
||||||
|
|
||||||
NvCore::Container& container;
|
NvCore::Container& container;
|
||||||
NvCore::NvMap& file;
|
NvCore::NvMap& file;
|
||||||
|
|
|
@ -124,7 +124,7 @@ DeviceFD Module::Open(const std::string& device_name) {
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output) {
|
std::vector<u8>& output) {
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
||||||
|
@ -141,8 +141,8 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
||||||
return itr->second->Ioctl1(fd, command, input, output);
|
return itr->second->Ioctl1(fd, command, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output) {
|
const std::vector<u8>& inline_input, std::vector<u8>& output) {
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
||||||
return NvResult::InvalidState;
|
return NvResult::InvalidState;
|
||||||
|
@ -158,7 +158,7 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
||||||
return itr->second->Ioctl2(fd, command, input, inline_input, output);
|
return itr->second->Ioctl2(fd, command, input, inline_input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
std::vector<u8>& output, std::vector<u8>& inline_output) {
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd);
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -80,13 +79,14 @@ public:
|
||||||
DeviceFD Open(const std::string& device_name);
|
DeviceFD Open(const std::string& device_name);
|
||||||
|
|
||||||
/// Sends an ioctl command to the specified file descriptor.
|
/// Sends an ioctl command to the specified file descriptor.
|
||||||
NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output);
|
NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
|
std::vector<u8>& output);
|
||||||
|
|
||||||
NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input,
|
NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::span<const u8> inline_input, std::vector<u8>& output);
|
const std::vector<u8>& inline_input, std::vector<u8>& output);
|
||||||
|
|
||||||
NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output,
|
NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input,
|
||||||
std::vector<u8>& inline_output);
|
std::vector<u8>& output, std::vector<u8>& inline_output);
|
||||||
|
|
||||||
/// Closes a device file descriptor and returns operation success.
|
/// Closes a device file descriptor and returns operation success.
|
||||||
NvResult Close(DeviceFD fd);
|
NvResult Close(DeviceFD fd);
|
||||||
|
|
|
@ -815,8 +815,8 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
|
||||||
|
|
||||||
void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId code, u32 flags) {
|
void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId code, u32 flags) {
|
||||||
Status status{Status::NoError};
|
Status status{Status::NoError};
|
||||||
InputParcel parcel_in{ctx.ReadBuffer()};
|
Parcel parcel_in{ctx.ReadBuffer()};
|
||||||
OutputParcel parcel_out{};
|
Parcel parcel_out{};
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case TransactionId::Connect: {
|
case TransactionId::Connect: {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace Service::android {
|
namespace Service::android {
|
||||||
|
|
||||||
QueueBufferInput::QueueBufferInput(InputParcel& parcel) {
|
QueueBufferInput::QueueBufferInput(Parcel& parcel) {
|
||||||
parcel.ReadFlattened(*this);
|
parcel.ReadFlattened(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
namespace Service::android {
|
namespace Service::android {
|
||||||
|
|
||||||
class InputParcel;
|
class Parcel;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct QueueBufferInput final {
|
struct QueueBufferInput final {
|
||||||
explicit QueueBufferInput(InputParcel& parcel);
|
explicit QueueBufferInput(Parcel& parcel);
|
||||||
|
|
||||||
void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Common::Rectangle<s32>* crop_,
|
void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Common::Rectangle<s32>* crop_,
|
||||||
NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_,
|
NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/alignment.h"
|
#include "common/alignment.h"
|
||||||
|
@ -13,17 +12,18 @@
|
||||||
|
|
||||||
namespace Service::android {
|
namespace Service::android {
|
||||||
|
|
||||||
struct ParcelHeader {
|
class Parcel final {
|
||||||
u32 data_size;
|
|
||||||
u32 data_offset;
|
|
||||||
u32 objects_size;
|
|
||||||
u32 objects_offset;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(ParcelHeader) == 16, "ParcelHeader has wrong size");
|
|
||||||
|
|
||||||
class InputParcel final {
|
|
||||||
public:
|
public:
|
||||||
explicit InputParcel(std::span<const u8> in_data) : read_buffer(std::move(in_data)) {
|
static constexpr std::size_t DefaultBufferSize = 0x40;
|
||||||
|
|
||||||
|
Parcel() : buffer(DefaultBufferSize) {}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
explicit Parcel(const T& out_data) : buffer(DefaultBufferSize) {
|
||||||
|
Write(out_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit Parcel(std::vector<u8> in_data) : buffer(std::move(in_data)) {
|
||||||
DeserializeHeader();
|
DeserializeHeader();
|
||||||
[[maybe_unused]] const std::u16string token = ReadInterfaceToken();
|
[[maybe_unused]] const std::u16string token = ReadInterfaceToken();
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Read(T& val) {
|
void Read(T& val) {
|
||||||
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
||||||
ASSERT(read_index + sizeof(T) <= read_buffer.size());
|
ASSERT(read_index + sizeof(T) <= buffer.size());
|
||||||
|
|
||||||
std::memcpy(&val, read_buffer.data() + read_index, sizeof(T));
|
std::memcpy(&val, buffer.data() + read_index, sizeof(T));
|
||||||
read_index += sizeof(T);
|
read_index += sizeof(T);
|
||||||
read_index = Common::AlignUp(read_index, 4);
|
read_index = Common::AlignUp(read_index, 4);
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,10 @@ public:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T ReadUnaligned() {
|
T ReadUnaligned() {
|
||||||
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
||||||
ASSERT(read_index + sizeof(T) <= read_buffer.size());
|
ASSERT(read_index + sizeof(T) <= buffer.size());
|
||||||
|
|
||||||
T val;
|
T val;
|
||||||
std::memcpy(&val, read_buffer.data() + read_index, sizeof(T));
|
std::memcpy(&val, buffer.data() + read_index, sizeof(T));
|
||||||
read_index += sizeof(T);
|
read_index += sizeof(T);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -101,31 +101,6 @@ public:
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeserializeHeader() {
|
|
||||||
ASSERT(read_buffer.size() > sizeof(ParcelHeader));
|
|
||||||
|
|
||||||
ParcelHeader header{};
|
|
||||||
std::memcpy(&header, read_buffer.data(), sizeof(ParcelHeader));
|
|
||||||
|
|
||||||
read_index = header.data_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::span<const u8> read_buffer;
|
|
||||||
std::size_t read_index = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OutputParcel final {
|
|
||||||
public:
|
|
||||||
static constexpr std::size_t DefaultBufferSize = 0x40;
|
|
||||||
|
|
||||||
OutputParcel() : buffer(DefaultBufferSize) {}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
explicit OutputParcel(const T& out_data) : buffer(DefaultBufferSize) {
|
|
||||||
Write(out_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Write(const T& val) {
|
void Write(const T& val) {
|
||||||
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable.");
|
||||||
|
@ -158,20 +133,40 @@ public:
|
||||||
WriteObject(ptr.get());
|
WriteObject(ptr.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeserializeHeader() {
|
||||||
|
ASSERT(buffer.size() > sizeof(Header));
|
||||||
|
|
||||||
|
Header header{};
|
||||||
|
std::memcpy(&header, buffer.data(), sizeof(Header));
|
||||||
|
|
||||||
|
read_index = header.data_offset;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<u8> Serialize() const {
|
std::vector<u8> Serialize() const {
|
||||||
ParcelHeader header{};
|
ASSERT(read_index == 0);
|
||||||
header.data_size = static_cast<u32>(write_index - sizeof(ParcelHeader));
|
|
||||||
header.data_offset = sizeof(ParcelHeader);
|
Header header{};
|
||||||
|
header.data_size = static_cast<u32>(write_index - sizeof(Header));
|
||||||
|
header.data_offset = sizeof(Header);
|
||||||
header.objects_size = 4;
|
header.objects_size = 4;
|
||||||
header.objects_offset = static_cast<u32>(sizeof(ParcelHeader) + header.data_size);
|
header.objects_offset = static_cast<u32>(sizeof(Header) + header.data_size);
|
||||||
std::memcpy(buffer.data(), &header, sizeof(ParcelHeader));
|
std::memcpy(buffer.data(), &header, sizeof(Header));
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct Header {
|
||||||
|
u32 data_size;
|
||||||
|
u32 data_offset;
|
||||||
|
u32 objects_size;
|
||||||
|
u32 objects_offset;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size");
|
||||||
|
|
||||||
mutable std::vector<u8> buffer;
|
mutable std::vector<u8> buffer;
|
||||||
std::size_t write_index = sizeof(ParcelHeader);
|
std::size_t read_index = 0;
|
||||||
|
std::size_t write_index = sizeof(Header);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::android
|
} // namespace Service::android
|
||||||
|
|
|
@ -63,7 +63,7 @@ private:
|
||||||
return ctx.ReadBuffer(1);
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::span<const u8>{};
|
return std::vector<u8>{};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
|
@ -90,7 +90,7 @@ private:
|
||||||
return ctx.ReadBuffer(1);
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::span<const u8>{};
|
return std::vector<u8>{};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
|
@ -142,7 +142,7 @@ private:
|
||||||
return ctx.ReadBuffer(1);
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::span<const u8>{};
|
return std::vector<u8>{};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}",
|
||||||
|
@ -166,7 +166,7 @@ private:
|
||||||
return ctx.ReadBuffer(1);
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::span<const u8>{};
|
return std::vector<u8>{};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
LOG_DEBUG(Service_PREPO,
|
LOG_DEBUG(Service_PREPO,
|
||||||
|
|
|
@ -208,6 +208,7 @@ void BSD::Bind(Kernel::HLERequestContext& ctx) {
|
||||||
const s32 fd = rp.Pop<s32>();
|
const s32 fd = rp.Pop<s32>();
|
||||||
|
|
||||||
LOG_DEBUG(Service, "called. fd={} addrlen={}", fd, ctx.GetReadBufferSize());
|
LOG_DEBUG(Service, "called. fd={} addrlen={}", fd, ctx.GetReadBufferSize());
|
||||||
|
|
||||||
BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer()));
|
BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +312,7 @@ void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) {
|
||||||
const u32 level = rp.Pop<u32>();
|
const u32 level = rp.Pop<u32>();
|
||||||
const OptName optname = static_cast<OptName>(rp.Pop<u32>());
|
const OptName optname = static_cast<OptName>(rp.Pop<u32>());
|
||||||
|
|
||||||
const auto buffer = ctx.ReadBuffer();
|
const std::vector<u8> buffer = ctx.ReadBuffer();
|
||||||
const u8* optval = buffer.empty() ? nullptr : buffer.data();
|
const u8* optval = buffer.empty() ? nullptr : buffer.data();
|
||||||
size_t optlen = buffer.size();
|
size_t optlen = buffer.size();
|
||||||
|
|
||||||
|
@ -488,7 +489,7 @@ std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protoco
|
||||||
return {fd, Errno::SUCCESS};
|
return {fd, Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer,
|
std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u8> read_buffer,
|
||||||
s32 nfds, s32 timeout) {
|
s32 nfds, s32 timeout) {
|
||||||
if (write_buffer.size() < nfds * sizeof(PollFD)) {
|
if (write_buffer.size() < nfds * sizeof(PollFD)) {
|
||||||
return {-1, Errno::INVAL};
|
return {-1, Errno::INVAL};
|
||||||
|
@ -583,7 +584,7 @@ std::pair<s32, Errno> BSD::AcceptImpl(s32 fd, std::vector<u8>& write_buffer) {
|
||||||
return {new_fd, Errno::SUCCESS};
|
return {new_fd, Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::BindImpl(s32 fd, std::span<const u8> addr) {
|
Errno BSD::BindImpl(s32 fd, const std::vector<u8>& addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
|
@ -594,7 +595,7 @@ Errno BSD::BindImpl(s32 fd, std::span<const u8> addr) {
|
||||||
return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in)));
|
return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Errno BSD::ConnectImpl(s32 fd, std::span<const u8> addr) {
|
Errno BSD::ConnectImpl(s32 fd, const std::vector<u8>& addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return Errno::BADF;
|
return Errno::BADF;
|
||||||
}
|
}
|
||||||
|
@ -799,15 +800,15 @@ std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& mess
|
||||||
return {ret, bsd_errno};
|
return {ret, bsd_errno};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, std::span<const u8> message) {
|
std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, const std::vector<u8>& message) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
return Translate(file_descriptors[fd]->socket->Send(message, flags));
|
return Translate(file_descriptors[fd]->socket->Send(message, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, const std::vector<u8>& message,
|
||||||
std::span<const u8> addr) {
|
const std::vector<u8>& addr) {
|
||||||
if (!IsFileDescriptorValid(fd)) {
|
if (!IsFileDescriptorValid(fd)) {
|
||||||
return {-1, Errno::BADF};
|
return {-1, Errno::BADF};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -45,7 +44,7 @@ private:
|
||||||
|
|
||||||
s32 nfds;
|
s32 nfds;
|
||||||
s32 timeout;
|
s32 timeout;
|
||||||
std::span<const u8> read_buffer;
|
std::vector<u8> read_buffer;
|
||||||
std::vector<u8> write_buffer;
|
std::vector<u8> write_buffer;
|
||||||
s32 ret{};
|
s32 ret{};
|
||||||
Errno bsd_errno{};
|
Errno bsd_errno{};
|
||||||
|
@ -66,7 +65,7 @@ private:
|
||||||
void Response(Kernel::HLERequestContext& ctx);
|
void Response(Kernel::HLERequestContext& ctx);
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
std::span<const u8> addr;
|
std::vector<u8> addr;
|
||||||
Errno bsd_errno{};
|
Errno bsd_errno{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +98,7 @@ private:
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
std::span<const u8> message;
|
std::vector<u8> message;
|
||||||
s32 ret{};
|
s32 ret{};
|
||||||
Errno bsd_errno{};
|
Errno bsd_errno{};
|
||||||
};
|
};
|
||||||
|
@ -110,8 +109,8 @@ private:
|
||||||
|
|
||||||
s32 fd;
|
s32 fd;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
std::span<const u8> message;
|
std::vector<u8> message;
|
||||||
std::span<const u8> addr;
|
std::vector<u8> addr;
|
||||||
s32 ret{};
|
s32 ret{};
|
||||||
Errno bsd_errno{};
|
Errno bsd_errno{};
|
||||||
};
|
};
|
||||||
|
@ -144,11 +143,11 @@ private:
|
||||||
void ExecuteWork(Kernel::HLERequestContext& ctx, Work work);
|
void ExecuteWork(Kernel::HLERequestContext& ctx, Work work);
|
||||||
|
|
||||||
std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol);
|
std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol);
|
||||||
std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer,
|
std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::vector<u8> read_buffer,
|
||||||
s32 nfds, s32 timeout);
|
s32 nfds, s32 timeout);
|
||||||
std::pair<s32, Errno> AcceptImpl(s32 fd, std::vector<u8>& write_buffer);
|
std::pair<s32, Errno> AcceptImpl(s32 fd, std::vector<u8>& write_buffer);
|
||||||
Errno BindImpl(s32 fd, std::span<const u8> addr);
|
Errno BindImpl(s32 fd, const std::vector<u8>& addr);
|
||||||
Errno ConnectImpl(s32 fd, std::span<const u8> addr);
|
Errno ConnectImpl(s32 fd, const std::vector<u8>& addr);
|
||||||
Errno GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer);
|
Errno GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer);
|
||||||
Errno GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer);
|
Errno GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer);
|
||||||
Errno ListenImpl(s32 fd, s32 backlog);
|
Errno ListenImpl(s32 fd, s32 backlog);
|
||||||
|
@ -158,9 +157,9 @@ private:
|
||||||
std::pair<s32, Errno> RecvImpl(s32 fd, u32 flags, std::vector<u8>& message);
|
std::pair<s32, Errno> RecvImpl(s32 fd, u32 flags, std::vector<u8>& message);
|
||||||
std::pair<s32, Errno> RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
std::pair<s32, Errno> RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message,
|
||||||
std::vector<u8>& addr);
|
std::vector<u8>& addr);
|
||||||
std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, std::span<const u8> message);
|
std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, const std::vector<u8>& message);
|
||||||
std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, const std::vector<u8>& message,
|
||||||
std::span<const u8> addr);
|
const std::vector<u8>& addr);
|
||||||
Errno CloseImpl(s32 fd);
|
Errno CloseImpl(s32 fd);
|
||||||
|
|
||||||
s32 FindFreeFileDescriptorHandle() noexcept;
|
s32 FindFreeFileDescriptorHandle() noexcept;
|
||||||
|
|
|
@ -243,4 +243,4 @@ void SFDNSRES::GetAddrInfoRequestWithOptions(Kernel::HLERequestContext& ctx) {
|
||||||
rb.Push(0);
|
rb.Push(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Service::Sockets
|
} // namespace Service::Sockets
|
|
@ -101,7 +101,7 @@ private:
|
||||||
void ImportServerPki(Kernel::HLERequestContext& ctx) {
|
void ImportServerPki(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto certificate_format = rp.PopEnum<CertificateFormat>();
|
const auto certificate_format = rp.PopEnum<CertificateFormat>();
|
||||||
[[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0);
|
const auto pkcs_12_certificates = ctx.ReadBuffer(0);
|
||||||
|
|
||||||
constexpr u64 server_id = 0;
|
constexpr u64 server_id = 0;
|
||||||
|
|
||||||
|
@ -113,13 +113,13 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportClientPki(Kernel::HLERequestContext& ctx) {
|
void ImportClientPki(Kernel::HLERequestContext& ctx) {
|
||||||
[[maybe_unused]] const auto pkcs_12_certificate = ctx.ReadBuffer(0);
|
const auto pkcs_12_certificate = ctx.ReadBuffer(0);
|
||||||
[[maybe_unused]] const auto ascii_password = [&ctx] {
|
const auto ascii_password = [&ctx] {
|
||||||
if (ctx.CanReadBuffer(1)) {
|
if (ctx.CanReadBuffer(1)) {
|
||||||
return ctx.ReadBuffer(1);
|
return ctx.ReadBuffer(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::span<const u8>{};
|
return std::vector<u8>{};
|
||||||
}();
|
}();
|
||||||
|
|
||||||
constexpr u64 client_id = 0;
|
constexpr u64 client_id = 0;
|
||||||
|
|
|
@ -603,7 +603,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}};
|
const auto parcel = android::Parcel{NativeWindow{*buffer_queue_id}};
|
||||||
const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
|
const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 4};
|
IPC::ResponseBuilder rb{ctx, 4};
|
||||||
|
@ -649,7 +649,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}};
|
const auto parcel = android::Parcel{NativeWindow{*buffer_queue_id}};
|
||||||
const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
|
const auto buffer_size = ctx.WriteBuffer(parcel.Serialize());
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
IPC::ResponseBuilder rb{ctx, 6};
|
||||||
|
|
|
@ -550,7 +550,7 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock
|
||||||
return {-1, GetAndLogLastError()};
|
return {-1, GetAndLogLastError()};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> Socket::Send(std::span<const u8> message, int flags) {
|
std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) {
|
||||||
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
||||||
ASSERT(flags == 0);
|
ASSERT(flags == 0);
|
||||||
|
|
||||||
|
@ -563,7 +563,7 @@ std::pair<s32, Errno> Socket::Send(std::span<const u8> message, int flags) {
|
||||||
return {-1, GetAndLogLastError()};
|
return {-1, GetAndLogLastError()};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> Socket::SendTo(u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message,
|
||||||
const SockAddrIn* addr) {
|
const SockAddrIn* addr) {
|
||||||
ASSERT(flags == 0);
|
ASSERT(flags == 0);
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& mes
|
||||||
return {static_cast<u32>(read_bytes), Errno::SUCCESS};
|
return {static_cast<u32>(read_bytes), Errno::SUCCESS};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> ProxySocket::Send(std::span<const u8> message, int flags) {
|
std::pair<s32, Errno> ProxySocket::Send(const std::vector<u8>& message, int flags) {
|
||||||
LOG_WARNING(Network, "(STUBBED) called");
|
LOG_WARNING(Network, "(STUBBED) called");
|
||||||
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max()));
|
||||||
ASSERT(flags == 0);
|
ASSERT(flags == 0);
|
||||||
|
@ -200,7 +200,7 @@ void ProxySocket::SendPacket(ProxyPacket& packet) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& message,
|
||||||
const SockAddrIn* addr) {
|
const SockAddrIn* addr) {
|
||||||
ASSERT(flags == 0);
|
ASSERT(flags == 0);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <span>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
|
@ -49,11 +48,11 @@ public:
|
||||||
std::pair<s32, Errno> ReceivePacket(int flags, std::vector<u8>& message, SockAddrIn* addr,
|
std::pair<s32, Errno> ReceivePacket(int flags, std::vector<u8>& message, SockAddrIn* addr,
|
||||||
std::size_t max_length);
|
std::size_t max_length);
|
||||||
|
|
||||||
std::pair<s32, Errno> Send(std::span<const u8> message, int flags) override;
|
std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) override;
|
||||||
|
|
||||||
void SendPacket(ProxyPacket& packet);
|
void SendPacket(ProxyPacket& packet);
|
||||||
|
|
||||||
std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message,
|
||||||
const SockAddrIn* addr) override;
|
const SockAddrIn* addr) override;
|
||||||
|
|
||||||
Errno SetLinger(bool enable, u32 linger) override;
|
Errno SetLinger(bool enable, u32 linger) override;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <span>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -67,9 +66,9 @@ public:
|
||||||
virtual std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message,
|
virtual std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message,
|
||||||
SockAddrIn* addr) = 0;
|
SockAddrIn* addr) = 0;
|
||||||
|
|
||||||
virtual std::pair<s32, Errno> Send(std::span<const u8> message, int flags) = 0;
|
virtual std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) = 0;
|
||||||
|
|
||||||
virtual std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message,
|
virtual std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message,
|
||||||
const SockAddrIn* addr) = 0;
|
const SockAddrIn* addr) = 0;
|
||||||
|
|
||||||
virtual Errno SetLinger(bool enable, u32 linger) = 0;
|
virtual Errno SetLinger(bool enable, u32 linger) = 0;
|
||||||
|
@ -139,9 +138,9 @@ public:
|
||||||
|
|
||||||
std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) override;
|
std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) override;
|
||||||
|
|
||||||
std::pair<s32, Errno> Send(std::span<const u8> message, int flags) override;
|
std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) override;
|
||||||
|
|
||||||
std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message,
|
std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message,
|
||||||
const SockAddrIn* addr) override;
|
const SockAddrIn* addr) override;
|
||||||
|
|
||||||
Errno SetLinger(bool enable, u32 linger) override;
|
Errno SetLinger(bool enable, u32 linger) override;
|
||||||
|
|
|
@ -312,7 +312,7 @@ void Reporter::SaveUnimplementedAppletReport(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reporter::SavePlayReport(PlayReportType type, u64 title_id,
|
void Reporter::SavePlayReport(PlayReportType type, u64 title_id,
|
||||||
const std::vector<std::span<const u8>>& data,
|
const std::vector<std::vector<u8>>& data,
|
||||||
std::optional<u64> process_id, std::optional<u128> user_id) const {
|
std::optional<u64> process_id, std::optional<u128> user_id) const {
|
||||||
if (!IsReportingEnabled()) {
|
if (!IsReportingEnabled()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <span>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -57,8 +56,7 @@ public:
|
||||||
System,
|
System,
|
||||||
};
|
};
|
||||||
|
|
||||||
void SavePlayReport(PlayReportType type, u64 title_id,
|
void SavePlayReport(PlayReportType type, u64 title_id, const std::vector<std::vector<u8>>& data,
|
||||||
const std::vector<std::span<const u8>>& data,
|
|
||||||
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
||||||
|
|
||||||
// Used by error applet
|
// Used by error applet
|
||||||
|
|
Loading…
Reference in a new issue