mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 01:27:42 +00:00
Kernel: Invoke heap constructors separately early on
By having a separate list of constructors for the kernel heap code, we can properly use constructors without re-running them after the heap was already initialized. This solves some problems where values were wiped out because they were overwritten by running their constructors later in the initialization process.
This commit is contained in:
parent
de5e542930
commit
08ff25f4ef
4 changed files with 20 additions and 8 deletions
|
@ -100,12 +100,11 @@ private:
|
|||
char padding[templated_slab_size - sizeof(FreeSlab*)];
|
||||
};
|
||||
|
||||
// NOTE: These are not default-initialized to prevent an init-time constructor from overwriting them
|
||||
FreeSlab* m_freelist;
|
||||
FreeSlab* m_freelist { nullptr };
|
||||
Atomic<size_t> m_num_allocated;
|
||||
Atomic<size_t> m_num_free;
|
||||
void* m_base;
|
||||
void* m_end;
|
||||
void* m_base { nullptr };
|
||||
void* m_end { nullptr };
|
||||
SpinLock<u32> m_lock;
|
||||
|
||||
static_assert(sizeof(FreeSlab) == templated_slab_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue