[kernel] Run global constructors

Look up the global constructor list that the linker outputs, and run
them all. Required creation of the `kutil::no_construct` template for
objects that are constructed before the global constructors are run.

Also split the `memory_initialize` function into two - one for just
those objects that need to happen before the global ctors, and one
after.

Tags: memory c++
This commit is contained in:
Justin C. Miller
2020-05-31 23:58:01 -07:00
parent c6c3a556b3
commit 88b090fe94
17 changed files with 126 additions and 67 deletions

View File

@@ -18,9 +18,7 @@ class device_manager
{
public:
/// Constructor.
/// \arg root_table Pointer to the ACPI RSDP
/// \arg alloc Allocator for device arrays
device_manager(const void *root_table, kutil::allocator &alloc);
device_manager();
/// Get the system global device manager.
/// \returns A reference to the system device manager
@@ -36,6 +34,10 @@ public:
/// otherwise nullptr.
ioapic * get_ioapic(int i);
/// Parse ACPI tables.
/// \arg root_table Pointer to the ACPI RSDP
void parse_acpi(const void *root_table);
/// Intialize drivers for the current device list.
void init_drivers();
@@ -122,7 +124,6 @@ private:
static device_manager s_instance;
device_manager() = delete;
device_manager(const device_manager &) = delete;
device_manager operator=(const device_manager &) = delete;
};