mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-26 00:15:42 +01:00
k_server_session: process for guest servers
This commit is contained in:
parent
419055e484
commit
35501ba41c
File diff suppressed because it is too large
Load Diff
@ -49,14 +49,21 @@ public:
|
||||
bool IsSignaled() const override;
|
||||
void OnClientClosed();
|
||||
|
||||
/// TODO: flesh these out to match the real kernel
|
||||
Result OnRequest(KSessionRequest* request);
|
||||
Result SendReply(bool is_hle = false);
|
||||
Result ReceiveRequest(std::shared_ptr<Service::HLERequestContext>* out_context = nullptr,
|
||||
Result SendReply(uintptr_t server_message, uintptr_t server_buffer_size,
|
||||
KPhysicalAddress server_message_paddr, bool is_hle = false);
|
||||
Result ReceiveRequest(uintptr_t server_message, uintptr_t server_buffer_size,
|
||||
KPhysicalAddress server_message_paddr,
|
||||
std::shared_ptr<Service::HLERequestContext>* out_context = nullptr,
|
||||
std::weak_ptr<Service::SessionRequestManager> manager = {});
|
||||
|
||||
Result SendReplyHLE() {
|
||||
return SendReply(true);
|
||||
R_RETURN(this->SendReply(0, 0, 0, true));
|
||||
}
|
||||
|
||||
Result ReceiveRequestHLE(std::shared_ptr<Service::HLERequestContext>* out_context,
|
||||
std::weak_ptr<Service::SessionRequestManager> manager) {
|
||||
R_RETURN(this->ReceiveRequest(0, 0, 0, out_context, manager));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -18,13 +18,13 @@ public:
|
||||
static constexpr inline u64 NullTag = 0;
|
||||
|
||||
public:
|
||||
enum class ReceiveListCountType : u32 {
|
||||
None = 0,
|
||||
ToMessageBuffer = 1,
|
||||
ToSingleBuffer = 2,
|
||||
enum ReceiveListCountType : u32 {
|
||||
ReceiveListCountType_None = 0,
|
||||
ReceiveListCountType_ToMessageBuffer = 1,
|
||||
ReceiveListCountType_ToSingleBuffer = 2,
|
||||
|
||||
CountOffset = 2,
|
||||
CountMax = 13,
|
||||
ReceiveListCountType_CountOffset = 2,
|
||||
ReceiveListCountType_CountMax = 13,
|
||||
};
|
||||
|
||||
private:
|
||||
@ -591,16 +591,16 @@ public:
|
||||
// Add the size of the receive list.
|
||||
const auto count = hdr.GetReceiveListCount();
|
||||
switch (count) {
|
||||
case MessageHeader::ReceiveListCountType::None:
|
||||
case MessageHeader::ReceiveListCountType_None:
|
||||
break;
|
||||
case MessageHeader::ReceiveListCountType::ToMessageBuffer:
|
||||
case MessageHeader::ReceiveListCountType_ToMessageBuffer:
|
||||
break;
|
||||
case MessageHeader::ReceiveListCountType::ToSingleBuffer:
|
||||
case MessageHeader::ReceiveListCountType_ToSingleBuffer:
|
||||
msg_size += ReceiveListEntry::GetDataSize();
|
||||
break;
|
||||
default:
|
||||
msg_size += (static_cast<s32>(count) -
|
||||
static_cast<s32>(MessageHeader::ReceiveListCountType::CountOffset)) *
|
||||
static_cast<s32>(MessageHeader::ReceiveListCountType_CountOffset)) *
|
||||
ReceiveListEntry::GetDataSize();
|
||||
break;
|
||||
}
|
||||
|
@ -48,8 +48,7 @@ Result ReplyAndReceiveImpl(KernelCore& kernel, int32_t* out_index, uintptr_t mes
|
||||
};
|
||||
|
||||
// Send the reply.
|
||||
R_TRY(session->SendReply());
|
||||
// R_TRY(session->SendReply(message, buffer_size, message_paddr));
|
||||
R_TRY(session->SendReply(message, buffer_size, message_paddr));
|
||||
}
|
||||
|
||||
// Receive a message.
|
||||
@ -85,8 +84,7 @@ Result ReplyAndReceiveImpl(KernelCore& kernel, int32_t* out_index, uintptr_t mes
|
||||
if (R_SUCCEEDED(result)) {
|
||||
KServerSession* session = objs[index]->DynamicCast<KServerSession*>();
|
||||
if (session != nullptr) {
|
||||
// result = session->ReceiveRequest(message, buffer_size, message_paddr);
|
||||
result = session->ReceiveRequest();
|
||||
result = session->ReceiveRequest(message, buffer_size, message_paddr);
|
||||
if (ResultNotFound == result) {
|
||||
continue;
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ constexpr Result ResultInvalidState{ErrorModule::Kernel, 125};
|
||||
constexpr Result ResultReservedUsed{ErrorModule::Kernel, 126};
|
||||
constexpr Result ResultPortClosed{ErrorModule::Kernel, 131};
|
||||
constexpr Result ResultLimitReached{ErrorModule::Kernel, 132};
|
||||
constexpr Result ResultReceiveListBroken{ErrorModule::Kernel, 258};
|
||||
constexpr Result ResultOutOfAddressSpace{ErrorModule::Kernel, 259};
|
||||
constexpr Result ResultMessageTooLarge{ErrorModule::Kernel, 260};
|
||||
constexpr Result ResultInvalidId{ErrorModule::Kernel, 519};
|
||||
|
||||
} // namespace Kernel
|
||||
|
@ -372,7 +372,7 @@ Result ServerManager::OnSessionEvent(Kernel::KServerSession* session,
|
||||
|
||||
// Try to receive a message.
|
||||
std::shared_ptr<HLERequestContext> context;
|
||||
rc = session->ReceiveRequest(&context, manager);
|
||||
rc = session->ReceiveRequestHLE(&context, manager);
|
||||
|
||||
// If the session has been closed, we're done.
|
||||
if (rc == Kernel::ResultSessionClosed) {
|
||||
|
Loading…
Reference in New Issue
Block a user