From 65be230fdda302b25447f2f09b06e3238bd09e79 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 19 Feb 2023 14:42:12 -0500 Subject: service: move hle_ipc from kernel --- src/core/hle/service/sockets/bsd.cpp | 66 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src/core/hle/service/sockets/bsd.cpp') diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 2789fa1ed..bce45d321 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -11,8 +11,8 @@ #include "common/microprofile.h" #include "common/socket_types.h" #include "core/core.h" -#include "core/hle/ipc_helpers.h" #include "core/hle/kernel/k_thread.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/sockets/bsd.h" #include "core/hle/service/sockets/sockets_translate.h" #include "core/internal_network/network.h" @@ -42,7 +42,7 @@ void BSD::PollWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->PollImpl(write_buffer, read_buffer, nfds, timeout); } -void BSD::PollWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::PollWork::Response(HLERequestContext& ctx) { if (write_buffer.size() > 0) { ctx.WriteBuffer(write_buffer); } @@ -57,7 +57,7 @@ void BSD::AcceptWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->AcceptImpl(fd, write_buffer); } -void BSD::AcceptWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::AcceptWork::Response(HLERequestContext& ctx) { if (write_buffer.size() > 0) { ctx.WriteBuffer(write_buffer); } @@ -73,7 +73,7 @@ void BSD::ConnectWork::Execute(BSD* bsd) { bsd_errno = bsd->ConnectImpl(fd, addr); } -void BSD::ConnectWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::ConnectWork::Response(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(bsd_errno == Errno::SUCCESS ? 0 : -1); @@ -84,7 +84,7 @@ void BSD::RecvWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->RecvImpl(fd, flags, message); } -void BSD::RecvWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::RecvWork::Response(HLERequestContext& ctx) { ctx.WriteBuffer(message); IPC::ResponseBuilder rb{ctx, 4}; @@ -97,7 +97,7 @@ void BSD::RecvFromWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->RecvFromImpl(fd, flags, message, addr); } -void BSD::RecvFromWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::RecvFromWork::Response(HLERequestContext& ctx) { ctx.WriteBuffer(message, 0); if (!addr.empty()) { ctx.WriteBuffer(addr, 1); @@ -114,7 +114,7 @@ void BSD::SendWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->SendImpl(fd, flags, message); } -void BSD::SendWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::SendWork::Response(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(ret); @@ -125,14 +125,14 @@ void BSD::SendToWork::Execute(BSD* bsd) { std::tie(ret, bsd_errno) = bsd->SendToImpl(fd, flags, message, addr); } -void BSD::SendToWork::Response(Kernel::HLERequestContext& ctx) { +void BSD::SendToWork::Response(HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); rb.Push(ret); rb.PushEnum(bsd_errno); } -void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { +void BSD::RegisterClient(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; @@ -141,7 +141,7 @@ void BSD::RegisterClient(Kernel::HLERequestContext& ctx) { rb.Push(0); // bsd errno } -void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { +void BSD::StartMonitoring(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; @@ -149,7 +149,7 @@ void BSD::StartMonitoring(Kernel::HLERequestContext& ctx) { rb.Push(ResultSuccess); } -void BSD::Socket(Kernel::HLERequestContext& ctx) { +void BSD::Socket(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u32 domain = rp.Pop(); const u32 type = rp.Pop(); @@ -166,7 +166,7 @@ void BSD::Socket(Kernel::HLERequestContext& ctx) { rb.PushEnum(bsd_errno); } -void BSD::Select(Kernel::HLERequestContext& ctx) { +void BSD::Select(HLERequestContext& ctx) { LOG_WARNING(Service, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -176,7 +176,7 @@ void BSD::Select(Kernel::HLERequestContext& ctx) { rb.Push(0); // bsd errno } -void BSD::Poll(Kernel::HLERequestContext& ctx) { +void BSD::Poll(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 nfds = rp.Pop(); const s32 timeout = rp.Pop(); @@ -191,7 +191,7 @@ void BSD::Poll(Kernel::HLERequestContext& ctx) { }); } -void BSD::Accept(Kernel::HLERequestContext& ctx) { +void BSD::Accept(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -203,7 +203,7 @@ void BSD::Accept(Kernel::HLERequestContext& ctx) { }); } -void BSD::Bind(Kernel::HLERequestContext& ctx) { +void BSD::Bind(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -211,7 +211,7 @@ void BSD::Bind(Kernel::HLERequestContext& ctx) { BuildErrnoResponse(ctx, BindImpl(fd, ctx.ReadBuffer())); } -void BSD::Connect(Kernel::HLERequestContext& ctx) { +void BSD::Connect(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -223,7 +223,7 @@ void BSD::Connect(Kernel::HLERequestContext& ctx) { }); } -void BSD::GetPeerName(Kernel::HLERequestContext& ctx) { +void BSD::GetPeerName(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -241,7 +241,7 @@ void BSD::GetPeerName(Kernel::HLERequestContext& ctx) { rb.Push(static_cast(write_buffer.size())); } -void BSD::GetSockName(Kernel::HLERequestContext& ctx) { +void BSD::GetSockName(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -259,7 +259,7 @@ void BSD::GetSockName(Kernel::HLERequestContext& ctx) { rb.Push(static_cast(write_buffer.size())); } -void BSD::GetSockOpt(Kernel::HLERequestContext& ctx) { +void BSD::GetSockOpt(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); const u32 level = rp.Pop(); @@ -278,7 +278,7 @@ void BSD::GetSockOpt(Kernel::HLERequestContext& ctx) { rb.Push(static_cast(optval.size())); } -void BSD::Listen(Kernel::HLERequestContext& ctx) { +void BSD::Listen(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); const s32 backlog = rp.Pop(); @@ -288,7 +288,7 @@ void BSD::Listen(Kernel::HLERequestContext& ctx) { BuildErrnoResponse(ctx, ListenImpl(fd, backlog)); } -void BSD::Fcntl(Kernel::HLERequestContext& ctx) { +void BSD::Fcntl(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); const s32 cmd = rp.Pop(); @@ -304,7 +304,7 @@ void BSD::Fcntl(Kernel::HLERequestContext& ctx) { rb.PushEnum(bsd_errno); } -void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) { +void BSD::SetSockOpt(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -328,7 +328,7 @@ void BSD::SetSockOpt(Kernel::HLERequestContext& ctx) { BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optlen, optval)); } -void BSD::Shutdown(Kernel::HLERequestContext& ctx) { +void BSD::Shutdown(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -339,7 +339,7 @@ void BSD::Shutdown(Kernel::HLERequestContext& ctx) { BuildErrnoResponse(ctx, ShutdownImpl(fd, how)); } -void BSD::Recv(Kernel::HLERequestContext& ctx) { +void BSD::Recv(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -354,7 +354,7 @@ void BSD::Recv(Kernel::HLERequestContext& ctx) { }); } -void BSD::RecvFrom(Kernel::HLERequestContext& ctx) { +void BSD::RecvFrom(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -371,7 +371,7 @@ void BSD::RecvFrom(Kernel::HLERequestContext& ctx) { }); } -void BSD::Send(Kernel::HLERequestContext& ctx) { +void BSD::Send(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -386,7 +386,7 @@ void BSD::Send(Kernel::HLERequestContext& ctx) { }); } -void BSD::SendTo(Kernel::HLERequestContext& ctx) { +void BSD::SendTo(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); const u32 flags = rp.Pop(); @@ -402,7 +402,7 @@ void BSD::SendTo(Kernel::HLERequestContext& ctx) { }); } -void BSD::Write(Kernel::HLERequestContext& ctx) { +void BSD::Write(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -415,7 +415,7 @@ void BSD::Write(Kernel::HLERequestContext& ctx) { }); } -void BSD::Read(Kernel::HLERequestContext& ctx) { +void BSD::Read(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -427,7 +427,7 @@ void BSD::Read(Kernel::HLERequestContext& ctx) { rb.Push(0); // bsd errno } -void BSD::Close(Kernel::HLERequestContext& ctx) { +void BSD::Close(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop(); @@ -436,7 +436,7 @@ void BSD::Close(Kernel::HLERequestContext& ctx) { BuildErrnoResponse(ctx, CloseImpl(fd)); } -void BSD::EventFd(Kernel::HLERequestContext& ctx) { +void BSD::EventFd(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const u64 initval = rp.Pop(); const u32 flags = rp.Pop(); @@ -447,7 +447,7 @@ void BSD::EventFd(Kernel::HLERequestContext& ctx) { } template -void BSD::ExecuteWork(Kernel::HLERequestContext& ctx, Work work) { +void BSD::ExecuteWork(HLERequestContext& ctx, Work work) { work.Execute(this); work.Response(ctx); } @@ -862,7 +862,7 @@ bool BSD::IsFileDescriptorValid(s32 fd) const noexcept { return true; } -void BSD::BuildErrnoResponse(Kernel::HLERequestContext& ctx, Errno bsd_errno) const noexcept { +void BSD::BuildErrnoResponse(HLERequestContext& ctx, Errno bsd_errno) const noexcept { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); -- cgit v1.2.3