summaryrefslogtreecommitdiff
path: root/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-09-04 08:42:31 +0300
committerAndreas Kling <kling@serenityos.org>2021-09-04 16:36:02 +0200
commited6c1f53afbb6207450045b07552effa5335ceb1 (patch)
treedb576e877f69cafedd27e5da4ada89e8c531058f /Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
parente490c17bdedf48ea252a1f9fe04b748e63cbd9b7 (diff)
downloadserenity-ed6c1f53afbb6207450045b07552effa5335ceb1.zip
Kernel/VirtIO: Defer initialization of device out of the constructor
This ensures we safely handle interrupts (which can call virtual functions), so they don't happen in the constructor - this pattern can lead to a crash, if we are still in the constructor context because not all methods are available for usage (some are pure virtual, so it's possible to call __cxa_pure_virtual). Also, under some conditions like adding a PCI device via PCI-passthrough mechanism in QEMU, it became exposed to the eye that the code asserts on RNG::handle_device_config_change(). That device has no configuration but if the hypervisor still misbehaves and tries to configure it, we should simply return false to indicate nothing happened.
Diffstat (limited to 'Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp')
-rw-r--r--Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
index 6fcecdf973..7e17d83304 100644
--- a/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
+++ b/Kernel/Graphics/VirtIOGPU/GraphicsAdapter.cpp
@@ -22,6 +22,7 @@ GraphicsAdapter::GraphicsAdapter(PCI::Address base_address)
: PCI::Device(base_address)
{
m_gpu_device = adopt_ref(*new GPU(base_address)).leak_ref();
+ m_gpu_device->initialize();
}
void GraphicsAdapter::initialize_framebuffer_devices()