diff options
author | Tom <tomut@yahoo.com> | 2020-08-10 09:44:35 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-10 20:05:18 +0200 |
commit | 08ff25f4efeb3a676d9607b440b12915c94bf060 (patch) | |
tree | 9fb9dc86444806fbec1e518ba8311a17d655c743 /Kernel/Heap | |
parent | de5e5429307e62a6e4ae7980d383c749a66b167f (diff) | |
download | serenity-08ff25f4efeb3a676d9607b440b12915c94bf060.zip |
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.
Diffstat (limited to 'Kernel/Heap')
-rw-r--r-- | Kernel/Heap/SlabAllocator.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/Heap/SlabAllocator.cpp b/Kernel/Heap/SlabAllocator.cpp index b3ba8c1cce..e0ecff38c1 100644 --- a/Kernel/Heap/SlabAllocator.cpp +++ b/Kernel/Heap/SlabAllocator.cpp @@ -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); |