From 17584d8a845652249a3df8bb98ef7ad522b0506c Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 20 Jan 2022 21:20:11 +0200 Subject: Kernel: Stop adopting non-heap memory into OwnPtrs in VirtIO::Queues --- Kernel/Bus/VirtIO/Queue.cpp | 6 +++--- Kernel/Bus/VirtIO/Queue.h | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Kernel/Bus/VirtIO') diff --git a/Kernel/Bus/VirtIO/Queue.cpp b/Kernel/Bus/VirtIO/Queue.cpp index d6be1bdf73..df2cc2fa94 100644 --- a/Kernel/Bus/VirtIO/Queue.cpp +++ b/Kernel/Bus/VirtIO/Queue.cpp @@ -25,9 +25,9 @@ Queue::Queue(u16 queue_size, u16 notify_offset) // TODO: ensure alignment!!! u8* ptr = m_queue_region->vaddr().as_ptr(); memset(ptr, 0, m_queue_region->size()); - m_descriptors = adopt_own_if_nonnull(reinterpret_cast(ptr)); - m_driver = adopt_own_if_nonnull(reinterpret_cast(ptr + size_of_descriptors)); - m_device = adopt_own_if_nonnull(reinterpret_cast(ptr + size_of_descriptors + size_of_driver)); + m_descriptors = reinterpret_cast(ptr); + m_driver = reinterpret_cast(ptr + size_of_descriptors); + m_device = reinterpret_cast(ptr + size_of_descriptors + size_of_driver); for (auto i = 0; i + 1 < queue_size; i++) { m_descriptors[i].next = i + 1; // link all of the descriptors in a line diff --git a/Kernel/Bus/VirtIO/Queue.h b/Kernel/Bus/VirtIO/Queue.h index b2604e7468..2b8872fde7 100644 --- a/Kernel/Bus/VirtIO/Queue.h +++ b/Kernel/Bus/VirtIO/Queue.h @@ -37,9 +37,9 @@ public: void enable_interrupts(); void disable_interrupts(); - PhysicalAddress descriptor_area() const { return to_physical(m_descriptors.ptr()); } - PhysicalAddress driver_area() const { return to_physical(m_driver.ptr()); } - PhysicalAddress device_area() const { return to_physical(m_device.ptr()); } + PhysicalAddress descriptor_area() const { return to_physical(m_descriptors); } + PhysicalAddress driver_area() const { return to_physical(m_driver); } + PhysicalAddress device_area() const { return to_physical(m_device); } bool new_data_available() const; bool has_free_slots() const; @@ -90,9 +90,9 @@ private: u16 m_used_tail { 0 }; u16 m_driver_index_shadow { 0 }; - OwnPtr m_descriptors { nullptr }; - OwnPtr m_driver { nullptr }; - OwnPtr m_device { nullptr }; + QueueDescriptor* m_descriptors { nullptr }; + QueueDriver* m_driver { nullptr }; + QueueDevice* m_device { nullptr }; OwnPtr m_queue_region; Spinlock m_lock; -- cgit v1.2.3