mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
UserspaceEmulator: Add support for shared buffers (shbuf)
We track these separately from regular mmap() regions, as they have slightly different behaviors.
This commit is contained in:
parent
0ce4d3e942
commit
2da44dba44
7 changed files with 312 additions and 13 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Types.h>
|
||||
|
@ -33,6 +34,8 @@
|
|||
|
||||
namespace UserspaceEmulator {
|
||||
|
||||
class SharedBufferRegion;
|
||||
|
||||
class SoftMMU {
|
||||
public:
|
||||
class Region {
|
||||
|
@ -54,6 +57,7 @@ public:
|
|||
virtual u32 read32(u32 offset) = 0;
|
||||
|
||||
virtual u8* cacheable_ptr([[maybe_unused]] u32 offset) { return nullptr; }
|
||||
virtual bool is_shared_buffer() const { return false; }
|
||||
|
||||
protected:
|
||||
Region(u32 base, u32 size)
|
||||
|
@ -86,9 +90,12 @@ public:
|
|||
void copy_from_vm(void* destination, const FlatPtr source, size_t);
|
||||
ByteBuffer copy_buffer_from_vm(const FlatPtr source, size_t);
|
||||
|
||||
SharedBufferRegion* shbuf_region(int shbuf_id);
|
||||
|
||||
private:
|
||||
OwnPtr<Region> m_tls_region;
|
||||
NonnullOwnPtrVector<Region> m_regions;
|
||||
HashMap<int, Region*> m_shbuf_regions;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue