mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-16 16:14:25 -04:00
kern: implement SvcSendSyncRequest(WithUserBuffer)
This commit is contained in:
parent
4f12449acf
commit
1b2203d102
8 changed files with 228 additions and 10 deletions
|
@ -28,4 +28,50 @@ namespace ams::kern {
|
|||
MESOSPHERE_ASSERT_THIS();
|
||||
}
|
||||
|
||||
Result KClientSession::SendSyncRequest(uintptr_t address, size_t size) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
/* Create a session request. */
|
||||
KSessionRequest *request = KSessionRequest::Create();
|
||||
R_UNLESS(request != nullptr, svc::ResultOutOfResource());
|
||||
ON_SCOPE_EXIT { request->Close(); };
|
||||
|
||||
/* Initialize the request. */
|
||||
request->Initialize(nullptr, address, size);
|
||||
|
||||
/* Send the request. */
|
||||
{
|
||||
KScopedSchedulerLock sl;
|
||||
|
||||
GetCurrentThread().SetSyncedObject(nullptr, ResultSuccess());
|
||||
|
||||
R_TRY(this->parent->OnRequest(request));
|
||||
}
|
||||
|
||||
/* Get the result. */
|
||||
KSynchronizationObject *dummy;
|
||||
return GetCurrentThread().GetWaitResult(std::addressof(dummy));
|
||||
}
|
||||
|
||||
Result KClientSession::SendAsyncRequest(KWritableEvent *event, uintptr_t address, size_t size) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
/* Create a session request. */
|
||||
KSessionRequest *request = KSessionRequest::Create();
|
||||
R_UNLESS(request != nullptr, svc::ResultOutOfResource());
|
||||
ON_SCOPE_EXIT { request->Close(); };
|
||||
|
||||
/* Initialize the request. */
|
||||
request->Initialize(event, address, size);
|
||||
|
||||
/* Send the request. */
|
||||
{
|
||||
KScopedSchedulerLock sl;
|
||||
|
||||
R_TRY(this->parent->OnRequest(request));
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue