kern: update handle table init

This commit is contained in:
Michael Scire 2022-10-11 20:50:32 -07:00 committed by SciresM
parent d00406e089
commit 752704a798

View file

@ -70,15 +70,20 @@ namespace ams::kern {
u16 m_next_linear_id; u16 m_next_linear_id;
u16 m_count; u16 m_count;
public: public:
constexpr explicit KHandleTable(util::ConstantInitializeTag) : m_entry_infos(), m_objects(), m_lock(), m_free_head_index(-1), m_table_size(), m_max_count(), m_next_linear_id(MinLinearId), m_count() { /* ... */ } constexpr explicit KHandleTable(util::ConstantInitializeTag) : m_entry_infos(), m_objects(), m_lock(), m_free_head_index(-1), m_table_size(), m_max_count(), m_next_linear_id(), m_count() { /* ... */ }
explicit KHandleTable() : m_lock(), m_free_head_index(-1), m_count() { MESOSPHERE_ASSERT_THIS(); } explicit KHandleTable() : m_lock(), m_free_head_index(-1), m_table_size(), m_max_count(), m_next_linear_id(), m_count() { MESOSPHERE_ASSERT_THIS(); }
constexpr MESOSPHERE_NOINLINE_IF_DEBUG Result Initialize(s32 size) { MESOSPHERE_NOINLINE_IF_DEBUG Result Initialize(s32 size) {
MESOSPHERE_ASSERT_THIS(); MESOSPHERE_ASSERT_THIS();
/* Check that the table size is valid. */
R_UNLESS(size <= static_cast<s32>(MaxTableSize), svc::ResultOutOfMemory()); R_UNLESS(size <= static_cast<s32>(MaxTableSize), svc::ResultOutOfMemory());
/* Lock. */
KScopedDisableDispatch dd;
KScopedSpinLock lk(m_lock);
/* Initialize all fields. */ /* Initialize all fields. */
m_max_count = 0; m_max_count = 0;
m_table_size = (size <= 0) ? MaxTableSize : size; m_table_size = (size <= 0) ? MaxTableSize : size;