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;
|
bool IsSignaled() const override;
|
||||||
void OnClientClosed();
|
void OnClientClosed();
|
||||||
|
|
||||||
/// TODO: flesh these out to match the real kernel
|
|
||||||
Result OnRequest(KSessionRequest* request);
|
Result OnRequest(KSessionRequest* request);
|
||||||
Result SendReply(bool is_hle = false);
|
Result SendReply(uintptr_t server_message, uintptr_t server_buffer_size,
|
||||||
Result ReceiveRequest(std::shared_ptr<Service::HLERequestContext>* out_context = nullptr,
|
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 = {});
|
std::weak_ptr<Service::SessionRequestManager> manager = {});
|
||||||
|
|
||||||
Result SendReplyHLE() {
|
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:
|
private:
|
||||||
|
@ -18,13 +18,13 @@ public:
|
|||||||
static constexpr inline u64 NullTag = 0;
|
static constexpr inline u64 NullTag = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class ReceiveListCountType : u32 {
|
enum ReceiveListCountType : u32 {
|
||||||
None = 0,
|
ReceiveListCountType_None = 0,
|
||||||
ToMessageBuffer = 1,
|
ReceiveListCountType_ToMessageBuffer = 1,
|
||||||
ToSingleBuffer = 2,
|
ReceiveListCountType_ToSingleBuffer = 2,
|
||||||
|
|
||||||
CountOffset = 2,
|
ReceiveListCountType_CountOffset = 2,
|
||||||
CountMax = 13,
|
ReceiveListCountType_CountMax = 13,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -591,16 +591,16 @@ public:
|
|||||||
// Add the size of the receive list.
|
// Add the size of the receive list.
|
||||||
const auto count = hdr.GetReceiveListCount();
|
const auto count = hdr.GetReceiveListCount();
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case MessageHeader::ReceiveListCountType::None:
|
case MessageHeader::ReceiveListCountType_None:
|
||||||
break;
|
break;
|
||||||
case MessageHeader::ReceiveListCountType::ToMessageBuffer:
|
case MessageHeader::ReceiveListCountType_ToMessageBuffer:
|
||||||
break;
|
break;
|
||||||
case MessageHeader::ReceiveListCountType::ToSingleBuffer:
|
case MessageHeader::ReceiveListCountType_ToSingleBuffer:
|
||||||
msg_size += ReceiveListEntry::GetDataSize();
|
msg_size += ReceiveListEntry::GetDataSize();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
msg_size += (static_cast<s32>(count) -
|
msg_size += (static_cast<s32>(count) -
|
||||||
static_cast<s32>(MessageHeader::ReceiveListCountType::CountOffset)) *
|
static_cast<s32>(MessageHeader::ReceiveListCountType_CountOffset)) *
|
||||||
ReceiveListEntry::GetDataSize();
|
ReceiveListEntry::GetDataSize();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,7 @@ Result ReplyAndReceiveImpl(KernelCore& kernel, int32_t* out_index, uintptr_t mes
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Send the reply.
|
// 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.
|
// Receive a message.
|
||||||
@ -85,8 +84,7 @@ Result ReplyAndReceiveImpl(KernelCore& kernel, int32_t* out_index, uintptr_t mes
|
|||||||
if (R_SUCCEEDED(result)) {
|
if (R_SUCCEEDED(result)) {
|
||||||
KServerSession* session = objs[index]->DynamicCast<KServerSession*>();
|
KServerSession* session = objs[index]->DynamicCast<KServerSession*>();
|
||||||
if (session != nullptr) {
|
if (session != nullptr) {
|
||||||
// result = session->ReceiveRequest(message, buffer_size, message_paddr);
|
result = session->ReceiveRequest(message, buffer_size, message_paddr);
|
||||||
result = session->ReceiveRequest();
|
|
||||||
if (ResultNotFound == result) {
|
if (ResultNotFound == result) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,9 @@ constexpr Result ResultInvalidState{ErrorModule::Kernel, 125};
|
|||||||
constexpr Result ResultReservedUsed{ErrorModule::Kernel, 126};
|
constexpr Result ResultReservedUsed{ErrorModule::Kernel, 126};
|
||||||
constexpr Result ResultPortClosed{ErrorModule::Kernel, 131};
|
constexpr Result ResultPortClosed{ErrorModule::Kernel, 131};
|
||||||
constexpr Result ResultLimitReached{ErrorModule::Kernel, 132};
|
constexpr Result ResultLimitReached{ErrorModule::Kernel, 132};
|
||||||
|
constexpr Result ResultReceiveListBroken{ErrorModule::Kernel, 258};
|
||||||
constexpr Result ResultOutOfAddressSpace{ErrorModule::Kernel, 259};
|
constexpr Result ResultOutOfAddressSpace{ErrorModule::Kernel, 259};
|
||||||
|
constexpr Result ResultMessageTooLarge{ErrorModule::Kernel, 260};
|
||||||
constexpr Result ResultInvalidId{ErrorModule::Kernel, 519};
|
constexpr Result ResultInvalidId{ErrorModule::Kernel, 519};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
@ -372,7 +372,7 @@ Result ServerManager::OnSessionEvent(Kernel::KServerSession* session,
|
|||||||
|
|
||||||
// Try to receive a message.
|
// Try to receive a message.
|
||||||
std::shared_ptr<HLERequestContext> context;
|
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 the session has been closed, we're done.
|
||||||
if (rc == Kernel::ResultSessionClosed) {
|
if (rc == Kernel::ResultSessionClosed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user