mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
Kernel: Remove user/kernel flags from Region
Now that we no longer need to support the signal trampolines being user-accessible inside the kernel memory range, we can get rid of the "kernel" and "user-accessible" flags on Region and simply use the address of the region to determine whether it's kernel or user. This also tightens the page table mapping code, since it can now set user-accessibility based solely on the virtual address of a page.
This commit is contained in:
parent
1593219a41
commit
8415866c03
13 changed files with 54 additions and 70 deletions
|
@ -50,7 +50,7 @@ class KBufferImpl : public RefCounted<KBufferImpl> {
|
|||
public:
|
||||
static RefPtr<KBufferImpl> try_create_with_size(size_t size, u8 access, const char* name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
|
||||
{
|
||||
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), name, access, false, strategy);
|
||||
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), name, access, strategy);
|
||||
if (!region)
|
||||
return nullptr;
|
||||
return adopt(*new KBufferImpl(region.release_nonnull(), size, strategy));
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
static RefPtr<KBufferImpl> try_create_with_bytes(ReadonlyBytes bytes, u8 access, const char* name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
|
||||
{
|
||||
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(bytes.size()), name, access, false, strategy);
|
||||
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(bytes.size()), name, access, strategy);
|
||||
if (!region)
|
||||
return nullptr;
|
||||
memcpy(region->vaddr().as_ptr(), bytes.data(), bytes.size());
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
|
||||
bool expand(size_t new_capacity)
|
||||
{
|
||||
auto new_region = MM.allocate_kernel_region(PAGE_ROUND_UP(new_capacity), m_region->name(), m_region->access(), false, m_allocation_strategy);
|
||||
auto new_region = MM.allocate_kernel_region(PAGE_ROUND_UP(new_capacity), m_region->name(), m_region->access(), m_allocation_strategy);
|
||||
if (!new_region)
|
||||
return false;
|
||||
if (m_region && m_size > 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue