diff options
61 files changed, 368 insertions, 326 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index b26db4796..e0b6180c5 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -30,7 +30,7 @@ std::string ToUpper(std::string str) { | |||
| 30 | return str; | 30 | return str; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | std::string StringFromBuffer(const std::vector<u8>& data) { | 33 | std::string StringFromBuffer(std::span<const u8> data) { |
| 34 | return std::string(data.begin(), std::find(data.begin(), data.end(), '\0')); | 34 | return std::string(data.begin(), std::find(data.begin(), data.end(), '\0')); |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/src/common/string_util.h b/src/common/string_util.h index ce18a33cf..f8aecc875 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <cstddef> | 7 | #include <cstddef> |
| 8 | #include <span> | ||
| 8 | #include <string> | 9 | #include <string> |
| 9 | #include <vector> | 10 | #include <vector> |
| 10 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| @@ -17,7 +18,7 @@ namespace Common { | |||
| 17 | /// Make a string uppercase | 18 | /// Make a string uppercase |
| 18 | [[nodiscard]] std::string ToUpper(std::string str); | 19 | [[nodiscard]] std::string ToUpper(std::string str); |
| 19 | 20 | ||
| 20 | [[nodiscard]] std::string StringFromBuffer(const std::vector<u8>& data); | 21 | [[nodiscard]] std::string StringFromBuffer(std::span<const u8> data); |
| 21 | 22 | ||
| 22 | [[nodiscard]] std::string StripSpaces(const std::string& s); | 23 | [[nodiscard]] std::string StripSpaces(const std::string& s); |
| 23 | [[nodiscard]] std::string StripQuotes(const std::string& s); | 24 | [[nodiscard]] std::string StripQuotes(const std::string& s); |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 738b6d0f1..494151eef 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/scratch_buffer.h" | ||
| 14 | #include "core/hle/ipc_helpers.h" | 15 | #include "core/hle/ipc_helpers.h" |
| 15 | #include "core/hle/kernel/hle_ipc.h" | 16 | #include "core/hle/kernel/hle_ipc.h" |
| 16 | #include "core/hle/kernel/k_auto_object.h" | 17 | #include "core/hle/kernel/k_auto_object.h" |
| @@ -325,7 +326,7 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa | |||
| 325 | return ResultSuccess; | 326 | return ResultSuccess; |
| 326 | } | 327 | } |
| 327 | 328 | ||
| 328 | std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | 329 | std::vector<u8> HLERequestContext::ReadBufferCopy(std::size_t buffer_index) const { |
| 329 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | 330 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && |
| 330 | BufferDescriptorA()[buffer_index].Size()}; | 331 | BufferDescriptorA()[buffer_index].Size()}; |
| 331 | if (is_buffer_a) { | 332 | if (is_buffer_a) { |
| @@ -345,6 +346,33 @@ std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | |||
| 345 | } | 346 | } |
| 346 | } | 347 | } |
| 347 | 348 | ||
| 349 | std::span<const u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | ||
| 350 | static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_a; | ||
| 351 | static thread_local std::array<Common::ScratchBuffer<u8>, 2> read_buffer_x; | ||
| 352 | |||
| 353 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | ||
| 354 | BufferDescriptorA()[buffer_index].Size()}; | ||
| 355 | if (is_buffer_a) { | ||
| 356 | ASSERT_OR_EXECUTE_MSG( | ||
| 357 | BufferDescriptorA().size() > buffer_index, { return {}; }, | ||
| 358 | "BufferDescriptorA invalid buffer_index {}", buffer_index); | ||
| 359 | auto& read_buffer = read_buffer_a[buffer_index]; | ||
| 360 | read_buffer.resize_destructive(BufferDescriptorA()[buffer_index].Size()); | ||
| 361 | memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), read_buffer.data(), | ||
| 362 | read_buffer.size()); | ||
| 363 | return read_buffer; | ||
| 364 | } else { | ||
| 365 | ASSERT_OR_EXECUTE_MSG( | ||
| 366 | BufferDescriptorX().size() > buffer_index, { return {}; }, | ||
| 367 | "BufferDescriptorX invalid buffer_index {}", buffer_index); | ||
| 368 | auto& read_buffer = read_buffer_x[buffer_index]; | ||
| 369 | read_buffer.resize_destructive(BufferDescriptorX()[buffer_index].Size()); | ||
| 370 | memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), read_buffer.data(), | ||
| 371 | read_buffer.size()); | ||
| 372 | return read_buffer; | ||
| 373 | } | ||
| 374 | } | ||
| 375 | |||
| 348 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, | 376 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, |
| 349 | std::size_t buffer_index) const { | 377 | std::size_t buffer_index) const { |
| 350 | if (size == 0) { | 378 | if (size == 0) { |
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index e252b5f4b..5bf4f171b 100644 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <optional> | 9 | #include <optional> |
| 10 | #include <span> | ||
| 10 | #include <string> | 11 | #include <string> |
| 11 | #include <type_traits> | 12 | #include <type_traits> |
| 12 | #include <vector> | 13 | #include <vector> |
| @@ -270,8 +271,11 @@ public: | |||
| 270 | return domain_message_header.has_value(); | 271 | return domain_message_header.has_value(); |
| 271 | } | 272 | } |
| 272 | 273 | ||
| 273 | /// Helper function to read a buffer using the appropriate buffer descriptor | 274 | /// Helper function to get a span of a buffer using the appropriate buffer descriptor |
| 274 | [[nodiscard]] std::vector<u8> ReadBuffer(std::size_t buffer_index = 0) const; | 275 | [[nodiscard]] std::span<const u8> ReadBuffer(std::size_t buffer_index = 0) const; |
| 276 | |||
| 277 | /// Helper function to read a copy of a buffer using the appropriate buffer descriptor | ||
| 278 | [[nodiscard]] std::vector<u8> ReadBufferCopy(std::size_t buffer_index = 0) const; | ||
| 275 | 279 | ||
| 276 | /// Helper function to write a buffer using the appropriate buffer descriptor | 280 | /// Helper function to write a buffer using the appropriate buffer descriptor |
| 277 | std::size_t WriteBuffer(const void* buffer, std::size_t size, | 281 | std::size_t WriteBuffer(const void* buffer, std::size_t size, |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 22999c942..ebcf6e164 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -1124,7 +1124,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) { | |||
| 1124 | IPC::RequestParser rp{ctx}; | 1124 | IPC::RequestParser rp{ctx}; |
| 1125 | 1125 | ||
| 1126 | const u64 offset{rp.Pop<u64>()}; | 1126 | const u64 offset{rp.Pop<u64>()}; |
| 1127 | const std::vector<u8> data{ctx.ReadBuffer()}; | 1127 | const auto data{ctx.ReadBuffer()}; |
| 1128 | const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)}; | 1128 | const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)}; |
| 1129 | 1129 | ||
| 1130 | LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size); | 1130 | LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size); |
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 3a1c231b6..0ee28752c 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -112,7 +112,7 @@ private: | |||
| 112 | void RequestUpdate(Kernel::HLERequestContext& ctx) { | 112 | void RequestUpdate(Kernel::HLERequestContext& ctx) { |
| 113 | LOG_TRACE(Service_Audio, "called"); | 113 | LOG_TRACE(Service_Audio, "called"); |
| 114 | 114 | ||
| 115 | std::vector<u8> input{ctx.ReadBuffer(0)}; | 115 | const auto input{ctx.ReadBuffer(0)}; |
| 116 | 116 | ||
| 117 | // These buffers are written manually to avoid an issue with WriteBuffer throwing errors for | 117 | // These buffers are written manually to avoid an issue with WriteBuffer throwing errors for |
| 118 | // checking size 0. Performance size is 0 for most games. | 118 | // checking size 0. Performance size is 0 for most games. |
diff --git a/src/core/hle/service/audio/hwopus.cpp b/src/core/hle/service/audio/hwopus.cpp index 825fb8bcc..e01f87356 100644 --- a/src/core/hle/service/audio/hwopus.cpp +++ b/src/core/hle/service/audio/hwopus.cpp | |||
| @@ -93,7 +93,7 @@ private: | |||
| 93 | ctx.WriteBuffer(samples); | 93 | ctx.WriteBuffer(samples); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | bool DecodeOpusData(u32& consumed, u32& sample_count, const std::vector<u8>& input, | 96 | bool DecodeOpusData(u32& consumed, u32& sample_count, std::span<const u8> input, |
| 97 | std::vector<opus_int16>& output, u64* out_performance_time) const { | 97 | std::vector<opus_int16>& output, u64* out_performance_time) const { |
| 98 | const auto start_time = std::chrono::steady_clock::now(); | 98 | const auto start_time = std::chrono::steady_clock::now(); |
| 99 | const std::size_t raw_output_sz = output.size() * sizeof(opus_int16); | 99 | const std::size_t raw_output_sz = output.size() * sizeof(opus_int16); |
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index d183e5829..fb8686859 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp | |||
| @@ -122,7 +122,7 @@ private: | |||
| 122 | 122 | ||
| 123 | void ImportTicket(Kernel::HLERequestContext& ctx) { | 123 | void ImportTicket(Kernel::HLERequestContext& ctx) { |
| 124 | const auto ticket = ctx.ReadBuffer(); | 124 | const auto ticket = ctx.ReadBuffer(); |
| 125 | const auto cert = ctx.ReadBuffer(1); | 125 | [[maybe_unused]] const auto cert = ctx.ReadBuffer(1); |
| 126 | 126 | ||
| 127 | if (ticket.size() < sizeof(Core::Crypto::Ticket)) { | 127 | if (ticket.size() < sizeof(Core::Crypto::Ticket)) { |
| 128 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); | 128 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index fbb16a7da..cab44bf9c 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -190,7 +190,7 @@ private: | |||
| 190 | return; | 190 | return; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | const std::vector<u8> data = ctx.ReadBuffer(); | 193 | const auto data = ctx.ReadBuffer(); |
| 194 | 194 | ||
| 195 | ASSERT_MSG( | 195 | ASSERT_MSG( |
| 196 | static_cast<s64>(data.size()) <= length, | 196 | static_cast<s64>(data.size()) <= length, |
| @@ -401,11 +401,8 @@ public: | |||
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | void RenameFile(Kernel::HLERequestContext& ctx) { | 403 | void RenameFile(Kernel::HLERequestContext& ctx) { |
| 404 | std::vector<u8> buffer = ctx.ReadBuffer(0); | 404 | const std::string src_name = Common::StringFromBuffer(ctx.ReadBuffer(0)); |
| 405 | const std::string src_name = Common::StringFromBuffer(buffer); | 405 | const std::string dst_name = Common::StringFromBuffer(ctx.ReadBuffer(1)); |
| 406 | |||
| 407 | buffer = ctx.ReadBuffer(1); | ||
| 408 | const std::string dst_name = Common::StringFromBuffer(buffer); | ||
| 409 | 406 | ||
| 410 | LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name); | 407 | LOG_DEBUG(Service_FS, "called. file '{}' to file '{}'", src_name, dst_name); |
| 411 | 408 | ||
diff --git a/src/core/hle/service/glue/arp.cpp b/src/core/hle/service/glue/arp.cpp index 49b6d45fe..ce21b69e3 100644 --- a/src/core/hle/service/glue/arp.cpp +++ b/src/core/hle/service/glue/arp.cpp | |||
| @@ -228,7 +228,8 @@ private: | |||
| 228 | return; | 228 | return; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | control = ctx.ReadBuffer(); | 231 | // TODO: Can this be a span? |
| 232 | control = ctx.ReadBufferCopy(); | ||
| 232 | 233 | ||
| 233 | IPC::ResponseBuilder rb{ctx, 2}; | 234 | IPC::ResponseBuilder rb{ctx, 2}; |
| 234 | rb.Push(ResultSuccess); | 235 | rb.Push(ResultSuccess); |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 3afda9e3f..513ea485a 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -758,11 +758,12 @@ Core::HID::NpadStyleTag Controller_NPad::GetSupportedStyleSet() const { | |||
| 758 | return hid_core.GetSupportedStyleTag(); | 758 | return hid_core.GetSupportedStyleTag(); |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | void Controller_NPad::SetSupportedNpadIdTypes(u8* data, std::size_t length) { | 761 | void Controller_NPad::SetSupportedNpadIdTypes(std::span<const u8> data) { |
| 762 | const auto length = data.size(); | ||
| 762 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); | 763 | ASSERT(length > 0 && (length % sizeof(u32)) == 0); |
| 763 | supported_npad_id_types.clear(); | 764 | supported_npad_id_types.clear(); |
| 764 | supported_npad_id_types.resize(length / sizeof(u32)); | 765 | supported_npad_id_types.resize(length / sizeof(u32)); |
| 765 | std::memcpy(supported_npad_id_types.data(), data, length); | 766 | std::memcpy(supported_npad_id_types.data(), data.data(), length); |
| 766 | } | 767 | } |
| 767 | 768 | ||
| 768 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { | 769 | void Controller_NPad::GetSupportedNpadIdTypes(u32* data, std::size_t max_length) { |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 1a589cca2..1f7d33459 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <atomic> | 7 | #include <atomic> |
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | #include <span> | ||
| 9 | 10 | ||
| 10 | #include "common/bit_field.h" | 11 | #include "common/bit_field.h" |
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| @@ -95,7 +96,7 @@ public: | |||
| 95 | void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set); | 96 | void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set); |
| 96 | Core::HID::NpadStyleTag GetSupportedStyleSet() const; | 97 | Core::HID::NpadStyleTag GetSupportedStyleSet() const; |
| 97 | 98 | ||
| 98 | void SetSupportedNpadIdTypes(u8* data, std::size_t length); | 99 | void SetSupportedNpadIdTypes(std::span<const u8> data); |
| 99 | void GetSupportedNpadIdTypes(u32* data, std::size_t max_length); | 100 | void GetSupportedNpadIdTypes(u32* data, std::size_t max_length); |
| 100 | std::size_t GetSupportedNpadIdTypesSize() const; | 101 | std::size_t GetSupportedNpadIdTypesSize() const; |
| 101 | 102 | ||
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index bf28440c6..f15f1a6bb 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -1026,7 +1026,7 @@ void Hid::SetSupportedNpadIdType(Kernel::HLERequestContext& ctx) { | |||
| 1026 | const auto applet_resource_user_id{rp.Pop<u64>()}; | 1026 | const auto applet_resource_user_id{rp.Pop<u64>()}; |
| 1027 | 1027 | ||
| 1028 | applet_resource->GetController<Controller_NPad>(HidController::NPad) | 1028 | applet_resource->GetController<Controller_NPad>(HidController::NPad) |
| 1029 | .SetSupportedNpadIdTypes(ctx.ReadBuffer().data(), ctx.GetReadBufferSize()); | 1029 | .SetSupportedNpadIdTypes(ctx.ReadBuffer()); |
| 1030 | 1030 | ||
| 1031 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | 1031 | LOG_DEBUG(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); |
| 1032 | 1032 | ||
| @@ -2104,7 +2104,7 @@ void Hid::WritePalmaRgbLedPatternEntry(Kernel::HLERequestContext& ctx) { | |||
| 2104 | const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; | 2104 | const auto connection_handle{rp.PopRaw<Controller_Palma::PalmaConnectionHandle>()}; |
| 2105 | const auto unknown{rp.Pop<u64>()}; | 2105 | const auto unknown{rp.Pop<u64>()}; |
| 2106 | 2106 | ||
| 2107 | const auto buffer = ctx.ReadBuffer(); | 2107 | [[maybe_unused]] const auto buffer = ctx.ReadBuffer(); |
| 2108 | 2108 | ||
| 2109 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}", | 2109 | LOG_WARNING(Service_HID, "(STUBBED) called, connection_handle={}, unknown={}", |
| 2110 | connection_handle.npad_id, unknown); | 2110 | connection_handle.npad_id, unknown); |
diff --git a/src/core/hle/service/hid/hidbus/hidbus_base.h b/src/core/hle/service/hid/hidbus/hidbus_base.h index d3960f506..65e301137 100644 --- a/src/core/hle/service/hid/hidbus/hidbus_base.h +++ b/src/core/hle/service/hid/hidbus/hidbus_base.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <span> | ||
| 7 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 8 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 9 | 10 | ||
| @@ -150,7 +151,7 @@ public: | |||
| 150 | } | 151 | } |
| 151 | 152 | ||
| 152 | // Assigns a command from data | 153 | // Assigns a command from data |
| 153 | virtual bool SetCommand(const std::vector<u8>& data) { | 154 | virtual bool SetCommand(std::span<const u8> data) { |
| 154 | return {}; | 155 | return {}; |
| 155 | } | 156 | } |
| 156 | 157 | ||
diff --git a/src/core/hle/service/hid/hidbus/ringcon.cpp b/src/core/hle/service/hid/hidbus/ringcon.cpp index 78ed47014..35847cbdd 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.cpp +++ b/src/core/hle/service/hid/hidbus/ringcon.cpp | |||
| @@ -116,7 +116,7 @@ std::vector<u8> RingController::GetReply() const { | |||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | bool RingController::SetCommand(const std::vector<u8>& data) { | 119 | bool RingController::SetCommand(std::span<const u8> data) { |
| 120 | if (data.size() < 4) { | 120 | if (data.size() < 4) { |
| 121 | LOG_ERROR(Service_HID, "Command size not supported {}", data.size()); | 121 | LOG_ERROR(Service_HID, "Command size not supported {}", data.size()); |
| 122 | command = RingConCommands::Error; | 122 | command = RingConCommands::Error; |
diff --git a/src/core/hle/service/hid/hidbus/ringcon.h b/src/core/hle/service/hid/hidbus/ringcon.h index 845ce85a5..c2fb386b1 100644 --- a/src/core/hle/service/hid/hidbus/ringcon.h +++ b/src/core/hle/service/hid/hidbus/ringcon.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <span> | ||
| 7 | 8 | ||
| 8 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 9 | #include "core/hle/service/hid/hidbus/hidbus_base.h" | 10 | #include "core/hle/service/hid/hidbus/hidbus_base.h" |
| @@ -31,7 +32,7 @@ public: | |||
| 31 | u8 GetDeviceId() const override; | 32 | u8 GetDeviceId() const override; |
| 32 | 33 | ||
| 33 | // Assigns a command from data | 34 | // Assigns a command from data |
| 34 | bool SetCommand(const std::vector<u8>& data) override; | 35 | bool SetCommand(std::span<const u8> data) override; |
| 35 | 36 | ||
| 36 | // Returns a reply from a command | 37 | // Returns a reply from a command |
| 37 | std::vector<u8> GetReply() const override; | 38 | std::vector<u8> GetReply() const override; |
diff --git a/src/core/hle/service/hid/hidbus/starlink.cpp b/src/core/hle/service/hid/hidbus/starlink.cpp index dd439f60a..d0e760314 100644 --- a/src/core/hle/service/hid/hidbus/starlink.cpp +++ b/src/core/hle/service/hid/hidbus/starlink.cpp | |||
| @@ -42,7 +42,7 @@ std::vector<u8> Starlink::GetReply() const { | |||
| 42 | return {}; | 42 | return {}; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | bool Starlink::SetCommand(const std::vector<u8>& data) { | 45 | bool Starlink::SetCommand(std::span<const u8> data) { |
| 46 | LOG_ERROR(Service_HID, "Command not implemented"); | 46 | LOG_ERROR(Service_HID, "Command not implemented"); |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
diff --git a/src/core/hle/service/hid/hidbus/starlink.h b/src/core/hle/service/hid/hidbus/starlink.h index 0b1b7ba49..07c800e6e 100644 --- a/src/core/hle/service/hid/hidbus/starlink.h +++ b/src/core/hle/service/hid/hidbus/starlink.h | |||
| @@ -29,7 +29,7 @@ public: | |||
| 29 | u8 GetDeviceId() const override; | 29 | u8 GetDeviceId() const override; |
| 30 | 30 | ||
| 31 | // Assigns a command from data | 31 | // Assigns a command from data |
| 32 | bool SetCommand(const std::vector<u8>& data) override; | 32 | bool SetCommand(std::span<const u8> data) override; |
| 33 | 33 | ||
| 34 | // Returns a reply from a command | 34 | // Returns a reply from a command |
| 35 | std::vector<u8> GetReply() const override; | 35 | std::vector<u8> GetReply() const override; |
diff --git a/src/core/hle/service/hid/hidbus/stubbed.cpp b/src/core/hle/service/hid/hidbus/stubbed.cpp index e477443e3..07632c872 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.cpp +++ b/src/core/hle/service/hid/hidbus/stubbed.cpp | |||
| @@ -43,7 +43,7 @@ std::vector<u8> HidbusStubbed::GetReply() const { | |||
| 43 | return {}; | 43 | return {}; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | bool HidbusStubbed::SetCommand(const std::vector<u8>& data) { | 46 | bool HidbusStubbed::SetCommand(std::span<const u8> data) { |
| 47 | LOG_ERROR(Service_HID, "Command not implemented"); | 47 | LOG_ERROR(Service_HID, "Command not implemented"); |
| 48 | return false; | 48 | return false; |
| 49 | } | 49 | } |
diff --git a/src/core/hle/service/hid/hidbus/stubbed.h b/src/core/hle/service/hid/hidbus/stubbed.h index 91165ceff..38eaa0ecc 100644 --- a/src/core/hle/service/hid/hidbus/stubbed.h +++ b/src/core/hle/service/hid/hidbus/stubbed.h | |||
| @@ -29,7 +29,7 @@ public: | |||
| 29 | u8 GetDeviceId() const override; | 29 | u8 GetDeviceId() const override; |
| 30 | 30 | ||
| 31 | // Assigns a command from data | 31 | // Assigns a command from data |
| 32 | bool SetCommand(const std::vector<u8>& data) override; | 32 | bool SetCommand(std::span<const u8> data) override; |
| 33 | 33 | ||
| 34 | // Returns a reply from a command | 34 | // Returns a reply from a command |
| 35 | std::vector<u8> GetReply() const override; | 35 | std::vector<u8> GetReply() const override; |
diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp index 8f2920c51..1295a44c7 100644 --- a/src/core/hle/service/jit/jit.cpp +++ b/src/core/hle/service/jit/jit.cpp | |||
| @@ -62,7 +62,7 @@ public: | |||
| 62 | const auto parameters{rp.PopRaw<InputParameters>()}; | 62 | const auto parameters{rp.PopRaw<InputParameters>()}; |
| 63 | 63 | ||
| 64 | // Optional input/output buffers | 64 | // Optional input/output buffers |
| 65 | std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()}; | 65 | const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span<const u8>()}; |
| 66 | std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0); | 66 | std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0); |
| 67 | 67 | ||
| 68 | // Function call prototype: | 68 | // Function call prototype: |
| @@ -132,7 +132,7 @@ public: | |||
| 132 | const auto command{rp.PopRaw<u64>()}; | 132 | const auto command{rp.PopRaw<u64>()}; |
| 133 | 133 | ||
| 134 | // Optional input/output buffers | 134 | // Optional input/output buffers |
| 135 | std::vector<u8> input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::vector<u8>()}; | 135 | const auto input_buffer{ctx.CanReadBuffer() ? ctx.ReadBuffer() : std::span<const u8>()}; |
| 136 | std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0); | 136 | std::vector<u8> output_buffer(ctx.CanWriteBuffer() ? ctx.GetWriteBufferSize() : 0); |
| 137 | 137 | ||
| 138 | // Function call prototype: | 138 | // Function call prototype: |
diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index c49c61cff..e5099d61f 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp | |||
| @@ -412,7 +412,7 @@ public: | |||
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | void SetAdvertiseData(Kernel::HLERequestContext& ctx) { | 414 | void SetAdvertiseData(Kernel::HLERequestContext& ctx) { |
| 415 | std::vector<u8> read_buffer = ctx.ReadBuffer(); | 415 | const auto read_buffer = ctx.ReadBuffer(); |
| 416 | 416 | ||
| 417 | IPC::ResponseBuilder rb{ctx, 2}; | 417 | IPC::ResponseBuilder rb{ctx, 2}; |
| 418 | rb.Push(lan_discovery.SetAdvertiseData(read_buffer)); | 418 | rb.Push(lan_discovery.SetAdvertiseData(read_buffer)); |
| @@ -464,7 +464,7 @@ public: | |||
| 464 | parameters.security_config.passphrase_size, | 464 | parameters.security_config.passphrase_size, |
| 465 | parameters.security_config.security_mode, parameters.local_communication_version); | 465 | parameters.security_config.security_mode, parameters.local_communication_version); |
| 466 | 466 | ||
| 467 | const std::vector<u8> read_buffer = ctx.ReadBuffer(); | 467 | const auto read_buffer = ctx.ReadBuffer(); |
| 468 | if (read_buffer.size() != sizeof(NetworkInfo)) { | 468 | if (read_buffer.size() != sizeof(NetworkInfo)) { |
| 469 | LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!"); | 469 | LOG_ERROR(Frontend, "NetworkInfo doesn't match read_buffer size!"); |
| 470 | IPC::ResponseBuilder rb{ctx, 2}; | 470 | IPC::ResponseBuilder rb{ctx, 2}; |
diff --git a/src/core/hle/service/nvdrv/devices/nvdevice.h b/src/core/hle/service/nvdrv/devices/nvdevice.h index 204b0e757..c562e04d2 100644 --- a/src/core/hle/service/nvdrv/devices/nvdevice.h +++ b/src/core/hle/service/nvdrv/devices/nvdevice.h | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <span> | ||
| 6 | #include <vector> | 7 | #include <vector> |
| 8 | |||
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | #include "core/hle/service/nvdrv/nvdata.h" | 10 | #include "core/hle/service/nvdrv/nvdata.h" |
| 9 | 11 | ||
| @@ -31,7 +33,7 @@ public: | |||
| 31 | * @param output A buffer where the output data will be written to. | 33 | * @param output A buffer where the output data will be written to. |
| 32 | * @returns The result code of the ioctl. | 34 | * @returns The result code of the ioctl. |
| 33 | */ | 35 | */ |
| 34 | virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 36 | virtual NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 35 | std::vector<u8>& output) = 0; | 37 | std::vector<u8>& output) = 0; |
| 36 | 38 | ||
| 37 | /** | 39 | /** |
| @@ -42,8 +44,8 @@ public: | |||
| 42 | * @param output A buffer where the output data will be written to. | 44 | * @param output A buffer where the output data will be written to. |
| 43 | * @returns The result code of the ioctl. | 45 | * @returns The result code of the ioctl. |
| 44 | */ | 46 | */ |
| 45 | virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 47 | virtual NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) = 0; | 48 | std::span<const u8> inline_input, std::vector<u8>& output) = 0; |
| 47 | 49 | ||
| 48 | /** | 50 | /** |
| 49 | * Handles an ioctl3 request. | 51 | * Handles an ioctl3 request. |
| @@ -53,7 +55,7 @@ public: | |||
| 53 | * @param inline_output A buffer where the inlined output data will be written to. | 55 | * @param inline_output A buffer where the inlined output data will be written to. |
| 54 | * @returns The result code of the ioctl. | 56 | * @returns The result code of the ioctl. |
| 55 | */ | 57 | */ |
| 56 | virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 58 | virtual NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 57 | std::vector<u8>& output, std::vector<u8>& inline_output) = 0; | 59 | std::vector<u8>& output, std::vector<u8>& inline_output) = 0; |
| 58 | 60 | ||
| 59 | /** | 61 | /** |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 4122fc98d..5a5b2e305 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -17,19 +17,19 @@ nvdisp_disp0::nvdisp_disp0(Core::System& system_, NvCore::Container& core) | |||
| 17 | : nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {} | 17 | : nvdevice{system_}, container{core}, nvmap{core.GetNvMapFile()} {} |
| 18 | nvdisp_disp0::~nvdisp_disp0() = default; | 18 | nvdisp_disp0::~nvdisp_disp0() = default; |
| 19 | 19 | ||
| 20 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 20 | NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 21 | std::vector<u8>& output) { | 21 | std::vector<u8>& output) { |
| 22 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 22 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 23 | return NvResult::NotImplemented; | 23 | return NvResult::NotImplemented; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 26 | NvResult nvdisp_disp0::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 27 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 27 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 28 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 28 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 29 | return NvResult::NotImplemented; | 29 | return NvResult::NotImplemented; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 32 | NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 33 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 33 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 34 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 34 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 35 | return NvResult::NotImplemented; | 35 | return NvResult::NotImplemented; |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index 04217ab12..81bd7960a 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | |||
| @@ -25,12 +25,12 @@ public: | |||
| 25 | explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core); | 25 | explicit nvdisp_disp0(Core::System& system_, NvCore::Container& core); |
| 26 | ~nvdisp_disp0() override; | 26 | ~nvdisp_disp0() override; |
| 27 | 27 | ||
| 28 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 28 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 29 | std::vector<u8>& output) override; | 29 | std::vector<u8>& output) override; |
| 30 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 30 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 31 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 31 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 32 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 32 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 33 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 33 | std::vector<u8>& inline_output) override; |
| 34 | 34 | ||
| 35 | void OnOpen(DeviceFD fd) override; | 35 | void OnOpen(DeviceFD fd) override; |
| 36 | void OnClose(DeviceFD fd) override; | 36 | void OnClose(DeviceFD fd) override; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index b635e6ed1..681bd0867 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -27,7 +27,7 @@ nvhost_as_gpu::nvhost_as_gpu(Core::System& system_, Module& module_, NvCore::Con | |||
| 27 | 27 | ||
| 28 | nvhost_as_gpu::~nvhost_as_gpu() = default; | 28 | nvhost_as_gpu::~nvhost_as_gpu() = default; |
| 29 | 29 | ||
| 30 | NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 30 | NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 31 | std::vector<u8>& output) { | 31 | std::vector<u8>& output) { |
| 32 | switch (command.group) { | 32 | switch (command.group) { |
| 33 | case 'A': | 33 | case 'A': |
| @@ -60,13 +60,13 @@ NvResult nvhost_as_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8> | |||
| 60 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 63 | NvResult nvhost_as_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 64 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 64 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 65 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 65 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 66 | return NvResult::NotImplemented; | 66 | return NvResult::NotImplemented; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 69 | NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 70 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 70 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 71 | switch (command.group) { | 71 | switch (command.group) { |
| 72 | case 'A': | 72 | case 'A': |
| @@ -87,7 +87,7 @@ NvResult nvhost_as_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8> | |||
| 87 | void nvhost_as_gpu::OnOpen(DeviceFD fd) {} | 87 | void nvhost_as_gpu::OnOpen(DeviceFD fd) {} |
| 88 | void nvhost_as_gpu::OnClose(DeviceFD fd) {} | 88 | void nvhost_as_gpu::OnClose(DeviceFD fd) {} |
| 89 | 89 | ||
| 90 | NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output) { | 90 | NvResult nvhost_as_gpu::AllocAsEx(std::span<const u8> input, std::vector<u8>& output) { |
| 91 | IoctlAllocAsEx params{}; | 91 | IoctlAllocAsEx params{}; |
| 92 | std::memcpy(¶ms, input.data(), input.size()); | 92 | std::memcpy(¶ms, input.data(), input.size()); |
| 93 | 93 | ||
| @@ -141,7 +141,7 @@ NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& | |||
| 141 | return NvResult::Success; | 141 | return NvResult::Success; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | NvResult nvhost_as_gpu::AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output) { | 144 | NvResult nvhost_as_gpu::AllocateSpace(std::span<const u8> input, std::vector<u8>& output) { |
| 145 | IoctlAllocSpace params{}; | 145 | IoctlAllocSpace params{}; |
| 146 | std::memcpy(¶ms, input.data(), input.size()); | 146 | std::memcpy(¶ms, input.data(), input.size()); |
| 147 | 147 | ||
| @@ -220,7 +220,7 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) { | |||
| 220 | mapping_map.erase(offset); | 220 | mapping_map.erase(offset); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | NvResult nvhost_as_gpu::FreeSpace(const std::vector<u8>& input, std::vector<u8>& output) { | 223 | NvResult nvhost_as_gpu::FreeSpace(std::span<const u8> input, std::vector<u8>& output) { |
| 224 | IoctlFreeSpace params{}; | 224 | IoctlFreeSpace params{}; |
| 225 | std::memcpy(¶ms, input.data(), input.size()); | 225 | std::memcpy(¶ms, input.data(), input.size()); |
| 226 | 226 | ||
| @@ -266,7 +266,7 @@ NvResult nvhost_as_gpu::FreeSpace(const std::vector<u8>& input, std::vector<u8>& | |||
| 266 | return NvResult::Success; | 266 | return NvResult::Success; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | NvResult nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output) { | 269 | NvResult nvhost_as_gpu::Remap(std::span<const u8> input, std::vector<u8>& output) { |
| 270 | const auto num_entries = input.size() / sizeof(IoctlRemapEntry); | 270 | const auto num_entries = input.size() / sizeof(IoctlRemapEntry); |
| 271 | 271 | ||
| 272 | LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries); | 272 | LOG_DEBUG(Service_NVDRV, "called, num_entries=0x{:X}", num_entries); |
| @@ -320,7 +320,7 @@ NvResult nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& out | |||
| 320 | return NvResult::Success; | 320 | return NvResult::Success; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | NvResult nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output) { | 323 | NvResult nvhost_as_gpu::MapBufferEx(std::span<const u8> input, std::vector<u8>& output) { |
| 324 | IoctlMapBufferEx params{}; | 324 | IoctlMapBufferEx params{}; |
| 325 | std::memcpy(¶ms, input.data(), input.size()); | 325 | std::memcpy(¶ms, input.data(), input.size()); |
| 326 | 326 | ||
| @@ -424,7 +424,7 @@ NvResult nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8 | |||
| 424 | return NvResult::Success; | 424 | return NvResult::Success; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | NvResult nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output) { | 427 | NvResult nvhost_as_gpu::UnmapBuffer(std::span<const u8> input, std::vector<u8>& output) { |
| 428 | IoctlUnmapBuffer params{}; | 428 | IoctlUnmapBuffer params{}; |
| 429 | std::memcpy(¶ms, input.data(), input.size()); | 429 | std::memcpy(¶ms, input.data(), input.size()); |
| 430 | 430 | ||
| @@ -463,7 +463,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8 | |||
| 463 | return NvResult::Success; | 463 | return NvResult::Success; |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | NvResult nvhost_as_gpu::BindChannel(const std::vector<u8>& input, std::vector<u8>& output) { | 466 | NvResult nvhost_as_gpu::BindChannel(std::span<const u8> input, std::vector<u8>& output) { |
| 467 | IoctlBindChannel params{}; | 467 | IoctlBindChannel params{}; |
| 468 | std::memcpy(¶ms, input.data(), input.size()); | 468 | std::memcpy(¶ms, input.data(), input.size()); |
| 469 | LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd); | 469 | LOG_DEBUG(Service_NVDRV, "called, fd={:X}", params.fd); |
| @@ -492,7 +492,7 @@ void nvhost_as_gpu::GetVARegionsImpl(IoctlGetVaRegions& params) { | |||
| 492 | }; | 492 | }; |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output) { | 495 | NvResult nvhost_as_gpu::GetVARegions(std::span<const u8> input, std::vector<u8>& output) { |
| 496 | IoctlGetVaRegions params{}; | 496 | IoctlGetVaRegions params{}; |
| 497 | std::memcpy(¶ms, input.data(), input.size()); | 497 | std::memcpy(¶ms, input.data(), input.size()); |
| 498 | 498 | ||
| @@ -511,7 +511,7 @@ NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u | |||
| 511 | return NvResult::Success; | 511 | return NvResult::Success; |
| 512 | } | 512 | } |
| 513 | 513 | ||
| 514 | NvResult nvhost_as_gpu::GetVARegions(const std::vector<u8>& input, std::vector<u8>& output, | 514 | NvResult nvhost_as_gpu::GetVARegions(std::span<const u8> input, std::vector<u8>& output, |
| 515 | std::vector<u8>& inline_output) { | 515 | std::vector<u8>& inline_output) { |
| 516 | IoctlGetVaRegions params{}; | 516 | IoctlGetVaRegions params{}; |
| 517 | std::memcpy(¶ms, input.data(), input.size()); | 517 | std::memcpy(¶ms, input.data(), input.size()); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h index 86fe71c75..1aba8d579 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.h | |||
| @@ -47,12 +47,12 @@ public: | |||
| 47 | explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core); | 47 | explicit nvhost_as_gpu(Core::System& system_, Module& module, NvCore::Container& core); |
| 48 | ~nvhost_as_gpu() override; | 48 | ~nvhost_as_gpu() override; |
| 49 | 49 | ||
| 50 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 50 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 51 | std::vector<u8>& output) override; | 51 | std::vector<u8>& output) override; |
| 52 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 52 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 53 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 53 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 54 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 54 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 55 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 55 | std::vector<u8>& inline_output) override; |
| 56 | 56 | ||
| 57 | void OnOpen(DeviceFD fd) override; | 57 | void OnOpen(DeviceFD fd) override; |
| 58 | void OnClose(DeviceFD fd) override; | 58 | void OnClose(DeviceFD fd) override; |
| @@ -138,17 +138,17 @@ private: | |||
| 138 | static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(VaRegion) * 2, | 138 | static_assert(sizeof(IoctlGetVaRegions) == 16 + sizeof(VaRegion) * 2, |
| 139 | "IoctlGetVaRegions is incorrect size"); | 139 | "IoctlGetVaRegions is incorrect size"); |
| 140 | 140 | ||
| 141 | NvResult AllocAsEx(const std::vector<u8>& input, std::vector<u8>& output); | 141 | NvResult AllocAsEx(std::span<const u8> input, std::vector<u8>& output); |
| 142 | NvResult AllocateSpace(const std::vector<u8>& input, std::vector<u8>& output); | 142 | NvResult AllocateSpace(std::span<const u8> input, std::vector<u8>& output); |
| 143 | NvResult Remap(const std::vector<u8>& input, std::vector<u8>& output); | 143 | NvResult Remap(std::span<const u8> input, std::vector<u8>& output); |
| 144 | NvResult MapBufferEx(const std::vector<u8>& input, std::vector<u8>& output); | 144 | NvResult MapBufferEx(std::span<const u8> input, std::vector<u8>& output); |
| 145 | NvResult UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output); | 145 | NvResult UnmapBuffer(std::span<const u8> input, std::vector<u8>& output); |
| 146 | NvResult FreeSpace(const std::vector<u8>& input, std::vector<u8>& output); | 146 | NvResult FreeSpace(std::span<const u8> input, std::vector<u8>& output); |
| 147 | NvResult BindChannel(const std::vector<u8>& input, std::vector<u8>& output); | 147 | NvResult BindChannel(std::span<const u8> input, std::vector<u8>& output); |
| 148 | 148 | ||
| 149 | void GetVARegionsImpl(IoctlGetVaRegions& params); | 149 | void GetVARegionsImpl(IoctlGetVaRegions& params); |
| 150 | NvResult GetVARegions(const std::vector<u8>& input, std::vector<u8>& output); | 150 | NvResult GetVARegions(std::span<const u8> input, std::vector<u8>& output); |
| 151 | NvResult GetVARegions(const std::vector<u8>& input, std::vector<u8>& output, | 151 | NvResult GetVARegions(std::span<const u8> input, std::vector<u8>& output, |
| 152 | std::vector<u8>& inline_output); | 152 | std::vector<u8>& inline_output); |
| 153 | 153 | ||
| 154 | void FreeMappingLocked(u64 offset); | 154 | void FreeMappingLocked(u64 offset); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index eee11fab8..0cdde82a7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp | |||
| @@ -34,7 +34,7 @@ nvhost_ctrl::~nvhost_ctrl() { | |||
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 37 | NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 38 | std::vector<u8>& output) { | 38 | std::vector<u8>& output) { |
| 39 | switch (command.group) { | 39 | switch (command.group) { |
| 40 | case 0x0: | 40 | case 0x0: |
| @@ -63,13 +63,13 @@ NvResult nvhost_ctrl::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 63 | return NvResult::NotImplemented; | 63 | return NvResult::NotImplemented; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 66 | NvResult nvhost_ctrl::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 67 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 67 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 68 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 69 | return NvResult::NotImplemented; | 69 | return NvResult::NotImplemented; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 72 | NvResult nvhost_ctrl::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 73 | std::vector<u8>& output, std::vector<u8>& inline_outpu) { | 73 | std::vector<u8>& output, std::vector<u8>& inline_outpu) { |
| 74 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 74 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 75 | return NvResult::NotImplemented; | 75 | return NvResult::NotImplemented; |
| @@ -79,7 +79,7 @@ void nvhost_ctrl::OnOpen(DeviceFD fd) {} | |||
| 79 | 79 | ||
| 80 | void nvhost_ctrl::OnClose(DeviceFD fd) {} | 80 | void nvhost_ctrl::OnClose(DeviceFD fd) {} |
| 81 | 81 | ||
| 82 | NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output) { | 82 | NvResult nvhost_ctrl::NvOsGetConfigU32(std::span<const u8> input, std::vector<u8>& output) { |
| 83 | IocGetConfigParams params{}; | 83 | IocGetConfigParams params{}; |
| 84 | std::memcpy(¶ms, input.data(), sizeof(params)); | 84 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 85 | LOG_TRACE(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(), | 85 | LOG_TRACE(Service_NVDRV, "called, setting={}!{}", params.domain_str.data(), |
| @@ -87,7 +87,7 @@ NvResult nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector | |||
| 87 | return NvResult::ConfigVarNotFound; // Returns error on production mode | 87 | return NvResult::ConfigVarNotFound; // Returns error on production mode |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output, | 90 | NvResult nvhost_ctrl::IocCtrlEventWait(std::span<const u8> input, std::vector<u8>& output, |
| 91 | bool is_allocation) { | 91 | bool is_allocation) { |
| 92 | IocCtrlEventWaitParams params{}; | 92 | IocCtrlEventWaitParams params{}; |
| 93 | std::memcpy(¶ms, input.data(), sizeof(params)); | 93 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| @@ -231,7 +231,7 @@ NvResult nvhost_ctrl::FreeEvent(u32 slot) { | |||
| 231 | return NvResult::Success; | 231 | return NvResult::Success; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) { | 234 | NvResult nvhost_ctrl::IocCtrlEventRegister(std::span<const u8> input, std::vector<u8>& output) { |
| 235 | IocCtrlEventRegisterParams params{}; | 235 | IocCtrlEventRegisterParams params{}; |
| 236 | std::memcpy(¶ms, input.data(), sizeof(params)); | 236 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 237 | const u32 event_id = params.user_event_id; | 237 | const u32 event_id = params.user_event_id; |
| @@ -252,8 +252,7 @@ NvResult nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::ve | |||
| 252 | return NvResult::Success; | 252 | return NvResult::Success; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | NvResult nvhost_ctrl::IocCtrlEventUnregister(const std::vector<u8>& input, | 255 | NvResult nvhost_ctrl::IocCtrlEventUnregister(std::span<const u8> input, std::vector<u8>& output) { |
| 256 | std::vector<u8>& output) { | ||
| 257 | IocCtrlEventUnregisterParams params{}; | 256 | IocCtrlEventUnregisterParams params{}; |
| 258 | std::memcpy(¶ms, input.data(), sizeof(params)); | 257 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 259 | const u32 event_id = params.user_event_id & 0x00FF; | 258 | const u32 event_id = params.user_event_id & 0x00FF; |
| @@ -263,7 +262,7 @@ NvResult nvhost_ctrl::IocCtrlEventUnregister(const std::vector<u8>& input, | |||
| 263 | return FreeEvent(event_id); | 262 | return FreeEvent(event_id); |
| 264 | } | 263 | } |
| 265 | 264 | ||
| 266 | NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(const std::vector<u8>& input, | 265 | NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(std::span<const u8> input, |
| 267 | std::vector<u8>& output) { | 266 | std::vector<u8>& output) { |
| 268 | IocCtrlEventUnregisterBatchParams params{}; | 267 | IocCtrlEventUnregisterBatchParams params{}; |
| 269 | std::memcpy(¶ms, input.data(), sizeof(params)); | 268 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| @@ -282,7 +281,7 @@ NvResult nvhost_ctrl::IocCtrlEventUnregisterBatch(const std::vector<u8>& input, | |||
| 282 | return NvResult::Success; | 281 | return NvResult::Success; |
| 283 | } | 282 | } |
| 284 | 283 | ||
| 285 | NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::vector<u8>& output) { | 284 | NvResult nvhost_ctrl::IocCtrlClearEventWait(std::span<const u8> input, std::vector<u8>& output) { |
| 286 | IocCtrlEventClearParams params{}; | 285 | IocCtrlEventClearParams params{}; |
| 287 | std::memcpy(¶ms, input.data(), sizeof(params)); | 286 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 288 | 287 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index 0b56d7070..dd2e7888a 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | |||
| @@ -25,12 +25,12 @@ public: | |||
| 25 | NvCore::Container& core); | 25 | NvCore::Container& core); |
| 26 | ~nvhost_ctrl() override; | 26 | ~nvhost_ctrl() override; |
| 27 | 27 | ||
| 28 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 28 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 29 | std::vector<u8>& output) override; | 29 | std::vector<u8>& output) override; |
| 30 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 30 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 31 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 31 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 32 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 32 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 33 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 33 | std::vector<u8>& inline_output) override; |
| 34 | 34 | ||
| 35 | void OnOpen(DeviceFD fd) override; | 35 | void OnOpen(DeviceFD fd) override; |
| 36 | void OnClose(DeviceFD fd) override; | 36 | void OnClose(DeviceFD fd) override; |
| @@ -186,13 +186,13 @@ private: | |||
| 186 | static_assert(sizeof(IocCtrlEventUnregisterBatchParams) == 8, | 186 | static_assert(sizeof(IocCtrlEventUnregisterBatchParams) == 8, |
| 187 | "IocCtrlEventKill is incorrect size"); | 187 | "IocCtrlEventKill is incorrect size"); |
| 188 | 188 | ||
| 189 | NvResult NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output); | 189 | NvResult NvOsGetConfigU32(std::span<const u8> input, std::vector<u8>& output); |
| 190 | NvResult IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output, | 190 | NvResult IocCtrlEventWait(std::span<const u8> input, std::vector<u8>& output, |
| 191 | bool is_allocation); | 191 | bool is_allocation); |
| 192 | NvResult IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output); | 192 | NvResult IocCtrlEventRegister(std::span<const u8> input, std::vector<u8>& output); |
| 193 | NvResult IocCtrlEventUnregister(const std::vector<u8>& input, std::vector<u8>& output); | 193 | NvResult IocCtrlEventUnregister(std::span<const u8> input, std::vector<u8>& output); |
| 194 | NvResult IocCtrlEventUnregisterBatch(const std::vector<u8>& input, std::vector<u8>& output); | 194 | NvResult IocCtrlEventUnregisterBatch(std::span<const u8> input, std::vector<u8>& output); |
| 195 | NvResult IocCtrlClearEventWait(const std::vector<u8>& input, std::vector<u8>& output); | 195 | NvResult IocCtrlClearEventWait(std::span<const u8> input, std::vector<u8>& output); |
| 196 | 196 | ||
| 197 | NvResult FreeEvent(u32 slot); | 197 | NvResult FreeEvent(u32 slot); |
| 198 | 198 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp index b97813fbc..be3c083db 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.cpp | |||
| @@ -21,7 +21,7 @@ nvhost_ctrl_gpu::~nvhost_ctrl_gpu() { | |||
| 21 | events_interface.FreeEvent(unknown_event); | 21 | events_interface.FreeEvent(unknown_event); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 24 | NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 25 | std::vector<u8>& output) { | 25 | std::vector<u8>& output) { |
| 26 | switch (command.group) { | 26 | switch (command.group) { |
| 27 | case 'G': | 27 | case 'G': |
| @@ -53,13 +53,13 @@ NvResult nvhost_ctrl_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u | |||
| 53 | return NvResult::NotImplemented; | 53 | return NvResult::NotImplemented; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 56 | NvResult nvhost_ctrl_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 57 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 57 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 58 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 59 | return NvResult::NotImplemented; | 59 | return NvResult::NotImplemented; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 62 | NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 63 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 63 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 64 | switch (command.group) { | 64 | switch (command.group) { |
| 65 | case 'G': | 65 | case 'G': |
| @@ -82,8 +82,7 @@ NvResult nvhost_ctrl_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u | |||
| 82 | void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {} | 82 | void nvhost_ctrl_gpu::OnOpen(DeviceFD fd) {} |
| 83 | void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {} | 83 | void nvhost_ctrl_gpu::OnClose(DeviceFD fd) {} |
| 84 | 84 | ||
| 85 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, | 85 | NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vector<u8>& output) { |
| 86 | std::vector<u8>& output) { | ||
| 87 | LOG_DEBUG(Service_NVDRV, "called"); | 86 | LOG_DEBUG(Service_NVDRV, "called"); |
| 88 | IoctlCharacteristics params{}; | 87 | IoctlCharacteristics params{}; |
| 89 | std::memcpy(¶ms, input.data(), input.size()); | 88 | std::memcpy(¶ms, input.data(), input.size()); |
| @@ -128,7 +127,7 @@ NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, | |||
| 128 | return NvResult::Success; | 127 | return NvResult::Success; |
| 129 | } | 128 | } |
| 130 | 129 | ||
| 131 | NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output, | 130 | NvResult nvhost_ctrl_gpu::GetCharacteristics(std::span<const u8> input, std::vector<u8>& output, |
| 132 | std::vector<u8>& inline_output) { | 131 | std::vector<u8>& inline_output) { |
| 133 | LOG_DEBUG(Service_NVDRV, "called"); | 132 | LOG_DEBUG(Service_NVDRV, "called"); |
| 134 | IoctlCharacteristics params{}; | 133 | IoctlCharacteristics params{}; |
| @@ -176,7 +175,7 @@ NvResult nvhost_ctrl_gpu::GetCharacteristics(const std::vector<u8>& input, std:: | |||
| 176 | return NvResult::Success; | 175 | return NvResult::Success; |
| 177 | } | 176 | } |
| 178 | 177 | ||
| 179 | NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output) { | 178 | NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>& output) { |
| 180 | IoctlGpuGetTpcMasksArgs params{}; | 179 | IoctlGpuGetTpcMasksArgs params{}; |
| 181 | std::memcpy(¶ms, input.data(), input.size()); | 180 | std::memcpy(¶ms, input.data(), input.size()); |
| 182 | LOG_DEBUG(Service_NVDRV, "called, mask_buffer_size=0x{:X}", params.mask_buffer_size); | 181 | LOG_DEBUG(Service_NVDRV, "called, mask_buffer_size=0x{:X}", params.mask_buffer_size); |
| @@ -187,7 +186,7 @@ NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector< | |||
| 187 | return NvResult::Success; | 186 | return NvResult::Success; |
| 188 | } | 187 | } |
| 189 | 188 | ||
| 190 | NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output, | 189 | NvResult nvhost_ctrl_gpu::GetTPCMasks(std::span<const u8> input, std::vector<u8>& output, |
| 191 | std::vector<u8>& inline_output) { | 190 | std::vector<u8>& inline_output) { |
| 192 | IoctlGpuGetTpcMasksArgs params{}; | 191 | IoctlGpuGetTpcMasksArgs params{}; |
| 193 | std::memcpy(¶ms, input.data(), input.size()); | 192 | std::memcpy(¶ms, input.data(), input.size()); |
| @@ -200,7 +199,7 @@ NvResult nvhost_ctrl_gpu::GetTPCMasks(const std::vector<u8>& input, std::vector< | |||
| 200 | return NvResult::Success; | 199 | return NvResult::Success; |
| 201 | } | 200 | } |
| 202 | 201 | ||
| 203 | NvResult nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output) { | 202 | NvResult nvhost_ctrl_gpu::GetActiveSlotMask(std::span<const u8> input, std::vector<u8>& output) { |
| 204 | LOG_DEBUG(Service_NVDRV, "called"); | 203 | LOG_DEBUG(Service_NVDRV, "called"); |
| 205 | 204 | ||
| 206 | IoctlActiveSlotMask params{}; | 205 | IoctlActiveSlotMask params{}; |
| @@ -213,7 +212,7 @@ NvResult nvhost_ctrl_gpu::GetActiveSlotMask(const std::vector<u8>& input, std::v | |||
| 213 | return NvResult::Success; | 212 | return NvResult::Success; |
| 214 | } | 213 | } |
| 215 | 214 | ||
| 216 | NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output) { | 215 | NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(std::span<const u8> input, std::vector<u8>& output) { |
| 217 | LOG_DEBUG(Service_NVDRV, "called"); | 216 | LOG_DEBUG(Service_NVDRV, "called"); |
| 218 | 217 | ||
| 219 | IoctlZcullGetCtxSize params{}; | 218 | IoctlZcullGetCtxSize params{}; |
| @@ -225,7 +224,7 @@ NvResult nvhost_ctrl_gpu::ZCullGetCtxSize(const std::vector<u8>& input, std::vec | |||
| 225 | return NvResult::Success; | 224 | return NvResult::Success; |
| 226 | } | 225 | } |
| 227 | 226 | ||
| 228 | NvResult nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output) { | 227 | NvResult nvhost_ctrl_gpu::ZCullGetInfo(std::span<const u8> input, std::vector<u8>& output) { |
| 229 | LOG_DEBUG(Service_NVDRV, "called"); | 228 | LOG_DEBUG(Service_NVDRV, "called"); |
| 230 | 229 | ||
| 231 | IoctlNvgpuGpuZcullGetInfoArgs params{}; | 230 | IoctlNvgpuGpuZcullGetInfoArgs params{}; |
| @@ -248,7 +247,7 @@ NvResult nvhost_ctrl_gpu::ZCullGetInfo(const std::vector<u8>& input, std::vector | |||
| 248 | return NvResult::Success; | 247 | return NvResult::Success; |
| 249 | } | 248 | } |
| 250 | 249 | ||
| 251 | NvResult nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output) { | 250 | NvResult nvhost_ctrl_gpu::ZBCSetTable(std::span<const u8> input, std::vector<u8>& output) { |
| 252 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); | 251 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); |
| 253 | 252 | ||
| 254 | IoctlZbcSetTable params{}; | 253 | IoctlZbcSetTable params{}; |
| @@ -264,7 +263,7 @@ NvResult nvhost_ctrl_gpu::ZBCSetTable(const std::vector<u8>& input, std::vector< | |||
| 264 | return NvResult::Success; | 263 | return NvResult::Success; |
| 265 | } | 264 | } |
| 266 | 265 | ||
| 267 | NvResult nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output) { | 266 | NvResult nvhost_ctrl_gpu::ZBCQueryTable(std::span<const u8> input, std::vector<u8>& output) { |
| 268 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); | 267 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); |
| 269 | 268 | ||
| 270 | IoctlZbcQueryTable params{}; | 269 | IoctlZbcQueryTable params{}; |
| @@ -274,7 +273,7 @@ NvResult nvhost_ctrl_gpu::ZBCQueryTable(const std::vector<u8>& input, std::vecto | |||
| 274 | return NvResult::Success; | 273 | return NvResult::Success; |
| 275 | } | 274 | } |
| 276 | 275 | ||
| 277 | NvResult nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& output) { | 276 | NvResult nvhost_ctrl_gpu::FlushL2(std::span<const u8> input, std::vector<u8>& output) { |
| 278 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); | 277 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); |
| 279 | 278 | ||
| 280 | IoctlFlushL2 params{}; | 279 | IoctlFlushL2 params{}; |
| @@ -284,7 +283,7 @@ NvResult nvhost_ctrl_gpu::FlushL2(const std::vector<u8>& input, std::vector<u8>& | |||
| 284 | return NvResult::Success; | 283 | return NvResult::Success; |
| 285 | } | 284 | } |
| 286 | 285 | ||
| 287 | NvResult nvhost_ctrl_gpu::GetGpuTime(const std::vector<u8>& input, std::vector<u8>& output) { | 286 | NvResult nvhost_ctrl_gpu::GetGpuTime(std::span<const u8> input, std::vector<u8>& output) { |
| 288 | LOG_DEBUG(Service_NVDRV, "called"); | 287 | LOG_DEBUG(Service_NVDRV, "called"); |
| 289 | 288 | ||
| 290 | IoctlGetGpuTime params{}; | 289 | IoctlGetGpuTime params{}; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h index 1e8f254e2..b9333d9d3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl_gpu.h | |||
| @@ -21,12 +21,12 @@ public: | |||
| 21 | explicit nvhost_ctrl_gpu(Core::System& system_, EventInterface& events_interface_); | 21 | explicit nvhost_ctrl_gpu(Core::System& system_, EventInterface& events_interface_); |
| 22 | ~nvhost_ctrl_gpu() override; | 22 | ~nvhost_ctrl_gpu() override; |
| 23 | 23 | ||
| 24 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 24 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 25 | std::vector<u8>& output) override; | 25 | std::vector<u8>& output) override; |
| 26 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 26 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 27 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 27 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 28 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 28 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 29 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 29 | std::vector<u8>& inline_output) override; |
| 30 | 30 | ||
| 31 | void OnOpen(DeviceFD fd) override; | 31 | void OnOpen(DeviceFD fd) override; |
| 32 | void OnClose(DeviceFD fd) override; | 32 | void OnClose(DeviceFD fd) override; |
| @@ -151,21 +151,21 @@ private: | |||
| 151 | }; | 151 | }; |
| 152 | static_assert(sizeof(IoctlGetGpuTime) == 0x10, "IoctlGetGpuTime is incorrect size"); | 152 | static_assert(sizeof(IoctlGetGpuTime) == 0x10, "IoctlGetGpuTime is incorrect size"); |
| 153 | 153 | ||
| 154 | NvResult GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output); | 154 | NvResult GetCharacteristics(std::span<const u8> input, std::vector<u8>& output); |
| 155 | NvResult GetCharacteristics(const std::vector<u8>& input, std::vector<u8>& output, | 155 | NvResult GetCharacteristics(std::span<const u8> input, std::vector<u8>& output, |
| 156 | std::vector<u8>& inline_output); | 156 | std::vector<u8>& inline_output); |
| 157 | 157 | ||
| 158 | NvResult GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output); | 158 | NvResult GetTPCMasks(std::span<const u8> input, std::vector<u8>& output); |
| 159 | NvResult GetTPCMasks(const std::vector<u8>& input, std::vector<u8>& output, | 159 | NvResult GetTPCMasks(std::span<const u8> input, std::vector<u8>& output, |
| 160 | std::vector<u8>& inline_output); | 160 | std::vector<u8>& inline_output); |
| 161 | 161 | ||
| 162 | NvResult GetActiveSlotMask(const std::vector<u8>& input, std::vector<u8>& output); | 162 | NvResult GetActiveSlotMask(std::span<const u8> input, std::vector<u8>& output); |
| 163 | NvResult ZCullGetCtxSize(const std::vector<u8>& input, std::vector<u8>& output); | 163 | NvResult ZCullGetCtxSize(std::span<const u8> input, std::vector<u8>& output); |
| 164 | NvResult ZCullGetInfo(const std::vector<u8>& input, std::vector<u8>& output); | 164 | NvResult ZCullGetInfo(std::span<const u8> input, std::vector<u8>& output); |
| 165 | NvResult ZBCSetTable(const std::vector<u8>& input, std::vector<u8>& output); | 165 | NvResult ZBCSetTable(std::span<const u8> input, std::vector<u8>& output); |
| 166 | NvResult ZBCQueryTable(const std::vector<u8>& input, std::vector<u8>& output); | 166 | NvResult ZBCQueryTable(std::span<const u8> input, std::vector<u8>& output); |
| 167 | NvResult FlushL2(const std::vector<u8>& input, std::vector<u8>& output); | 167 | NvResult FlushL2(std::span<const u8> input, std::vector<u8>& output); |
| 168 | NvResult GetGpuTime(const std::vector<u8>& input, std::vector<u8>& output); | 168 | NvResult GetGpuTime(std::span<const u8> input, std::vector<u8>& output); |
| 169 | 169 | ||
| 170 | EventInterface& events_interface; | 170 | EventInterface& events_interface; |
| 171 | 171 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index e123564c6..d2308fffc 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -46,7 +46,7 @@ nvhost_gpu::~nvhost_gpu() { | |||
| 46 | syncpoint_manager.FreeSyncpoint(channel_syncpoint); | 46 | syncpoint_manager.FreeSyncpoint(channel_syncpoint); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 49 | NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 50 | std::vector<u8>& output) { | 50 | std::vector<u8>& output) { |
| 51 | switch (command.group) { | 51 | switch (command.group) { |
| 52 | case 0x0: | 52 | case 0x0: |
| @@ -98,8 +98,8 @@ NvResult nvhost_gpu::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 98 | return NvResult::NotImplemented; | 98 | return NvResult::NotImplemented; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 101 | NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 102 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 102 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 103 | switch (command.group) { | 103 | switch (command.group) { |
| 104 | case 'H': | 104 | case 'H': |
| 105 | switch (command.cmd) { | 105 | switch (command.cmd) { |
| @@ -112,7 +112,7 @@ NvResult nvhost_gpu::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 112 | return NvResult::NotImplemented; | 112 | return NvResult::NotImplemented; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 115 | NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 116 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 116 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 117 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 117 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 118 | return NvResult::NotImplemented; | 118 | return NvResult::NotImplemented; |
| @@ -121,7 +121,7 @@ NvResult nvhost_gpu::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 121 | void nvhost_gpu::OnOpen(DeviceFD fd) {} | 121 | void nvhost_gpu::OnOpen(DeviceFD fd) {} |
| 122 | void nvhost_gpu::OnClose(DeviceFD fd) {} | 122 | void nvhost_gpu::OnClose(DeviceFD fd) {} |
| 123 | 123 | ||
| 124 | NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 124 | NvResult nvhost_gpu::SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output) { |
| 125 | IoctlSetNvmapFD params{}; | 125 | IoctlSetNvmapFD params{}; |
| 126 | std::memcpy(¶ms, input.data(), input.size()); | 126 | std::memcpy(¶ms, input.data(), input.size()); |
| 127 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | 127 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); |
| @@ -130,7 +130,7 @@ NvResult nvhost_gpu::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& o | |||
| 130 | return NvResult::Success; | 130 | return NvResult::Success; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | NvResult nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8>& output) { | 133 | NvResult nvhost_gpu::SetClientData(std::span<const u8> input, std::vector<u8>& output) { |
| 134 | LOG_DEBUG(Service_NVDRV, "called"); | 134 | LOG_DEBUG(Service_NVDRV, "called"); |
| 135 | 135 | ||
| 136 | IoctlClientData params{}; | 136 | IoctlClientData params{}; |
| @@ -139,7 +139,7 @@ NvResult nvhost_gpu::SetClientData(const std::vector<u8>& input, std::vector<u8> | |||
| 139 | return NvResult::Success; | 139 | return NvResult::Success; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | NvResult nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8>& output) { | 142 | NvResult nvhost_gpu::GetClientData(std::span<const u8> input, std::vector<u8>& output) { |
| 143 | LOG_DEBUG(Service_NVDRV, "called"); | 143 | LOG_DEBUG(Service_NVDRV, "called"); |
| 144 | 144 | ||
| 145 | IoctlClientData params{}; | 145 | IoctlClientData params{}; |
| @@ -149,7 +149,7 @@ NvResult nvhost_gpu::GetClientData(const std::vector<u8>& input, std::vector<u8> | |||
| 149 | return NvResult::Success; | 149 | return NvResult::Success; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | NvResult nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& output) { | 152 | NvResult nvhost_gpu::ZCullBind(std::span<const u8> input, std::vector<u8>& output) { |
| 153 | std::memcpy(&zcull_params, input.data(), input.size()); | 153 | std::memcpy(&zcull_params, input.data(), input.size()); |
| 154 | LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va, | 154 | LOG_DEBUG(Service_NVDRV, "called, gpu_va={:X}, mode={:X}", zcull_params.gpu_va, |
| 155 | zcull_params.mode); | 155 | zcull_params.mode); |
| @@ -158,7 +158,7 @@ NvResult nvhost_gpu::ZCullBind(const std::vector<u8>& input, std::vector<u8>& ou | |||
| 158 | return NvResult::Success; | 158 | return NvResult::Success; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | NvResult nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output) { | 161 | NvResult nvhost_gpu::SetErrorNotifier(std::span<const u8> input, std::vector<u8>& output) { |
| 162 | IoctlSetErrorNotifier params{}; | 162 | IoctlSetErrorNotifier params{}; |
| 163 | std::memcpy(¶ms, input.data(), input.size()); | 163 | std::memcpy(¶ms, input.data(), input.size()); |
| 164 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset, | 164 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, offset={:X}, size={:X}, mem={:X}", params.offset, |
| @@ -168,14 +168,14 @@ NvResult nvhost_gpu::SetErrorNotifier(const std::vector<u8>& input, std::vector< | |||
| 168 | return NvResult::Success; | 168 | return NvResult::Success; |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | NvResult nvhost_gpu::SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output) { | 171 | NvResult nvhost_gpu::SetChannelPriority(std::span<const u8> input, std::vector<u8>& output) { |
| 172 | std::memcpy(&channel_priority, input.data(), input.size()); | 172 | std::memcpy(&channel_priority, input.data(), input.size()); |
| 173 | LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority); | 173 | LOG_DEBUG(Service_NVDRV, "(STUBBED) called, priority={:X}", channel_priority); |
| 174 | 174 | ||
| 175 | return NvResult::Success; | 175 | return NvResult::Success; |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | NvResult nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output) { | 178 | NvResult nvhost_gpu::AllocGPFIFOEx2(std::span<const u8> input, std::vector<u8>& output) { |
| 179 | IoctlAllocGpfifoEx2 params{}; | 179 | IoctlAllocGpfifoEx2 params{}; |
| 180 | std::memcpy(¶ms, input.data(), input.size()); | 180 | std::memcpy(¶ms, input.data(), input.size()); |
| 181 | LOG_WARNING(Service_NVDRV, | 181 | LOG_WARNING(Service_NVDRV, |
| @@ -197,7 +197,7 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8 | |||
| 197 | return NvResult::Success; | 197 | return NvResult::Success; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | NvResult nvhost_gpu::AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output) { | 200 | NvResult nvhost_gpu::AllocateObjectContext(std::span<const u8> input, std::vector<u8>& output) { |
| 201 | IoctlAllocObjCtx params{}; | 201 | IoctlAllocObjCtx params{}; |
| 202 | std::memcpy(¶ms, input.data(), input.size()); | 202 | std::memcpy(¶ms, input.data(), input.size()); |
| 203 | LOG_WARNING(Service_NVDRV, "(STUBBED) called, class_num={:X}, flags={:X}", params.class_num, | 203 | 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> | |||
| 293 | return NvResult::Success; | 293 | return NvResult::Success; |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input, std::vector<u8>& output, | 296 | NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::vector<u8>& output, |
| 297 | bool kickoff) { | 297 | bool kickoff) { |
| 298 | if (input.size() < sizeof(IoctlSubmitGpfifo)) { | 298 | if (input.size() < sizeof(IoctlSubmitGpfifo)) { |
| 299 | UNIMPLEMENTED(); | 299 | UNIMPLEMENTED(); |
| @@ -314,8 +314,7 @@ NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input, std::vector< | |||
| 314 | return SubmitGPFIFOImpl(params, output, std::move(entries)); | 314 | return SubmitGPFIFOImpl(params, output, std::move(entries)); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input, | 317 | NvResult nvhost_gpu::SubmitGPFIFOBase(std::span<const u8> input, std::span<const u8> input_inline, |
| 318 | const std::vector<u8>& input_inline, | ||
| 319 | std::vector<u8>& output) { | 318 | std::vector<u8>& output) { |
| 320 | if (input.size() < sizeof(IoctlSubmitGpfifo)) { | 319 | if (input.size() < sizeof(IoctlSubmitGpfifo)) { |
| 321 | UNIMPLEMENTED(); | 320 | UNIMPLEMENTED(); |
| @@ -328,7 +327,7 @@ NvResult nvhost_gpu::SubmitGPFIFOBase(const std::vector<u8>& input, | |||
| 328 | return SubmitGPFIFOImpl(params, output, std::move(entries)); | 327 | return SubmitGPFIFOImpl(params, output, std::move(entries)); |
| 329 | } | 328 | } |
| 330 | 329 | ||
| 331 | NvResult nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) { | 330 | NvResult nvhost_gpu::GetWaitbase(std::span<const u8> input, std::vector<u8>& output) { |
| 332 | IoctlGetWaitbase params{}; | 331 | IoctlGetWaitbase params{}; |
| 333 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); | 332 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); |
| 334 | LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); | 333 | LOG_INFO(Service_NVDRV, "called, unknown=0x{:X}", params.unknown); |
| @@ -338,7 +337,7 @@ NvResult nvhost_gpu::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& | |||
| 338 | return NvResult::Success; | 337 | return NvResult::Success; |
| 339 | } | 338 | } |
| 340 | 339 | ||
| 341 | NvResult nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output) { | 340 | NvResult nvhost_gpu::ChannelSetTimeout(std::span<const u8> input, std::vector<u8>& output) { |
| 342 | IoctlChannelSetTimeout params{}; | 341 | IoctlChannelSetTimeout params{}; |
| 343 | std::memcpy(¶ms, input.data(), sizeof(IoctlChannelSetTimeout)); | 342 | std::memcpy(¶ms, input.data(), sizeof(IoctlChannelSetTimeout)); |
| 344 | LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout); | 343 | LOG_INFO(Service_NVDRV, "called, timeout=0x{:X}", params.timeout); |
| @@ -346,7 +345,7 @@ NvResult nvhost_gpu::ChannelSetTimeout(const std::vector<u8>& input, std::vector | |||
| 346 | return NvResult::Success; | 345 | return NvResult::Success; |
| 347 | } | 346 | } |
| 348 | 347 | ||
| 349 | NvResult nvhost_gpu::ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output) { | 348 | NvResult nvhost_gpu::ChannelSetTimeslice(std::span<const u8> input, std::vector<u8>& output) { |
| 350 | IoctlSetTimeslice params{}; | 349 | IoctlSetTimeslice params{}; |
| 351 | std::memcpy(¶ms, input.data(), sizeof(IoctlSetTimeslice)); | 350 | std::memcpy(¶ms, input.data(), sizeof(IoctlSetTimeslice)); |
| 352 | LOG_INFO(Service_NVDRV, "called, timeslice=0x{:X}", params.timeslice); | 351 | LOG_INFO(Service_NVDRV, "called, timeslice=0x{:X}", params.timeslice); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h index 1e4ecd55b..3ca58202d 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.h | |||
| @@ -40,12 +40,12 @@ public: | |||
| 40 | NvCore::Container& core); | 40 | NvCore::Container& core); |
| 41 | ~nvhost_gpu() override; | 41 | ~nvhost_gpu() override; |
| 42 | 42 | ||
| 43 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 43 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 44 | std::vector<u8>& output) override; | 44 | std::vector<u8>& output) override; |
| 45 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 45 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 46 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 46 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 47 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 47 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 48 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 48 | std::vector<u8>& inline_output) override; |
| 49 | 49 | ||
| 50 | void OnOpen(DeviceFD fd) override; | 50 | void OnOpen(DeviceFD fd) override; |
| 51 | void OnClose(DeviceFD fd) override; | 51 | void OnClose(DeviceFD fd) override; |
| @@ -186,23 +186,23 @@ private: | |||
| 186 | u32_le channel_priority{}; | 186 | u32_le channel_priority{}; |
| 187 | u32_le channel_timeslice{}; | 187 | u32_le channel_timeslice{}; |
| 188 | 188 | ||
| 189 | NvResult SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output); | 189 | NvResult SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output); |
| 190 | NvResult SetClientData(const std::vector<u8>& input, std::vector<u8>& output); | 190 | NvResult SetClientData(std::span<const u8> input, std::vector<u8>& output); |
| 191 | NvResult GetClientData(const std::vector<u8>& input, std::vector<u8>& output); | 191 | NvResult GetClientData(std::span<const u8> input, std::vector<u8>& output); |
| 192 | NvResult ZCullBind(const std::vector<u8>& input, std::vector<u8>& output); | 192 | NvResult ZCullBind(std::span<const u8> input, std::vector<u8>& output); |
| 193 | NvResult SetErrorNotifier(const std::vector<u8>& input, std::vector<u8>& output); | 193 | NvResult SetErrorNotifier(std::span<const u8> input, std::vector<u8>& output); |
| 194 | NvResult SetChannelPriority(const std::vector<u8>& input, std::vector<u8>& output); | 194 | NvResult SetChannelPriority(std::span<const u8> input, std::vector<u8>& output); |
| 195 | NvResult AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8>& output); | 195 | NvResult AllocGPFIFOEx2(std::span<const u8> input, std::vector<u8>& output); |
| 196 | NvResult AllocateObjectContext(const std::vector<u8>& input, std::vector<u8>& output); | 196 | NvResult AllocateObjectContext(std::span<const u8> input, std::vector<u8>& output); |
| 197 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector<u8>& output, | 197 | NvResult SubmitGPFIFOImpl(IoctlSubmitGpfifo& params, std::vector<u8>& output, |
| 198 | Tegra::CommandList&& entries); | 198 | Tegra::CommandList&& entries); |
| 199 | NvResult SubmitGPFIFOBase(const std::vector<u8>& input, std::vector<u8>& output, | 199 | NvResult SubmitGPFIFOBase(std::span<const u8> input, std::vector<u8>& output, |
| 200 | bool kickoff = false); | 200 | bool kickoff = false); |
| 201 | NvResult SubmitGPFIFOBase(const std::vector<u8>& input, const std::vector<u8>& input_inline, | 201 | NvResult SubmitGPFIFOBase(std::span<const u8> input, std::span<const u8> input_inline, |
| 202 | std::vector<u8>& output); | 202 | std::vector<u8>& output); |
| 203 | NvResult GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output); | 203 | NvResult GetWaitbase(std::span<const u8> input, std::vector<u8>& output); |
| 204 | NvResult ChannelSetTimeout(const std::vector<u8>& input, std::vector<u8>& output); | 204 | NvResult ChannelSetTimeout(std::span<const u8> input, std::vector<u8>& output); |
| 205 | NvResult ChannelSetTimeslice(const std::vector<u8>& input, std::vector<u8>& output); | 205 | NvResult ChannelSetTimeslice(std::span<const u8> input, std::vector<u8>& output); |
| 206 | 206 | ||
| 207 | EventInterface& events_interface; | 207 | EventInterface& events_interface; |
| 208 | NvCore::Container& core; | 208 | NvCore::Container& core; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index 1703f9cc3..0c7aee1b8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -15,7 +15,7 @@ nvhost_nvdec::nvhost_nvdec(Core::System& system_, NvCore::Container& core_) | |||
| 15 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {} | 15 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {} |
| 16 | nvhost_nvdec::~nvhost_nvdec() = default; | 16 | nvhost_nvdec::~nvhost_nvdec() = default; |
| 17 | 17 | ||
| 18 | NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 18 | NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 19 | std::vector<u8>& output) { | 19 | std::vector<u8>& output) { |
| 20 | switch (command.group) { | 20 | switch (command.group) { |
| 21 | case 0x0: | 21 | case 0x0: |
| @@ -55,13 +55,13 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 55 | return NvResult::NotImplemented; | 55 | return NvResult::NotImplemented; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 58 | NvResult nvhost_nvdec::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 59 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 59 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 61 | return NvResult::NotImplemented; | 61 | return NvResult::NotImplemented; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 64 | NvResult nvhost_nvdec::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 65 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 65 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 67 | return NvResult::NotImplemented; | 67 | return NvResult::NotImplemented; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index c1b4e53e8..0d615bbcb 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | |||
| @@ -13,12 +13,12 @@ public: | |||
| 13 | explicit nvhost_nvdec(Core::System& system_, NvCore::Container& core); | 13 | explicit nvhost_nvdec(Core::System& system_, NvCore::Container& core); |
| 14 | ~nvhost_nvdec() override; | 14 | ~nvhost_nvdec() override; |
| 15 | 15 | ||
| 16 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 16 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 17 | std::vector<u8>& output) override; | 17 | std::vector<u8>& output) override; |
| 18 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 18 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 19 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 19 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 20 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 20 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 21 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 21 | std::vector<u8>& inline_output) override; |
| 22 | 22 | ||
| 23 | void OnOpen(DeviceFD fd) override; | 23 | void OnOpen(DeviceFD fd) override; |
| 24 | void OnClose(DeviceFD fd) override; | 24 | void OnClose(DeviceFD fd) override; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 99eede702..7bcef105b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | |||
| @@ -23,7 +23,7 @@ namespace { | |||
| 23 | // Copies count amount of type T from the input vector into the dst vector. | 23 | // Copies count amount of type T from the input vector into the dst vector. |
| 24 | // Returns the number of bytes written into dst. | 24 | // Returns the number of bytes written into dst. |
| 25 | template <typename T> | 25 | template <typename T> |
| 26 | std::size_t SliceVectors(const std::vector<u8>& input, std::vector<T>& dst, std::size_t count, | 26 | std::size_t SliceVectors(std::span<const u8> input, std::vector<T>& dst, std::size_t count, |
| 27 | std::size_t offset) { | 27 | std::size_t offset) { |
| 28 | if (dst.empty()) { | 28 | if (dst.empty()) { |
| 29 | return 0; | 29 | return 0; |
| @@ -63,7 +63,7 @@ nvhost_nvdec_common::~nvhost_nvdec_common() { | |||
| 63 | core.Host1xDeviceFile().syncpts_accumulated.push_back(channel_syncpoint); | 63 | core.Host1xDeviceFile().syncpts_accumulated.push_back(channel_syncpoint); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { | 66 | NvResult nvhost_nvdec_common::SetNVMAPfd(std::span<const u8> input) { |
| 67 | IoctlSetNvmapFD params{}; | 67 | IoctlSetNvmapFD params{}; |
| 68 | std::memcpy(¶ms, input.data(), sizeof(IoctlSetNvmapFD)); | 68 | std::memcpy(¶ms, input.data(), sizeof(IoctlSetNvmapFD)); |
| 69 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | 69 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); |
| @@ -72,7 +72,7 @@ NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { | |||
| 72 | return NvResult::Success; | 72 | return NvResult::Success; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | NvResult nvhost_nvdec_common::Submit(DeviceFD fd, const std::vector<u8>& input, | 75 | NvResult nvhost_nvdec_common::Submit(DeviceFD fd, std::span<const u8> input, |
| 76 | std::vector<u8>& output) { | 76 | std::vector<u8>& output) { |
| 77 | IoctlSubmit params{}; | 77 | IoctlSubmit params{}; |
| 78 | std::memcpy(¶ms, input.data(), sizeof(IoctlSubmit)); | 78 | std::memcpy(¶ms, input.data(), sizeof(IoctlSubmit)); |
| @@ -121,7 +121,7 @@ NvResult nvhost_nvdec_common::Submit(DeviceFD fd, const std::vector<u8>& input, | |||
| 121 | return NvResult::Success; | 121 | return NvResult::Success; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | NvResult nvhost_nvdec_common::GetSyncpoint(const std::vector<u8>& input, std::vector<u8>& output) { | 124 | NvResult nvhost_nvdec_common::GetSyncpoint(std::span<const u8> input, std::vector<u8>& output) { |
| 125 | IoctlGetSyncpoint params{}; | 125 | IoctlGetSyncpoint params{}; |
| 126 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint)); | 126 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetSyncpoint)); |
| 127 | LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param); | 127 | LOG_DEBUG(Service_NVDRV, "called GetSyncpoint, id={}", params.param); |
| @@ -133,7 +133,7 @@ NvResult nvhost_nvdec_common::GetSyncpoint(const std::vector<u8>& input, std::ve | |||
| 133 | return NvResult::Success; | 133 | return NvResult::Success; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | NvResult nvhost_nvdec_common::GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output) { | 136 | NvResult nvhost_nvdec_common::GetWaitbase(std::span<const u8> input, std::vector<u8>& output) { |
| 137 | IoctlGetWaitbase params{}; | 137 | IoctlGetWaitbase params{}; |
| 138 | LOG_CRITICAL(Service_NVDRV, "called WAITBASE"); | 138 | LOG_CRITICAL(Service_NVDRV, "called WAITBASE"); |
| 139 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); | 139 | std::memcpy(¶ms, input.data(), sizeof(IoctlGetWaitbase)); |
| @@ -142,7 +142,7 @@ NvResult nvhost_nvdec_common::GetWaitbase(const std::vector<u8>& input, std::vec | |||
| 142 | return NvResult::Success; | 142 | return NvResult::Success; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vector<u8>& output) { | 145 | NvResult nvhost_nvdec_common::MapBuffer(std::span<const u8> input, std::vector<u8>& output) { |
| 146 | IoctlMapBuffer params{}; | 146 | IoctlMapBuffer params{}; |
| 147 | std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); | 147 | std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); |
| 148 | std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); | 148 | std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); |
| @@ -159,7 +159,7 @@ NvResult nvhost_nvdec_common::MapBuffer(const std::vector<u8>& input, std::vecto | |||
| 159 | return NvResult::Success; | 159 | return NvResult::Success; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output) { | 162 | NvResult nvhost_nvdec_common::UnmapBuffer(std::span<const u8> input, std::vector<u8>& output) { |
| 163 | IoctlMapBuffer params{}; | 163 | IoctlMapBuffer params{}; |
| 164 | std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); | 164 | std::memcpy(¶ms, input.data(), sizeof(IoctlMapBuffer)); |
| 165 | std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); | 165 | std::vector<MapBufferEntry> cmd_buffer_handles(params.num_entries); |
| @@ -173,8 +173,7 @@ NvResult nvhost_nvdec_common::UnmapBuffer(const std::vector<u8>& input, std::vec | |||
| 173 | return NvResult::Success; | 173 | return NvResult::Success; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | NvResult nvhost_nvdec_common::SetSubmitTimeout(const std::vector<u8>& input, | 176 | NvResult nvhost_nvdec_common::SetSubmitTimeout(std::span<const u8> input, std::vector<u8>& output) { |
| 177 | std::vector<u8>& output) { | ||
| 178 | std::memcpy(&submit_timeout, input.data(), input.size()); | 177 | std::memcpy(&submit_timeout, input.data(), input.size()); |
| 179 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); | 178 | LOG_WARNING(Service_NVDRV, "(STUBBED) called"); |
| 180 | return NvResult::Success; | 179 | return NvResult::Success; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index fe76100c8..5af26a26f 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | |||
| @@ -107,13 +107,13 @@ protected: | |||
| 107 | static_assert(sizeof(IoctlMapBuffer) == 0x0C, "IoctlMapBuffer is incorrect size"); | 107 | static_assert(sizeof(IoctlMapBuffer) == 0x0C, "IoctlMapBuffer is incorrect size"); |
| 108 | 108 | ||
| 109 | /// Ioctl command implementations | 109 | /// Ioctl command implementations |
| 110 | NvResult SetNVMAPfd(const std::vector<u8>& input); | 110 | NvResult SetNVMAPfd(std::span<const u8> input); |
| 111 | NvResult Submit(DeviceFD fd, const std::vector<u8>& input, std::vector<u8>& output); | 111 | NvResult Submit(DeviceFD fd, std::span<const u8> input, std::vector<u8>& output); |
| 112 | NvResult GetSyncpoint(const std::vector<u8>& input, std::vector<u8>& output); | 112 | NvResult GetSyncpoint(std::span<const u8> input, std::vector<u8>& output); |
| 113 | NvResult GetWaitbase(const std::vector<u8>& input, std::vector<u8>& output); | 113 | NvResult GetWaitbase(std::span<const u8> input, std::vector<u8>& output); |
| 114 | NvResult MapBuffer(const std::vector<u8>& input, std::vector<u8>& output); | 114 | NvResult MapBuffer(std::span<const u8> input, std::vector<u8>& output); |
| 115 | NvResult UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& output); | 115 | NvResult UnmapBuffer(std::span<const u8> input, std::vector<u8>& output); |
| 116 | NvResult SetSubmitTimeout(const std::vector<u8>& input, std::vector<u8>& output); | 116 | NvResult SetSubmitTimeout(std::span<const u8> input, std::vector<u8>& output); |
| 117 | 117 | ||
| 118 | Kernel::KEvent* QueryEvent(u32 event_id) override; | 118 | Kernel::KEvent* QueryEvent(u32 event_id) override; |
| 119 | 119 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp index bdbc2f9e1..39f30e7c8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.cpp | |||
| @@ -12,7 +12,7 @@ namespace Service::Nvidia::Devices { | |||
| 12 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system_) : nvdevice{system_} {} | 12 | nvhost_nvjpg::nvhost_nvjpg(Core::System& system_) : nvdevice{system_} {} |
| 13 | nvhost_nvjpg::~nvhost_nvjpg() = default; | 13 | nvhost_nvjpg::~nvhost_nvjpg() = default; |
| 14 | 14 | ||
| 15 | NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 15 | NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 16 | std::vector<u8>& output) { | 16 | std::vector<u8>& output) { |
| 17 | switch (command.group) { | 17 | switch (command.group) { |
| 18 | case 'H': | 18 | case 'H': |
| @@ -31,13 +31,13 @@ NvResult nvhost_nvjpg::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 31 | return NvResult::NotImplemented; | 31 | return NvResult::NotImplemented; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 34 | NvResult nvhost_nvjpg::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 35 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 35 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 36 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 36 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 37 | return NvResult::NotImplemented; | 37 | return NvResult::NotImplemented; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 40 | NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 41 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 41 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 42 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 42 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 43 | return NvResult::NotImplemented; | 43 | return NvResult::NotImplemented; |
| @@ -46,7 +46,7 @@ NvResult nvhost_nvjpg::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 46 | void nvhost_nvjpg::OnOpen(DeviceFD fd) {} | 46 | void nvhost_nvjpg::OnOpen(DeviceFD fd) {} |
| 47 | void nvhost_nvjpg::OnClose(DeviceFD fd) {} | 47 | void nvhost_nvjpg::OnClose(DeviceFD fd) {} |
| 48 | 48 | ||
| 49 | NvResult nvhost_nvjpg::SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output) { | 49 | NvResult nvhost_nvjpg::SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output) { |
| 50 | IoctlSetNvmapFD params{}; | 50 | IoctlSetNvmapFD params{}; |
| 51 | std::memcpy(¶ms, input.data(), input.size()); | 51 | std::memcpy(¶ms, input.data(), input.size()); |
| 52 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); | 52 | LOG_DEBUG(Service_NVDRV, "called, fd={}", params.nvmap_fd); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h index 440e7d371..41b57e872 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvjpg.h | |||
| @@ -15,12 +15,12 @@ public: | |||
| 15 | explicit nvhost_nvjpg(Core::System& system_); | 15 | explicit nvhost_nvjpg(Core::System& system_); |
| 16 | ~nvhost_nvjpg() override; | 16 | ~nvhost_nvjpg() override; |
| 17 | 17 | ||
| 18 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 18 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 19 | std::vector<u8>& output) override; | 19 | std::vector<u8>& output) override; |
| 20 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 20 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 21 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 21 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 22 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 22 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 23 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 23 | std::vector<u8>& inline_output) override; |
| 24 | 24 | ||
| 25 | void OnOpen(DeviceFD fd) override; | 25 | void OnOpen(DeviceFD fd) override; |
| 26 | void OnClose(DeviceFD fd) override; | 26 | void OnClose(DeviceFD fd) override; |
| @@ -33,7 +33,7 @@ private: | |||
| 33 | 33 | ||
| 34 | s32_le nvmap_fd{}; | 34 | s32_le nvmap_fd{}; |
| 35 | 35 | ||
| 36 | NvResult SetNVMAPfd(const std::vector<u8>& input, std::vector<u8>& output); | 36 | NvResult SetNVMAPfd(std::span<const u8> input, std::vector<u8>& output); |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | } // namespace Service::Nvidia::Devices | 39 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 73f97136e..b0ea402a7 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -15,7 +15,7 @@ nvhost_vic::nvhost_vic(Core::System& system_, NvCore::Container& core_) | |||
| 15 | 15 | ||
| 16 | nvhost_vic::~nvhost_vic() = default; | 16 | nvhost_vic::~nvhost_vic() = default; |
| 17 | 17 | ||
| 18 | NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 18 | NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 19 | std::vector<u8>& output) { | 19 | std::vector<u8>& output) { |
| 20 | switch (command.group) { | 20 | switch (command.group) { |
| 21 | case 0x0: | 21 | case 0x0: |
| @@ -55,13 +55,13 @@ NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 55 | return NvResult::NotImplemented; | 55 | return NvResult::NotImplemented; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 58 | NvResult nvhost_vic::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 59 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 59 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 60 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 61 | return NvResult::NotImplemented; | 61 | return NvResult::NotImplemented; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 64 | NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 65 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 65 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 66 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 67 | return NvResult::NotImplemented; | 67 | return NvResult::NotImplemented; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index f164caafb..b5e350a83 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -12,12 +12,12 @@ public: | |||
| 12 | explicit nvhost_vic(Core::System& system_, NvCore::Container& core); | 12 | explicit nvhost_vic(Core::System& system_, NvCore::Container& core); |
| 13 | ~nvhost_vic(); | 13 | ~nvhost_vic(); |
| 14 | 14 | ||
| 15 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 15 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 16 | std::vector<u8>& output) override; | 16 | std::vector<u8>& output) override; |
| 17 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 17 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 18 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 18 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 19 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 19 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 20 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 20 | std::vector<u8>& inline_output) override; |
| 21 | 21 | ||
| 22 | void OnOpen(DeviceFD fd) override; | 22 | void OnOpen(DeviceFD fd) override; |
| 23 | void OnClose(DeviceFD fd) override; | 23 | void OnClose(DeviceFD fd) override; |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index fa29db758..29c1e0f01 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -25,7 +25,7 @@ nvmap::nvmap(Core::System& system_, NvCore::Container& container_) | |||
| 25 | 25 | ||
| 26 | nvmap::~nvmap() = default; | 26 | nvmap::~nvmap() = default; |
| 27 | 27 | ||
| 28 | NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 28 | NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 29 | std::vector<u8>& output) { | 29 | std::vector<u8>& output) { |
| 30 | switch (command.group) { | 30 | switch (command.group) { |
| 31 | case 0x1: | 31 | case 0x1: |
| @@ -54,13 +54,13 @@ NvResult nvmap::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | |||
| 54 | return NvResult::NotImplemented; | 54 | return NvResult::NotImplemented; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 57 | NvResult nvmap::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 58 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 58 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 59 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 60 | return NvResult::NotImplemented; | 60 | return NvResult::NotImplemented; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 63 | NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 64 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 64 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 65 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); | 65 | UNIMPLEMENTED_MSG("Unimplemented ioctl={:08X}", command.raw); |
| 66 | return NvResult::NotImplemented; | 66 | return NvResult::NotImplemented; |
| @@ -69,7 +69,7 @@ NvResult nvmap::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | |||
| 69 | void nvmap::OnOpen(DeviceFD fd) {} | 69 | void nvmap::OnOpen(DeviceFD fd) {} |
| 70 | void nvmap::OnClose(DeviceFD fd) {} | 70 | void nvmap::OnClose(DeviceFD fd) {} |
| 71 | 71 | ||
| 72 | NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) { | 72 | NvResult nvmap::IocCreate(std::span<const u8> input, std::vector<u8>& output) { |
| 73 | IocCreateParams params; | 73 | IocCreateParams params; |
| 74 | std::memcpy(¶ms, input.data(), sizeof(params)); | 74 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 75 | LOG_DEBUG(Service_NVDRV, "called, size=0x{:08X}", params.size); | 75 | LOG_DEBUG(Service_NVDRV, "called, size=0x{:08X}", params.size); |
| @@ -89,7 +89,7 @@ NvResult nvmap::IocCreate(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 89 | return NvResult::Success; | 89 | return NvResult::Success; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | NvResult nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) { | 92 | NvResult nvmap::IocAlloc(std::span<const u8> input, std::vector<u8>& output) { |
| 93 | IocAllocParams params; | 93 | IocAllocParams params; |
| 94 | std::memcpy(¶ms, input.data(), sizeof(params)); | 94 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 95 | LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.address); | 95 | LOG_DEBUG(Service_NVDRV, "called, addr={:X}", params.address); |
| @@ -137,7 +137,7 @@ NvResult nvmap::IocAlloc(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 137 | return result; | 137 | return result; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | NvResult nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output) { | 140 | NvResult nvmap::IocGetId(std::span<const u8> input, std::vector<u8>& output) { |
| 141 | IocGetIdParams params; | 141 | IocGetIdParams params; |
| 142 | std::memcpy(¶ms, input.data(), sizeof(params)); | 142 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 143 | 143 | ||
| @@ -161,7 +161,7 @@ NvResult nvmap::IocGetId(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 161 | return NvResult::Success; | 161 | return NvResult::Success; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | NvResult nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) { | 164 | NvResult nvmap::IocFromId(std::span<const u8> input, std::vector<u8>& output) { |
| 165 | IocFromIdParams params; | 165 | IocFromIdParams params; |
| 166 | std::memcpy(¶ms, input.data(), sizeof(params)); | 166 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 167 | 167 | ||
| @@ -192,7 +192,7 @@ NvResult nvmap::IocFromId(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 192 | return NvResult::Success; | 192 | return NvResult::Success; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) { | 195 | NvResult nvmap::IocParam(std::span<const u8> input, std::vector<u8>& output) { |
| 196 | enum class ParamTypes { Size = 1, Alignment = 2, Base = 3, Heap = 4, Kind = 5, Compr = 6 }; | 196 | enum class ParamTypes { Size = 1, Alignment = 2, Base = 3, Heap = 4, Kind = 5, Compr = 6 }; |
| 197 | 197 | ||
| 198 | IocParamParams params; | 198 | IocParamParams params; |
| @@ -241,7 +241,7 @@ NvResult nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) | |||
| 241 | return NvResult::Success; | 241 | return NvResult::Success; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | NvResult nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { | 244 | NvResult nvmap::IocFree(std::span<const u8> input, std::vector<u8>& output) { |
| 245 | IocFreeParams params; | 245 | IocFreeParams params; |
| 246 | std::memcpy(¶ms, input.data(), sizeof(params)); | 246 | std::memcpy(¶ms, input.data(), sizeof(params)); |
| 247 | 247 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index e9bfd0358..82bd3b118 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h | |||
| @@ -26,12 +26,12 @@ public: | |||
| 26 | nvmap(const nvmap&) = delete; | 26 | nvmap(const nvmap&) = delete; |
| 27 | nvmap& operator=(const nvmap&) = delete; | 27 | nvmap& operator=(const nvmap&) = delete; |
| 28 | 28 | ||
| 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 30 | std::vector<u8>& output) override; | 30 | std::vector<u8>& output) override; |
| 31 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 31 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 32 | const std::vector<u8>& inline_input, std::vector<u8>& output) override; | 32 | std::span<const u8> inline_input, std::vector<u8>& output) override; |
| 33 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 33 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 34 | std::vector<u8>& output, std::vector<u8>& inline_output) override; | 34 | std::vector<u8>& inline_output) override; |
| 35 | 35 | ||
| 36 | void OnOpen(DeviceFD fd) override; | 36 | void OnOpen(DeviceFD fd) override; |
| 37 | void OnClose(DeviceFD fd) override; | 37 | void OnClose(DeviceFD fd) override; |
| @@ -106,12 +106,12 @@ private: | |||
| 106 | }; | 106 | }; |
| 107 | static_assert(sizeof(IocGetIdParams) == 8, "IocGetIdParams has wrong size"); | 107 | static_assert(sizeof(IocGetIdParams) == 8, "IocGetIdParams has wrong size"); |
| 108 | 108 | ||
| 109 | NvResult IocCreate(const std::vector<u8>& input, std::vector<u8>& output); | 109 | NvResult IocCreate(std::span<const u8> input, std::vector<u8>& output); |
| 110 | NvResult IocAlloc(const std::vector<u8>& input, std::vector<u8>& output); | 110 | NvResult IocAlloc(std::span<const u8> input, std::vector<u8>& output); |
| 111 | NvResult IocGetId(const std::vector<u8>& input, std::vector<u8>& output); | 111 | NvResult IocGetId(std::span<const u8> input, std::vector<u8>& output); |
| 112 | NvResult IocFromId(const std::vector<u8>& input, std::vector<u8>& output); | 112 | NvResult IocFromId(std::span<const u8> input, std::vector<u8>& output); |
| 113 | NvResult IocParam(const std::vector<u8>& input, std::vector<u8>& output); | 113 | NvResult IocParam(std::span<const u8> input, std::vector<u8>& output); |
| 114 | NvResult IocFree(const std::vector<u8>& input, std::vector<u8>& output); | 114 | NvResult IocFree(std::span<const u8> input, std::vector<u8>& output); |
| 115 | 115 | ||
| 116 | NvCore::Container& container; | 116 | NvCore::Container& container; |
| 117 | NvCore::NvMap& file; | 117 | NvCore::NvMap& file; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 6fc8565c0..52d27e755 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -124,7 +124,7 @@ DeviceFD Module::Open(const std::string& device_name) { | |||
| 124 | return fd; | 124 | return fd; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 127 | NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 128 | std::vector<u8>& output) { | 128 | std::vector<u8>& output) { |
| 129 | if (fd < 0) { | 129 | if (fd < 0) { |
| 130 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); | 130 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); |
| @@ -141,8 +141,8 @@ NvResult Module::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 141 | return itr->second->Ioctl1(fd, command, input, output); | 141 | return itr->second->Ioctl1(fd, command, input, output); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 144 | NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 145 | const std::vector<u8>& inline_input, std::vector<u8>& output) { | 145 | std::span<const u8> inline_input, std::vector<u8>& output) { |
| 146 | if (fd < 0) { | 146 | if (fd < 0) { |
| 147 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); | 147 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); |
| 148 | return NvResult::InvalidState; | 148 | return NvResult::InvalidState; |
| @@ -158,7 +158,7 @@ NvResult Module::Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input | |||
| 158 | return itr->second->Ioctl2(fd, command, input, inline_input, output); | 158 | return itr->second->Ioctl2(fd, command, input, inline_input, output); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 161 | NvResult Module::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 162 | std::vector<u8>& output, std::vector<u8>& inline_output) { | 162 | std::vector<u8>& output, std::vector<u8>& inline_output) { |
| 163 | if (fd < 0) { | 163 | if (fd < 0) { |
| 164 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); | 164 | LOG_ERROR(Service_NVDRV, "Invalid DeviceFD={}!", fd); |
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index f3c81bd88..b09b6e585 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <list> | 8 | #include <list> |
| 9 | #include <memory> | 9 | #include <memory> |
| 10 | #include <span> | ||
| 10 | #include <string> | 11 | #include <string> |
| 11 | #include <unordered_map> | 12 | #include <unordered_map> |
| 12 | #include <vector> | 13 | #include <vector> |
| @@ -79,14 +80,13 @@ public: | |||
| 79 | DeviceFD Open(const std::string& device_name); | 80 | DeviceFD Open(const std::string& device_name); |
| 80 | 81 | ||
| 81 | /// Sends an ioctl command to the specified file descriptor. | 82 | /// Sends an ioctl command to the specified file descriptor. |
| 82 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 83 | NvResult Ioctl1(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output); |
| 83 | std::vector<u8>& output); | ||
| 84 | 84 | ||
| 85 | NvResult Ioctl2(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 85 | NvResult Ioctl2(DeviceFD fd, Ioctl command, std::span<const u8> input, |
| 86 | const std::vector<u8>& inline_input, std::vector<u8>& output); | 86 | std::span<const u8> inline_input, std::vector<u8>& output); |
| 87 | 87 | ||
| 88 | NvResult Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 88 | NvResult Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> input, std::vector<u8>& output, |
| 89 | std::vector<u8>& output, std::vector<u8>& inline_output); | 89 | std::vector<u8>& inline_output); |
| 90 | 90 | ||
| 91 | /// Closes a device file descriptor and returns operation success. | 91 | /// Closes a device file descriptor and returns operation success. |
| 92 | NvResult Close(DeviceFD fd); | 92 | NvResult Close(DeviceFD fd); |
diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp index e601b5da1..bcbe05b0d 100644 --- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp +++ b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp | |||
| @@ -815,8 +815,8 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot, | |||
| 815 | 815 | ||
| 816 | void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId code, u32 flags) { | 816 | void BufferQueueProducer::Transact(Kernel::HLERequestContext& ctx, TransactionId code, u32 flags) { |
| 817 | Status status{Status::NoError}; | 817 | Status status{Status::NoError}; |
| 818 | Parcel parcel_in{ctx.ReadBuffer()}; | 818 | InputParcel parcel_in{ctx.ReadBuffer()}; |
| 819 | Parcel parcel_out{}; | 819 | OutputParcel parcel_out{}; |
| 820 | 820 | ||
| 821 | switch (code) { | 821 | switch (code) { |
| 822 | case TransactionId::Connect: { | 822 | case TransactionId::Connect: { |
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp b/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp index 4043c91f1..769e8c0a3 100644 --- a/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp +++ b/src/core/hle/service/nvflinger/graphic_buffer_producer.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | namespace Service::android { | 10 | namespace Service::android { |
| 11 | 11 | ||
| 12 | QueueBufferInput::QueueBufferInput(Parcel& parcel) { | 12 | QueueBufferInput::QueueBufferInput(InputParcel& parcel) { |
| 13 | parcel.ReadFlattened(*this); | 13 | parcel.ReadFlattened(*this); |
| 14 | } | 14 | } |
| 15 | 15 | ||
diff --git a/src/core/hle/service/nvflinger/graphic_buffer_producer.h b/src/core/hle/service/nvflinger/graphic_buffer_producer.h index 6ea327bbe..2969f0fd5 100644 --- a/src/core/hle/service/nvflinger/graphic_buffer_producer.h +++ b/src/core/hle/service/nvflinger/graphic_buffer_producer.h | |||
| @@ -14,11 +14,11 @@ | |||
| 14 | 14 | ||
| 15 | namespace Service::android { | 15 | namespace Service::android { |
| 16 | 16 | ||
| 17 | class Parcel; | 17 | class InputParcel; |
| 18 | 18 | ||
| 19 | #pragma pack(push, 1) | 19 | #pragma pack(push, 1) |
| 20 | struct QueueBufferInput final { | 20 | struct QueueBufferInput final { |
| 21 | explicit QueueBufferInput(Parcel& parcel); | 21 | explicit QueueBufferInput(InputParcel& parcel); |
| 22 | 22 | ||
| 23 | void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Common::Rectangle<s32>* crop_, | 23 | void Deflate(s64* timestamp_, bool* is_auto_timestamp_, Common::Rectangle<s32>* crop_, |
| 24 | NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_, | 24 | NativeWindowScalingMode* scaling_mode_, NativeWindowTransform* transform_, |
diff --git a/src/core/hle/service/nvflinger/parcel.h b/src/core/hle/service/nvflinger/parcel.h index f3fa2587d..d1b6201e0 100644 --- a/src/core/hle/service/nvflinger/parcel.h +++ b/src/core/hle/service/nvflinger/parcel.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <span> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | 9 | ||
| 9 | #include "common/alignment.h" | 10 | #include "common/alignment.h" |
| @@ -12,18 +13,17 @@ | |||
| 12 | 13 | ||
| 13 | namespace Service::android { | 14 | namespace Service::android { |
| 14 | 15 | ||
| 15 | class Parcel final { | 16 | struct ParcelHeader { |
| 16 | public: | 17 | u32 data_size; |
| 17 | static constexpr std::size_t DefaultBufferSize = 0x40; | 18 | u32 data_offset; |
| 18 | 19 | u32 objects_size; | |
| 19 | Parcel() : buffer(DefaultBufferSize) {} | 20 | u32 objects_offset; |
| 20 | 21 | }; | |
| 21 | template <typename T> | 22 | static_assert(sizeof(ParcelHeader) == 16, "ParcelHeader has wrong size"); |
| 22 | explicit Parcel(const T& out_data) : buffer(DefaultBufferSize) { | ||
| 23 | Write(out_data); | ||
| 24 | } | ||
| 25 | 23 | ||
| 26 | explicit Parcel(std::vector<u8> in_data) : buffer(std::move(in_data)) { | 24 | class InputParcel final { |
| 25 | public: | ||
| 26 | explicit InputParcel(std::span<const u8> in_data) : read_buffer(std::move(in_data)) { | ||
| 27 | DeserializeHeader(); | 27 | DeserializeHeader(); |
| 28 | [[maybe_unused]] const std::u16string token = ReadInterfaceToken(); | 28 | [[maybe_unused]] const std::u16string token = ReadInterfaceToken(); |
| 29 | } | 29 | } |
| @@ -31,9 +31,9 @@ public: | |||
| 31 | template <typename T> | 31 | template <typename T> |
| 32 | void Read(T& val) { | 32 | void Read(T& val) { |
| 33 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); | 33 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); |
| 34 | ASSERT(read_index + sizeof(T) <= buffer.size()); | 34 | ASSERT(read_index + sizeof(T) <= read_buffer.size()); |
| 35 | 35 | ||
| 36 | std::memcpy(&val, buffer.data() + read_index, sizeof(T)); | 36 | std::memcpy(&val, read_buffer.data() + read_index, sizeof(T)); |
| 37 | read_index += sizeof(T); | 37 | read_index += sizeof(T); |
| 38 | read_index = Common::AlignUp(read_index, 4); | 38 | read_index = Common::AlignUp(read_index, 4); |
| 39 | } | 39 | } |
| @@ -62,10 +62,10 @@ public: | |||
| 62 | template <typename T> | 62 | template <typename T> |
| 63 | T ReadUnaligned() { | 63 | T ReadUnaligned() { |
| 64 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); | 64 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); |
| 65 | ASSERT(read_index + sizeof(T) <= buffer.size()); | 65 | ASSERT(read_index + sizeof(T) <= read_buffer.size()); |
| 66 | 66 | ||
| 67 | T val; | 67 | T val; |
| 68 | std::memcpy(&val, buffer.data() + read_index, sizeof(T)); | 68 | std::memcpy(&val, read_buffer.data() + read_index, sizeof(T)); |
| 69 | read_index += sizeof(T); | 69 | read_index += sizeof(T); |
| 70 | return val; | 70 | return val; |
| 71 | } | 71 | } |
| @@ -101,6 +101,31 @@ public: | |||
| 101 | return token; | 101 | return token; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | void DeserializeHeader() { | ||
| 105 | ASSERT(read_buffer.size() > sizeof(ParcelHeader)); | ||
| 106 | |||
| 107 | ParcelHeader header{}; | ||
| 108 | std::memcpy(&header, read_buffer.data(), sizeof(ParcelHeader)); | ||
| 109 | |||
| 110 | read_index = header.data_offset; | ||
| 111 | } | ||
| 112 | |||
| 113 | private: | ||
| 114 | std::span<const u8> read_buffer; | ||
| 115 | std::size_t read_index = 0; | ||
| 116 | }; | ||
| 117 | |||
| 118 | class OutputParcel final { | ||
| 119 | public: | ||
| 120 | static constexpr std::size_t DefaultBufferSize = 0x40; | ||
| 121 | |||
| 122 | OutputParcel() : buffer(DefaultBufferSize) {} | ||
| 123 | |||
| 124 | template <typename T> | ||
| 125 | explicit OutputParcel(const T& out_data) : buffer(DefaultBufferSize) { | ||
| 126 | Write(out_data); | ||
| 127 | } | ||
| 128 | |||
| 104 | template <typename T> | 129 | template <typename T> |
| 105 | void Write(const T& val) { | 130 | void Write(const T& val) { |
| 106 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); | 131 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable."); |
| @@ -133,40 +158,20 @@ public: | |||
| 133 | WriteObject(ptr.get()); | 158 | WriteObject(ptr.get()); |
| 134 | } | 159 | } |
| 135 | 160 | ||
| 136 | void DeserializeHeader() { | ||
| 137 | ASSERT(buffer.size() > sizeof(Header)); | ||
| 138 | |||
| 139 | Header header{}; | ||
| 140 | std::memcpy(&header, buffer.data(), sizeof(Header)); | ||
| 141 | |||
| 142 | read_index = header.data_offset; | ||
| 143 | } | ||
| 144 | |||
| 145 | std::vector<u8> Serialize() const { | 161 | std::vector<u8> Serialize() const { |
| 146 | ASSERT(read_index == 0); | 162 | ParcelHeader header{}; |
| 147 | 163 | header.data_size = static_cast<u32>(write_index - sizeof(ParcelHeader)); | |
| 148 | Header header{}; | 164 | header.data_offset = sizeof(ParcelHeader); |
| 149 | header.data_size = static_cast<u32>(write_index - sizeof(Header)); | ||
| 150 | header.data_offset = sizeof(Header); | ||
| 151 | header.objects_size = 4; | 165 | header.objects_size = 4; |
| 152 | header.objects_offset = static_cast<u32>(sizeof(Header) + header.data_size); | 166 | header.objects_offset = static_cast<u32>(sizeof(ParcelHeader) + header.data_size); |
| 153 | std::memcpy(buffer.data(), &header, sizeof(Header)); | 167 | std::memcpy(buffer.data(), &header, sizeof(ParcelHeader)); |
| 154 | 168 | ||
| 155 | return buffer; | 169 | return buffer; |
| 156 | } | 170 | } |
| 157 | 171 | ||
| 158 | private: | 172 | private: |
| 159 | struct Header { | ||
| 160 | u32 data_size; | ||
| 161 | u32 data_offset; | ||
| 162 | u32 objects_size; | ||
| 163 | u32 objects_offset; | ||
| 164 | }; | ||
| 165 | static_assert(sizeof(Header) == 16, "ParcelHeader has wrong size"); | ||
| 166 | |||
| 167 | mutable std::vector<u8> buffer; | 173 | mutable std::vector<u8> buffer; |
| 168 | std::size_t read_index = 0; | 174 | std::size_t write_index = sizeof(ParcelHeader); |
| 169 | std::size_t write_index = sizeof(Header); | ||
| 170 | }; | 175 | }; |
| 171 | 176 | ||
| 172 | } // namespace Service::android | 177 | } // namespace Service::android |
diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 78f897d3e..01040b32a 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp | |||
| @@ -63,7 +63,7 @@ private: | |||
| 63 | return ctx.ReadBuffer(1); | 63 | return ctx.ReadBuffer(1); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | return std::vector<u8>{}; | 66 | return std::span<const u8>{}; |
| 67 | }(); | 67 | }(); |
| 68 | 68 | ||
| 69 | LOG_DEBUG(Service_PREPO, | 69 | LOG_DEBUG(Service_PREPO, |
| @@ -90,7 +90,7 @@ private: | |||
| 90 | return ctx.ReadBuffer(1); | 90 | return ctx.ReadBuffer(1); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | return std::vector<u8>{}; | 93 | return std::span<const u8>{}; |
| 94 | }(); | 94 | }(); |
| 95 | 95 | ||
| 96 | LOG_DEBUG(Service_PREPO, | 96 | LOG_DEBUG(Service_PREPO, |
| @@ -142,7 +142,7 @@ private: | |||
| 142 | return ctx.ReadBuffer(1); | 142 | return ctx.ReadBuffer(1); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | return std::vector<u8>{}; | 145 | return std::span<const u8>{}; |
| 146 | }(); | 146 | }(); |
| 147 | 147 | ||
| 148 | LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}", | 148 | LOG_DEBUG(Service_PREPO, "called, title_id={:016X}, data1_size={:016X}, data2_size={:016X}", |
| @@ -166,7 +166,7 @@ private: | |||
| 166 | return ctx.ReadBuffer(1); | 166 | return ctx.ReadBuffer(1); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | return std::vector<u8>{}; | 169 | return std::span<const u8>{}; |
| 170 | }(); | 170 | }(); |
| 171 | 171 | ||
| 172 | LOG_DEBUG(Service_PREPO, | 172 | LOG_DEBUG(Service_PREPO, |
diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 9e94a462f..bdb499268 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp | |||
| @@ -208,7 +208,6 @@ void BSD::Bind(Kernel::HLERequestContext& ctx) { | |||
| 208 | const s32 fd = rp.Pop<s32>(); | 208 | const s32 fd = rp.Pop<s32>(); |
| 209 | 209 | ||
| 210 | LOG_DEBUG(Service, "called. fd={} addrlen={}", fd, ctx.GetReadBufferSize()); | 210 | LOG_DEBUG(Service, "called. fd={} addrlen={}", fd, ctx.GetReadBufferSize()); |
| 211 | |||
| 212 | BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer())); | 211 | BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer())); |
| 213 | } | 212 | } |
| 214 | 213 | ||
| @@ -312,7 +311,7 @@ void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) { | |||
| 312 | const u32 level = rp.Pop<u32>(); | 311 | const u32 level = rp.Pop<u32>(); |
| 313 | const OptName optname = static_cast<OptName>(rp.Pop<u32>()); | 312 | const OptName optname = static_cast<OptName>(rp.Pop<u32>()); |
| 314 | 313 | ||
| 315 | const std::vector<u8> buffer = ctx.ReadBuffer(); | 314 | const auto buffer = ctx.ReadBuffer(); |
| 316 | const u8* optval = buffer.empty() ? nullptr : buffer.data(); | 315 | const u8* optval = buffer.empty() ? nullptr : buffer.data(); |
| 317 | size_t optlen = buffer.size(); | 316 | size_t optlen = buffer.size(); |
| 318 | 317 | ||
| @@ -489,7 +488,7 @@ std::pair<s32, Errno> BSD::SocketImpl(Domain domain, Type type, Protocol protoco | |||
| 489 | return {fd, Errno::SUCCESS}; | 488 | return {fd, Errno::SUCCESS}; |
| 490 | } | 489 | } |
| 491 | 490 | ||
| 492 | std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::vector<u8> read_buffer, | 491 | std::pair<s32, Errno> BSD::PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer, |
| 493 | s32 nfds, s32 timeout) { | 492 | s32 nfds, s32 timeout) { |
| 494 | if (write_buffer.size() < nfds * sizeof(PollFD)) { | 493 | if (write_buffer.size() < nfds * sizeof(PollFD)) { |
| 495 | return {-1, Errno::INVAL}; | 494 | return {-1, Errno::INVAL}; |
| @@ -584,7 +583,7 @@ std::pair<s32, Errno> BSD::AcceptImpl(s32 fd, std::vector<u8>& write_buffer) { | |||
| 584 | return {new_fd, Errno::SUCCESS}; | 583 | return {new_fd, Errno::SUCCESS}; |
| 585 | } | 584 | } |
| 586 | 585 | ||
| 587 | Errno BSD::BindImpl(s32 fd, const std::vector<u8>& addr) { | 586 | Errno BSD::BindImpl(s32 fd, std::span<const u8> addr) { |
| 588 | if (!IsFileDescriptorValid(fd)) { | 587 | if (!IsFileDescriptorValid(fd)) { |
| 589 | return Errno::BADF; | 588 | return Errno::BADF; |
| 590 | } | 589 | } |
| @@ -595,7 +594,7 @@ Errno BSD::BindImpl(s32 fd, const std::vector<u8>& addr) { | |||
| 595 | return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in))); | 594 | return Translate(file_descriptors[fd]->socket->Bind(Translate(addr_in))); |
| 596 | } | 595 | } |
| 597 | 596 | ||
| 598 | Errno BSD::ConnectImpl(s32 fd, const std::vector<u8>& addr) { | 597 | Errno BSD::ConnectImpl(s32 fd, std::span<const u8> addr) { |
| 599 | if (!IsFileDescriptorValid(fd)) { | 598 | if (!IsFileDescriptorValid(fd)) { |
| 600 | return Errno::BADF; | 599 | return Errno::BADF; |
| 601 | } | 600 | } |
| @@ -800,15 +799,15 @@ std::pair<s32, Errno> BSD::RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& mess | |||
| 800 | return {ret, bsd_errno}; | 799 | return {ret, bsd_errno}; |
| 801 | } | 800 | } |
| 802 | 801 | ||
| 803 | std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, const std::vector<u8>& message) { | 802 | std::pair<s32, Errno> BSD::SendImpl(s32 fd, u32 flags, std::span<const u8> message) { |
| 804 | if (!IsFileDescriptorValid(fd)) { | 803 | if (!IsFileDescriptorValid(fd)) { |
| 805 | return {-1, Errno::BADF}; | 804 | return {-1, Errno::BADF}; |
| 806 | } | 805 | } |
| 807 | return Translate(file_descriptors[fd]->socket->Send(message, flags)); | 806 | return Translate(file_descriptors[fd]->socket->Send(message, flags)); |
| 808 | } | 807 | } |
| 809 | 808 | ||
| 810 | std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, const std::vector<u8>& message, | 809 | std::pair<s32, Errno> BSD::SendToImpl(s32 fd, u32 flags, std::span<const u8> message, |
| 811 | const std::vector<u8>& addr) { | 810 | std::span<const u8> addr) { |
| 812 | if (!IsFileDescriptorValid(fd)) { | 811 | if (!IsFileDescriptorValid(fd)) { |
| 813 | return {-1, Errno::BADF}; | 812 | return {-1, Errno::BADF}; |
| 814 | } | 813 | } |
diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index 81e855e0f..56bb3f8b1 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <span> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | 9 | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| @@ -44,7 +45,7 @@ private: | |||
| 44 | 45 | ||
| 45 | s32 nfds; | 46 | s32 nfds; |
| 46 | s32 timeout; | 47 | s32 timeout; |
| 47 | std::vector<u8> read_buffer; | 48 | std::span<const u8> read_buffer; |
| 48 | std::vector<u8> write_buffer; | 49 | std::vector<u8> write_buffer; |
| 49 | s32 ret{}; | 50 | s32 ret{}; |
| 50 | Errno bsd_errno{}; | 51 | Errno bsd_errno{}; |
| @@ -65,7 +66,7 @@ private: | |||
| 65 | void Response(Kernel::HLERequestContext& ctx); | 66 | void Response(Kernel::HLERequestContext& ctx); |
| 66 | 67 | ||
| 67 | s32 fd; | 68 | s32 fd; |
| 68 | std::vector<u8> addr; | 69 | std::span<const u8> addr; |
| 69 | Errno bsd_errno{}; | 70 | Errno bsd_errno{}; |
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| @@ -98,7 +99,7 @@ private: | |||
| 98 | 99 | ||
| 99 | s32 fd; | 100 | s32 fd; |
| 100 | u32 flags; | 101 | u32 flags; |
| 101 | std::vector<u8> message; | 102 | std::span<const u8> message; |
| 102 | s32 ret{}; | 103 | s32 ret{}; |
| 103 | Errno bsd_errno{}; | 104 | Errno bsd_errno{}; |
| 104 | }; | 105 | }; |
| @@ -109,8 +110,8 @@ private: | |||
| 109 | 110 | ||
| 110 | s32 fd; | 111 | s32 fd; |
| 111 | u32 flags; | 112 | u32 flags; |
| 112 | std::vector<u8> message; | 113 | std::span<const u8> message; |
| 113 | std::vector<u8> addr; | 114 | std::span<const u8> addr; |
| 114 | s32 ret{}; | 115 | s32 ret{}; |
| 115 | Errno bsd_errno{}; | 116 | Errno bsd_errno{}; |
| 116 | }; | 117 | }; |
| @@ -143,11 +144,11 @@ private: | |||
| 143 | void ExecuteWork(Kernel::HLERequestContext& ctx, Work work); | 144 | void ExecuteWork(Kernel::HLERequestContext& ctx, Work work); |
| 144 | 145 | ||
| 145 | std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol); | 146 | std::pair<s32, Errno> SocketImpl(Domain domain, Type type, Protocol protocol); |
| 146 | std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::vector<u8> read_buffer, | 147 | std::pair<s32, Errno> PollImpl(std::vector<u8>& write_buffer, std::span<const u8> read_buffer, |
| 147 | s32 nfds, s32 timeout); | 148 | s32 nfds, s32 timeout); |
| 148 | std::pair<s32, Errno> AcceptImpl(s32 fd, std::vector<u8>& write_buffer); | 149 | std::pair<s32, Errno> AcceptImpl(s32 fd, std::vector<u8>& write_buffer); |
| 149 | Errno BindImpl(s32 fd, const std::vector<u8>& addr); | 150 | Errno BindImpl(s32 fd, std::span<const u8> addr); |
| 150 | Errno ConnectImpl(s32 fd, const std::vector<u8>& addr); | 151 | Errno ConnectImpl(s32 fd, std::span<const u8> addr); |
| 151 | Errno GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer); | 152 | Errno GetPeerNameImpl(s32 fd, std::vector<u8>& write_buffer); |
| 152 | Errno GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer); | 153 | Errno GetSockNameImpl(s32 fd, std::vector<u8>& write_buffer); |
| 153 | Errno ListenImpl(s32 fd, s32 backlog); | 154 | Errno ListenImpl(s32 fd, s32 backlog); |
| @@ -157,9 +158,9 @@ private: | |||
| 157 | std::pair<s32, Errno> RecvImpl(s32 fd, u32 flags, std::vector<u8>& message); | 158 | std::pair<s32, Errno> RecvImpl(s32 fd, u32 flags, std::vector<u8>& message); |
| 158 | std::pair<s32, Errno> RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message, | 159 | std::pair<s32, Errno> RecvFromImpl(s32 fd, u32 flags, std::vector<u8>& message, |
| 159 | std::vector<u8>& addr); | 160 | std::vector<u8>& addr); |
| 160 | std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, const std::vector<u8>& message); | 161 | std::pair<s32, Errno> SendImpl(s32 fd, u32 flags, std::span<const u8> message); |
| 161 | std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, const std::vector<u8>& message, | 162 | std::pair<s32, Errno> SendToImpl(s32 fd, u32 flags, std::span<const u8> message, |
| 162 | const std::vector<u8>& addr); | 163 | std::span<const u8> addr); |
| 163 | Errno CloseImpl(s32 fd); | 164 | Errno CloseImpl(s32 fd); |
| 164 | 165 | ||
| 165 | s32 FindFreeFileDescriptorHandle() noexcept; | 166 | s32 FindFreeFileDescriptorHandle() noexcept; |
diff --git a/src/core/hle/service/sockets/sfdnsres.cpp b/src/core/hle/service/sockets/sfdnsres.cpp index 097c37d7a..e96eda7f3 100644 --- a/src/core/hle/service/sockets/sfdnsres.cpp +++ b/src/core/hle/service/sockets/sfdnsres.cpp | |||
| @@ -243,4 +243,4 @@ void SFDNSRES::GetAddrInfoRequestWithOptions(Kernel::HLERequestContext& ctx) { | |||
| 243 | rb.Push(0); | 243 | rb.Push(0); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | } // namespace Service::Sockets \ No newline at end of file | 246 | } // namespace Service::Sockets |
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp index 3735e0452..dcf47083f 100644 --- a/src/core/hle/service/ssl/ssl.cpp +++ b/src/core/hle/service/ssl/ssl.cpp | |||
| @@ -101,7 +101,7 @@ private: | |||
| 101 | void ImportServerPki(Kernel::HLERequestContext& ctx) { | 101 | void ImportServerPki(Kernel::HLERequestContext& ctx) { |
| 102 | IPC::RequestParser rp{ctx}; | 102 | IPC::RequestParser rp{ctx}; |
| 103 | const auto certificate_format = rp.PopEnum<CertificateFormat>(); | 103 | const auto certificate_format = rp.PopEnum<CertificateFormat>(); |
| 104 | const auto pkcs_12_certificates = ctx.ReadBuffer(0); | 104 | [[maybe_unused]] const auto pkcs_12_certificates = ctx.ReadBuffer(0); |
| 105 | 105 | ||
| 106 | constexpr u64 server_id = 0; | 106 | constexpr u64 server_id = 0; |
| 107 | 107 | ||
| @@ -113,13 +113,13 @@ private: | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | void ImportClientPki(Kernel::HLERequestContext& ctx) { | 115 | void ImportClientPki(Kernel::HLERequestContext& ctx) { |
| 116 | const auto pkcs_12_certificate = ctx.ReadBuffer(0); | 116 | [[maybe_unused]] const auto pkcs_12_certificate = ctx.ReadBuffer(0); |
| 117 | const auto ascii_password = [&ctx] { | 117 | [[maybe_unused]] const auto ascii_password = [&ctx] { |
| 118 | if (ctx.CanReadBuffer(1)) { | 118 | if (ctx.CanReadBuffer(1)) { |
| 119 | return ctx.ReadBuffer(1); | 119 | return ctx.ReadBuffer(1); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | return std::vector<u8>{}; | 122 | return std::span<const u8>{}; |
| 123 | }(); | 123 | }(); |
| 124 | 124 | ||
| 125 | constexpr u64 client_id = 0; | 125 | constexpr u64 client_id = 0; |
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index bb283e74e..2fb631183 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -603,7 +603,7 @@ private: | |||
| 603 | return; | 603 | return; |
| 604 | } | 604 | } |
| 605 | 605 | ||
| 606 | const auto parcel = android::Parcel{NativeWindow{*buffer_queue_id}}; | 606 | const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; |
| 607 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); | 607 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); |
| 608 | 608 | ||
| 609 | IPC::ResponseBuilder rb{ctx, 4}; | 609 | IPC::ResponseBuilder rb{ctx, 4}; |
| @@ -649,7 +649,7 @@ private: | |||
| 649 | return; | 649 | return; |
| 650 | } | 650 | } |
| 651 | 651 | ||
| 652 | const auto parcel = android::Parcel{NativeWindow{*buffer_queue_id}}; | 652 | const auto parcel = android::OutputParcel{NativeWindow{*buffer_queue_id}}; |
| 653 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); | 653 | const auto buffer_size = ctx.WriteBuffer(parcel.Serialize()); |
| 654 | 654 | ||
| 655 | IPC::ResponseBuilder rb{ctx, 6}; | 655 | IPC::ResponseBuilder rb{ctx, 6}; |
diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp index 282ea1ff9..7494fb62d 100644 --- a/src/core/internal_network/network.cpp +++ b/src/core/internal_network/network.cpp | |||
| @@ -550,7 +550,7 @@ std::pair<s32, Errno> Socket::RecvFrom(int flags, std::vector<u8>& message, Sock | |||
| 550 | return {-1, GetAndLogLastError()}; | 550 | return {-1, GetAndLogLastError()}; |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) { | 553 | std::pair<s32, Errno> Socket::Send(std::span<const u8> message, int flags) { |
| 554 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); | 554 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); |
| 555 | ASSERT(flags == 0); | 555 | ASSERT(flags == 0); |
| 556 | 556 | ||
| @@ -563,7 +563,7 @@ std::pair<s32, Errno> Socket::Send(const std::vector<u8>& message, int flags) { | |||
| 563 | return {-1, GetAndLogLastError()}; | 563 | return {-1, GetAndLogLastError()}; |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | std::pair<s32, Errno> Socket::SendTo(u32 flags, const std::vector<u8>& message, | 566 | std::pair<s32, Errno> Socket::SendTo(u32 flags, std::span<const u8> message, |
| 567 | const SockAddrIn* addr) { | 567 | const SockAddrIn* addr) { |
| 568 | ASSERT(flags == 0); | 568 | ASSERT(flags == 0); |
| 569 | 569 | ||
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp index 1e1c42cea..7a77171c2 100644 --- a/src/core/internal_network/socket_proxy.cpp +++ b/src/core/internal_network/socket_proxy.cpp | |||
| @@ -182,7 +182,7 @@ std::pair<s32, Errno> ProxySocket::ReceivePacket(int flags, std::vector<u8>& mes | |||
| 182 | return {static_cast<u32>(read_bytes), Errno::SUCCESS}; | 182 | return {static_cast<u32>(read_bytes), Errno::SUCCESS}; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | std::pair<s32, Errno> ProxySocket::Send(const std::vector<u8>& message, int flags) { | 185 | std::pair<s32, Errno> ProxySocket::Send(std::span<const u8> message, int flags) { |
| 186 | LOG_WARNING(Network, "(STUBBED) called"); | 186 | LOG_WARNING(Network, "(STUBBED) called"); |
| 187 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); | 187 | ASSERT(message.size() < static_cast<size_t>(std::numeric_limits<int>::max())); |
| 188 | ASSERT(flags == 0); | 188 | ASSERT(flags == 0); |
| @@ -200,7 +200,7 @@ void ProxySocket::SendPacket(ProxyPacket& packet) { | |||
| 200 | } | 200 | } |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, const std::vector<u8>& message, | 203 | std::pair<s32, Errno> ProxySocket::SendTo(u32 flags, std::span<const u8> message, |
| 204 | const SockAddrIn* addr) { | 204 | const SockAddrIn* addr) { |
| 205 | ASSERT(flags == 0); | 205 | ASSERT(flags == 0); |
| 206 | 206 | ||
diff --git a/src/core/internal_network/socket_proxy.h b/src/core/internal_network/socket_proxy.h index f12b5f567..9421492bc 100644 --- a/src/core/internal_network/socket_proxy.h +++ b/src/core/internal_network/socket_proxy.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <mutex> | 6 | #include <mutex> |
| 7 | #include <span> | ||
| 7 | #include <vector> | 8 | #include <vector> |
| 8 | #include <queue> | 9 | #include <queue> |
| 9 | 10 | ||
| @@ -48,11 +49,11 @@ public: | |||
| 48 | std::pair<s32, Errno> ReceivePacket(int flags, std::vector<u8>& message, SockAddrIn* addr, | 49 | std::pair<s32, Errno> ReceivePacket(int flags, std::vector<u8>& message, SockAddrIn* addr, |
| 49 | std::size_t max_length); | 50 | std::size_t max_length); |
| 50 | 51 | ||
| 51 | std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) override; | 52 | std::pair<s32, Errno> Send(std::span<const u8> message, int flags) override; |
| 52 | 53 | ||
| 53 | void SendPacket(ProxyPacket& packet); | 54 | void SendPacket(ProxyPacket& packet); |
| 54 | 55 | ||
| 55 | std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message, | 56 | std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message, |
| 56 | const SockAddrIn* addr) override; | 57 | const SockAddrIn* addr) override; |
| 57 | 58 | ||
| 58 | Errno SetLinger(bool enable, u32 linger) override; | 59 | Errno SetLinger(bool enable, u32 linger) override; |
diff --git a/src/core/internal_network/sockets.h b/src/core/internal_network/sockets.h index 2e328c645..4c7489258 100644 --- a/src/core/internal_network/sockets.h +++ b/src/core/internal_network/sockets.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include <map> | 6 | #include <map> |
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <span> | ||
| 8 | #include <utility> | 9 | #include <utility> |
| 9 | 10 | ||
| 10 | #if defined(_WIN32) | 11 | #if defined(_WIN32) |
| @@ -66,9 +67,9 @@ public: | |||
| 66 | virtual std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, | 67 | virtual std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, |
| 67 | SockAddrIn* addr) = 0; | 68 | SockAddrIn* addr) = 0; |
| 68 | 69 | ||
| 69 | virtual std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) = 0; | 70 | virtual std::pair<s32, Errno> Send(std::span<const u8> message, int flags) = 0; |
| 70 | 71 | ||
| 71 | virtual std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message, | 72 | virtual std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message, |
| 72 | const SockAddrIn* addr) = 0; | 73 | const SockAddrIn* addr) = 0; |
| 73 | 74 | ||
| 74 | virtual Errno SetLinger(bool enable, u32 linger) = 0; | 75 | virtual Errno SetLinger(bool enable, u32 linger) = 0; |
| @@ -138,9 +139,9 @@ public: | |||
| 138 | 139 | ||
| 139 | std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) override; | 140 | std::pair<s32, Errno> RecvFrom(int flags, std::vector<u8>& message, SockAddrIn* addr) override; |
| 140 | 141 | ||
| 141 | std::pair<s32, Errno> Send(const std::vector<u8>& message, int flags) override; | 142 | std::pair<s32, Errno> Send(std::span<const u8> message, int flags) override; |
| 142 | 143 | ||
| 143 | std::pair<s32, Errno> SendTo(u32 flags, const std::vector<u8>& message, | 144 | std::pair<s32, Errno> SendTo(u32 flags, std::span<const u8> message, |
| 144 | const SockAddrIn* addr) override; | 145 | const SockAddrIn* addr) override; |
| 145 | 146 | ||
| 146 | Errno SetLinger(bool enable, u32 linger) override; | 147 | Errno SetLinger(bool enable, u32 linger) override; |
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 77821e047..59dfb8767 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp | |||
| @@ -312,7 +312,7 @@ void Reporter::SaveUnimplementedAppletReport( | |||
| 312 | } | 312 | } |
| 313 | 313 | ||
| 314 | void Reporter::SavePlayReport(PlayReportType type, u64 title_id, | 314 | void Reporter::SavePlayReport(PlayReportType type, u64 title_id, |
| 315 | const std::vector<std::vector<u8>>& data, | 315 | const std::vector<std::span<const u8>>& data, |
| 316 | std::optional<u64> process_id, std::optional<u128> user_id) const { | 316 | std::optional<u64> process_id, std::optional<u128> user_id) const { |
| 317 | if (!IsReportingEnabled()) { | 317 | if (!IsReportingEnabled()) { |
| 318 | return; | 318 | return; |
diff --git a/src/core/reporter.h b/src/core/reporter.h index 9fdb9d6c1..bb11f8e7c 100644 --- a/src/core/reporter.h +++ b/src/core/reporter.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <optional> | 7 | #include <optional> |
| 8 | #include <span> | ||
| 8 | #include <string> | 9 | #include <string> |
| 9 | #include <vector> | 10 | #include <vector> |
| 10 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| @@ -56,7 +57,8 @@ public: | |||
| 56 | System, | 57 | System, |
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | void SavePlayReport(PlayReportType type, u64 title_id, const std::vector<std::vector<u8>>& data, | 60 | void SavePlayReport(PlayReportType type, u64 title_id, |
| 61 | const std::vector<std::span<const u8>>& data, | ||
| 60 | std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const; | 62 | std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const; |
| 61 | 63 | ||
| 62 | // Used by error applet | 64 | // Used by error applet |