1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

Kernel+Userland: Remove shared buffers (shbufs)

All users of this mechanism have been switched to anonymous files and
passing file descriptors with sendfd()/recvfd().

Shbufs got us where we are today, but it's time we say good-bye to them
and welcome a much more idiomatic replacement. :^)
This commit is contained in:
Andreas Kling 2021-01-17 08:51:41 +01:00
parent 2cd16778b5
commit bf0719092f
28 changed files with 2 additions and 1022 deletions

View file

@ -28,7 +28,6 @@
#include "Emulator.h"
#include "MmapRegion.h"
#include "Report.h"
#include "SharedBufferRegion.h"
#include <AK/ByteBuffer.h>
#include <AK/Memory.h>
@ -43,10 +42,6 @@ void SoftMMU::add_region(NonnullOwnPtr<Region> region)
{
ASSERT(!find_region({ 0x23, region->base() }));
// FIXME: More sanity checks pls
if (is<SharedBufferRegion>(*region))
m_shbuf_regions.set(static_cast<SharedBufferRegion*>(region.ptr())->shbuf_id(), region.ptr());
size_t first_page_in_region = region->base() / PAGE_SIZE;
size_t last_page_in_region = (region->base() + region->size() - 1) / PAGE_SIZE;
for (size_t page = first_page_in_region; page <= last_page_in_region; ++page) {
@ -63,8 +58,6 @@ void SoftMMU::remove_region(Region& region)
m_page_to_region_map[first_page_in_region + i] = nullptr;
}
if (is<SharedBufferRegion>(region))
m_shbuf_regions.remove(static_cast<SharedBufferRegion&>(region).shbuf_id());
m_regions.remove_first_matching([&](auto& entry) { return entry.ptr() == &region; });
}
@ -238,11 +231,6 @@ ByteBuffer SoftMMU::copy_buffer_from_vm(const FlatPtr source, size_t size)
return buffer;
}
SharedBufferRegion* SoftMMU::shbuf_region(int shbuf_id)
{
return (SharedBufferRegion*)m_shbuf_regions.get(shbuf_id).value_or(nullptr);
}
bool SoftMMU::fast_fill_memory8(X86::LogicalAddress address, size_t size, ValueWithShadow<u8> value)
{
if (!size)