kern: add SvcCreateDeviceAddressSpace, SvcAttachDeviceAddressSpace

This commit is contained in:
Michael Scire 2020-07-14 09:49:49 -07:00 committed by SciresM
parent 04f325cf5a
commit cfddb75398
6 changed files with 311 additions and 15 deletions

View file

@ -43,20 +43,17 @@ namespace ams::kern::svc {
auto &handle_table = process.GetHandleTable();
/* Create the interrupt event. */
KInterruptEvent *event = KInterruptEvent::Create();
R_UNLESS(event != nullptr, svc::ResultOutOfResource());
/* Ensure that we cleanup the event on exit, leaving the only reference as the one in the handle table. */
ON_SCOPE_EXIT { event->Close(); };
KScopedAutoObject event = KInterruptEvent::Create();
R_UNLESS(event.IsNotNull(), svc::ResultOutOfResource());
/* Initialize the event. */
R_TRY(event->Initialize(interrupt_id, type));
/* Register the event. */
R_TRY(KInterruptEvent::Register(event));
R_TRY(KInterruptEvent::Register(event.GetPointerUnsafe()));
/* Add the event to the handle table. */
R_TRY(handle_table.Add(out, event));
R_TRY(handle_table.Add(out, event.GetPointerUnsafe()));
return ResultSuccess();
}