mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Kernel: Implement a naive version of virtconsole by memcpying to physical page
This patch allocates a physical page for each of the virtqueues and memcpys to it when receiving a buffer to get a physical, aligned contiguous buffer as required by the virtio specification. Co-authored-by: Sahan <sahan.h.fernando@gmail.com>
This commit is contained in:
parent
42b1eb5af1
commit
ecfa7cb824
8 changed files with 35 additions and 18 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <Kernel/SpinLock.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
|
@ -36,6 +37,8 @@ enum class BufferType {
|
|||
DeviceWritable = 2
|
||||
};
|
||||
|
||||
class VirtIODevice;
|
||||
|
||||
class VirtIOQueue {
|
||||
public:
|
||||
VirtIOQueue(u16 queue_size, u16 notify_offset);
|
||||
|
@ -51,7 +54,7 @@ public:
|
|||
PhysicalAddress driver_area() const { return to_physical(m_driver.ptr()); }
|
||||
PhysicalAddress device_area() const { return to_physical(m_device.ptr()); }
|
||||
|
||||
bool supply_buffer(const u8* buffer, u32 len, BufferType);
|
||||
bool supply_buffer(Badge<VirtIODevice>, const u8* buffer, u32 length, BufferType);
|
||||
bool new_data_available() const;
|
||||
|
||||
bool handle_interrupt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue