From d42e77797e83a6c1ed7291e532041c781881e853 Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 13 Feb 2018 22:21:17 -0500 Subject: nvdrv: Use ReadBuffer/WriteBuffer functions for Ioctl. --- src/core/hle/service/nvdrv/interface.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/core/hle/service/nvdrv') diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 367791da6..13d23291e 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -32,25 +32,13 @@ void NVDRV::Ioctl(Kernel::HLERequestContext& ctx) { u32 fd = rp.Pop(); u32 command = rp.Pop(); + std::vector output(ctx.GetWriteBufferSize()); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - if (ctx.BufferDescriptorA()[0].Size() != 0) { - auto input_buffer = ctx.BufferDescriptorA()[0]; - auto output_buffer = ctx.BufferDescriptorB()[0]; - std::vector input(input_buffer.Size()); - std::vector output(output_buffer.Size()); - Memory::ReadBlock(input_buffer.Address(), input.data(), input_buffer.Size()); - rb.Push(nvdrv->Ioctl(fd, command, input, output)); - Memory::WriteBlock(output_buffer.Address(), output.data(), output_buffer.Size()); - } else { - auto input_buffer = ctx.BufferDescriptorX()[0]; - auto output_buffer = ctx.BufferDescriptorC()[0]; - std::vector input(input_buffer.size); - std::vector output(output_buffer.size); - Memory::ReadBlock(input_buffer.Address(), input.data(), input_buffer.size); - rb.Push(nvdrv->Ioctl(fd, command, input, output)); - Memory::WriteBlock(output_buffer.Address(), output.data(), output_buffer.size); - } + rb.Push(nvdrv->Ioctl(fd, command, ctx.ReadBuffer(), output)); + + ctx.WriteBuffer(output); } void NVDRV::Close(Kernel::HLERequestContext& ctx) { -- cgit v1.2.3 From 516a95721c5ec7ae2f09cb1e7c9757903523d09e Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 13 Feb 2018 23:16:19 -0500 Subject: service: Remove remaining uses of BufferDescriptor*. --- src/core/hle/service/nvdrv/interface.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/core/hle/service/nvdrv') diff --git a/src/core/hle/service/nvdrv/interface.cpp b/src/core/hle/service/nvdrv/interface.cpp index 13d23291e..1e50d218a 100644 --- a/src/core/hle/service/nvdrv/interface.cpp +++ b/src/core/hle/service/nvdrv/interface.cpp @@ -14,9 +14,8 @@ namespace Nvidia { void NVDRV::Open(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_NVDRV, "called"); - auto buffer = ctx.BufferDescriptorA()[0]; - - std::string device_name = Memory::ReadCString(buffer.Address(), buffer.Size()); + const auto& buffer = ctx.ReadBuffer(); + std::string device_name(buffer.begin(), buffer.end()); u32 fd = nvdrv->Open(device_name); IPC::ResponseBuilder rb{ctx, 4}; -- cgit v1.2.3