sys_interrupt: Save ID of self tag/handler

This commit is contained in:
Eladash 2021-05-07 21:55:06 +03:00 committed by Ivan
parent 363cc60c82
commit 1e1880893a
3 changed files with 20 additions and 20 deletions

View File

@ -9,6 +9,19 @@
LOG_CHANNEL(sys_interrupt);
lv2_int_tag::lv2_int_tag() noexcept
: id(idm::last_id())
{
}
lv2_int_serv::lv2_int_serv(const std::shared_ptr<named_thread<ppu_thread>>& thread, u64 arg1, u64 arg2) noexcept
: id(idm::last_id())
, thread(thread)
, arg1(arg1)
, arg2(arg2)
{
}
void lv2_int_serv::exec() const
{
thread->cmd_list

View File

@ -10,23 +10,22 @@ struct lv2_int_tag final : lv2_obj
{
static const u32 id_base = 0x0a000000;
const u32 id;
std::weak_ptr<struct lv2_int_serv> handler;
lv2_int_tag() noexcept;
};
struct lv2_int_serv final : lv2_obj
{
static const u32 id_base = 0x0b000000;
const u32 id;
const std::shared_ptr<named_thread<ppu_thread>> thread;
const u64 arg1;
const u64 arg2;
lv2_int_serv(const std::shared_ptr<named_thread<ppu_thread>>& thread, u64 arg1, u64 arg2)
: thread(thread)
, arg1(arg1)
, arg2(arg2)
{
}
lv2_int_serv(const std::shared_ptr<named_thread<ppu_thread>>& thread, u64 arg1, u64 arg2) noexcept;
void exec() const;
void join() const;

View File

@ -1948,25 +1948,13 @@ error_code raw_spu_destroy(ppu_thread& ppu, u32 id)
// SLEEP
lv2_obj::sleep(ppu);
handler->join();
to_remove.emplace_back(std::move(handler), 0);
to_remove.emplace_back(std::move(handler), +handler->id);
}
to_remove.emplace_back(std::move(tag), 0);
to_remove.emplace_back(std::move(tag), +tag->id);
}
}
// Scan all kernel objects to determine IDs
idm::select<lv2_obj>([&](u32 id, lv2_obj& obj)
{
for (auto& pair : to_remove)
{
if (pair.first.get() == std::addressof(obj))
{
pair.second = id;
}
}
});
// Remove IDs
for (auto&& pair : to_remove)
{