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

Kernel: Add convenience values to the Memory::Region::Access enum

Instead of `Memory::Region::Access::Read | Memory::Region::AccessWrite`
you can now say `Memory::Region::Access::ReadWrite`.
This commit is contained in:
Andreas Kling 2021-08-06 22:25:00 +02:00
parent 47bdd7c3a0
commit 2cd8b21974
38 changed files with 68 additions and 65 deletions

View file

@ -229,7 +229,7 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
dbgln_if(APIC_DEBUG, "Initializing APIC, base: {}", apic_base);
set_base(apic_base);
m_apic_base = MM.allocate_kernel_region(apic_base.page_base(), PAGE_SIZE, {}, Memory::Region::Access::Read | Memory::Region::Access::Write);
m_apic_base = MM.allocate_kernel_region(apic_base.page_base(), PAGE_SIZE, {}, Memory::Region::Access::ReadWrite);
if (!m_apic_base) {
dbgln("APIC: Failed to allocate memory for APIC base");
return false;
@ -283,7 +283,7 @@ UNMAP_AFTER_INIT static NonnullOwnPtr<Memory::Region> create_identity_mapped_reg
Memory::VirtualRange { VirtualAddress { static_cast<FlatPtr>(paddr.get()) }, size },
vmobject.release_nonnull(),
{},
Memory::Region::Access::Read | Memory::Region::Access::Write | Memory::Region::Access::Execute);
Memory::Region::Access::ReadWriteExecute);
VERIFY(region);
return region.release_nonnull();
}
@ -303,7 +303,7 @@ UNMAP_AFTER_INIT void APIC::do_boot_aps()
// Allocate enough stacks for all APs
Vector<OwnPtr<Memory::Region>> apic_ap_stacks;
for (u32 i = 0; i < aps_to_enable; i++) {
auto stack_region = MM.allocate_kernel_region(Thread::default_kernel_stack_size, {}, Memory::Region::Access::Read | Memory::Region::Access::Write, AllocationStrategy::AllocateNow);
auto stack_region = MM.allocate_kernel_region(Thread::default_kernel_stack_size, {}, Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow);
if (!stack_region) {
dbgln("APIC: Failed to allocate stack for AP #{}", i);
return;