mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace
This commit is contained in:
parent
a1d7ebf85a
commit
93d98d4976
153 changed files with 473 additions and 467 deletions
|
@ -228,7 +228,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, {}, Region::Access::Read | Region::Access::Write);
|
||||
m_apic_base = MM.allocate_kernel_region(apic_base.page_base(), PAGE_SIZE, {}, Memory::Region::Access::Read | Memory::Region::Access::Write);
|
||||
if (!m_apic_base) {
|
||||
dbgln("APIC: Failed to allocate memory for APIC base");
|
||||
return false;
|
||||
|
@ -245,7 +245,7 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
|
|||
return false;
|
||||
}
|
||||
|
||||
auto madt = map_typed<ACPI::Structures::MADT>(madt_address);
|
||||
auto madt = Memory::map_typed<ACPI::Structures::MADT>(madt_address);
|
||||
size_t entry_index = 0;
|
||||
size_t entries_length = madt->h.length - sizeof(ACPI::Structures::MADT);
|
||||
auto* madt_entry = madt->entries;
|
||||
|
@ -283,13 +283,13 @@ UNMAP_AFTER_INIT void APIC::do_boot_aps()
|
|||
// Also account for the data appended to:
|
||||
// * aps_to_enable u32 values for ap_cpu_init_stacks
|
||||
// * aps_to_enable u32 values for ap_cpu_init_processor_info_array
|
||||
auto apic_startup_region = MM.allocate_kernel_region_identity(PhysicalAddress(0x8000), page_round_up(apic_ap_start_size + (2 * aps_to_enable * sizeof(u32))), {}, Region::Access::Read | Region::Access::Write | Region::Access::Execute);
|
||||
auto apic_startup_region = MM.allocate_kernel_region_identity(PhysicalAddress(0x8000), Memory::page_round_up(apic_ap_start_size + (2 * aps_to_enable * sizeof(u32))), {}, Memory::Region::Access::Read | Memory::Region::Access::Write | Memory::Region::Access::Execute);
|
||||
memcpy(apic_startup_region->vaddr().as_ptr(), reinterpret_cast<const void*>(apic_ap_start), apic_ap_start_size);
|
||||
|
||||
// Allocate enough stacks for all APs
|
||||
Vector<OwnPtr<Region>> apic_ap_stacks;
|
||||
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, {}, Region::Access::Read | Region::Access::Write, AllocationStrategy::AllocateNow);
|
||||
auto stack_region = MM.allocate_kernel_region(Thread::default_kernel_stack_size, {}, Memory::Region::Access::Read | Memory::Region::Access::Write, AllocationStrategy::AllocateNow);
|
||||
if (!stack_region) {
|
||||
dbgln("APIC: Failed to allocate stack for AP #{}", i);
|
||||
return;
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
u32 high() const { return m_high; }
|
||||
};
|
||||
|
||||
OwnPtr<Region> m_apic_base;
|
||||
OwnPtr<Memory::Region> m_apic_base;
|
||||
Vector<OwnPtr<Processor>> m_ap_processor_info;
|
||||
Vector<Thread*> m_ap_idle_threads;
|
||||
Atomic<u8> m_apic_ap_count { 0 };
|
||||
|
|
|
@ -25,7 +25,7 @@ enum DeliveryMode {
|
|||
|
||||
UNMAP_AFTER_INIT IOAPIC::IOAPIC(PhysicalAddress address, u32 gsi_base)
|
||||
: m_address(address)
|
||||
, m_regs(map_typed_writable<ioapic_mmio_regs>(m_address))
|
||||
, m_regs(Memory::map_typed_writable<ioapic_mmio_regs>(m_address))
|
||||
, m_gsi_base(gsi_base)
|
||||
, m_id((read_register(0x0) >> 24) & 0xFF)
|
||||
, m_version(read_register(0x1) & 0xFF)
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
void isa_identity_map(int index);
|
||||
|
||||
PhysicalAddress m_address;
|
||||
mutable TypedMapping<ioapic_mmio_regs> m_regs;
|
||||
mutable Memory::TypedMapping<ioapic_mmio_regs> m_regs;
|
||||
u32 m_gsi_base;
|
||||
u8 m_id;
|
||||
u8 m_version;
|
||||
|
|
|
@ -183,7 +183,7 @@ UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode()
|
|||
UNMAP_AFTER_INIT void InterruptManagement::locate_apic_data()
|
||||
{
|
||||
VERIFY(!m_madt.is_null());
|
||||
auto madt = map_typed<ACPI::Structures::MADT>(m_madt);
|
||||
auto madt = Memory::map_typed<ACPI::Structures::MADT>(m_madt);
|
||||
|
||||
int irq_controller_count = 0;
|
||||
if (madt->flags & PCAT_COMPAT_FLAG) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue