kern/svc: implement IoPool/Region svc support

This commit is contained in:
Michael Scire 2021-09-18 13:26:21 -07:00 committed by SciresM
parent ce7dd55257
commit f6fb5f2c8d
24 changed files with 944 additions and 301 deletions

View file

@ -141,14 +141,14 @@ namespace ams::kern {
}
}
/* Close all references to our betas. */
/* Close all references to our io regions. */
{
auto it = m_beta_list.begin();
while (it != m_beta_list.end()) {
KBeta *beta = std::addressof(*it);
it = m_beta_list.erase(it);
auto it = m_io_region_list.begin();
while (it != m_io_region_list.end()) {
KIoRegion *io_region = std::addressof(*it);
it = m_io_region_list.erase(it);
beta->Close();
io_region->Close();
}
}
@ -597,6 +597,32 @@ namespace ams::kern {
shmem->Close();
}
void KProcess::AddIoRegion(KIoRegion *io_region) {
/* Lock ourselves, to prevent concurrent access. */
KScopedLightLock lk(m_state_lock);
/* Open a reference to the region. */
io_region->Open();
/* Add the region to our list. */
m_io_region_list.push_back(*io_region);
}
void KProcess::RemoveIoRegion(KIoRegion *io_region) {
/* Remove the region from our list. */
{
/* Lock ourselves, to prevent concurrent access. */
KScopedLightLock lk(m_state_lock);
/* Remove the region from our list. */
m_io_region_list.erase(m_io_region_list.iterator_to(*io_region));
}
/* Close our reference to the io region. */
io_region->Close();
}
Result KProcess::CreateThreadLocalRegion(KProcessAddress *out) {
KThreadLocalPage *tlp = nullptr;
KProcessAddress tlr = Null<KProcessAddress>;