summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-20 21:20:11 +0200
committerAndreas Kling <kling@serenityos.org>2022-01-21 16:27:21 +0100
commit17584d8a845652249a3df8bb98ef7ad522b0506c (patch)
tree5aa0f084d7e6c5d4346ccfca7008730203b89326 /Kernel
parentd65347d39dd89013a0c46d8206c77e65d6dceda1 (diff)
downloadserenity-17584d8a845652249a3df8bb98ef7ad522b0506c.zip
Kernel: Stop adopting non-heap memory into OwnPtrs in VirtIO::Queues
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Bus/VirtIO/Queue.cpp6
-rw-r--r--Kernel/Bus/VirtIO/Queue.h12
2 files changed, 9 insertions, 9 deletions
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<QueueDescriptor*>(ptr));
- m_driver = adopt_own_if_nonnull(reinterpret_cast<QueueDriver*>(ptr + size_of_descriptors));
- m_device = adopt_own_if_nonnull(reinterpret_cast<QueueDevice*>(ptr + size_of_descriptors + size_of_driver));
+ m_descriptors = reinterpret_cast<QueueDescriptor*>(ptr);
+ m_driver = reinterpret_cast<QueueDriver*>(ptr + size_of_descriptors);
+ m_device = reinterpret_cast<QueueDevice*>(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<QueueDescriptor> m_descriptors { nullptr };
- OwnPtr<QueueDriver> m_driver { nullptr };
- OwnPtr<QueueDevice> m_device { nullptr };
+ QueueDescriptor* m_descriptors { nullptr };
+ QueueDriver* m_driver { nullptr };
+ QueueDevice* m_device { nullptr };
OwnPtr<Memory::Region> m_queue_region;
Spinlock m_lock;