mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
Kernel: Slap UNMAP_AFTER_INIT on a whole bunch of functions
There's no real system here, I just added it to various functions that I don't believe we ever want to call after initialization has finished. With these changes, we're able to unmap 60 KiB of kernel text after init. :^)
This commit is contained in:
parent
32e93c8808
commit
fdf03852c9
22 changed files with 69 additions and 68 deletions
|
@ -146,7 +146,7 @@ APIC& APIC::the()
|
|||
return *s_apic;
|
||||
}
|
||||
|
||||
void APIC::initialize()
|
||||
UNMAP_AFTER_INIT void APIC::initialize()
|
||||
{
|
||||
ASSERT(!APIC::initialized());
|
||||
s_apic.ensure_instance();
|
||||
|
@ -234,7 +234,7 @@ u8 APIC::spurious_interrupt_vector()
|
|||
+ reinterpret_cast<ptrdiff_t>(&varname) \
|
||||
- reinterpret_cast<ptrdiff_t>(&apic_ap_start))
|
||||
|
||||
bool APIC::init_bsp()
|
||||
UNMAP_AFTER_INIT bool APIC::init_bsp()
|
||||
{
|
||||
// FIXME: Use the ACPI MADT table
|
||||
if (!MSR::have())
|
||||
|
@ -300,7 +300,7 @@ bool APIC::init_bsp()
|
|||
return true;
|
||||
}
|
||||
|
||||
void APIC::do_boot_aps()
|
||||
UNMAP_AFTER_INIT void APIC::do_boot_aps()
|
||||
{
|
||||
ASSERT(m_processor_enabled_cnt > 1);
|
||||
u32 aps_to_enable = m_processor_enabled_cnt - 1;
|
||||
|
@ -400,7 +400,7 @@ void APIC::do_boot_aps()
|
|||
#endif
|
||||
}
|
||||
|
||||
void APIC::boot_aps()
|
||||
UNMAP_AFTER_INIT void APIC::boot_aps()
|
||||
{
|
||||
if (m_processor_enabled_cnt <= 1)
|
||||
return;
|
||||
|
@ -421,7 +421,7 @@ void APIC::boot_aps()
|
|||
m_apic_ap_continue.store(1, AK::MemoryOrder::memory_order_release);
|
||||
}
|
||||
|
||||
void APIC::enable(u32 cpu)
|
||||
UNMAP_AFTER_INIT void APIC::enable(u32 cpu)
|
||||
{
|
||||
if (cpu >= 8) {
|
||||
// TODO: x2apic support?
|
||||
|
@ -472,7 +472,7 @@ Thread* APIC::get_idle_thread(u32 cpu) const
|
|||
return m_ap_idle_threads[cpu - 1];
|
||||
}
|
||||
|
||||
void APIC::init_finished(u32 cpu)
|
||||
UNMAP_AFTER_INIT void APIC::init_finished(u32 cpu)
|
||||
{
|
||||
// This method is called once the boot stack is no longer needed
|
||||
ASSERT(cpu > 0);
|
||||
|
@ -525,7 +525,7 @@ void APIC::send_ipi(u32 cpu)
|
|||
write_icr(ICRReg(IRQ_APIC_IPI + IRQ_VECTOR_BASE, ICRReg::Fixed, ICRReg::Logical, ICRReg::Assert, ICRReg::TriggerMode::Edge, ICRReg::NoShorthand, cpu));
|
||||
}
|
||||
|
||||
APICTimer* APIC::initialize_timers(HardwareTimerBase& calibration_timer)
|
||||
UNMAP_AFTER_INIT APICTimer* APIC::initialize_timers(HardwareTimerBase& calibration_timer)
|
||||
{
|
||||
if (!m_apic_base)
|
||||
return nullptr;
|
||||
|
|
|
@ -56,7 +56,7 @@ InterruptManagement& InterruptManagement::the()
|
|||
return *s_interrupt_management;
|
||||
}
|
||||
|
||||
void InterruptManagement::initialize()
|
||||
UNMAP_AFTER_INIT void InterruptManagement::initialize()
|
||||
{
|
||||
ASSERT(!InterruptManagement::initialized());
|
||||
s_interrupt_management = new InterruptManagement();
|
||||
|
@ -125,7 +125,7 @@ RefPtr<IRQController> InterruptManagement::get_responsible_irq_controller(u8 int
|
|||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
PhysicalAddress InterruptManagement::search_for_madt()
|
||||
UNMAP_AFTER_INIT PhysicalAddress InterruptManagement::search_for_madt()
|
||||
{
|
||||
dbgln("Early access to ACPI tables for interrupt setup");
|
||||
auto rsdp = ACPI::StaticParsing::find_rsdp();
|
||||
|
@ -134,13 +134,13 @@ PhysicalAddress InterruptManagement::search_for_madt()
|
|||
return ACPI::StaticParsing::find_table(rsdp.value(), "APIC");
|
||||
}
|
||||
|
||||
InterruptManagement::InterruptManagement()
|
||||
UNMAP_AFTER_INIT InterruptManagement::InterruptManagement()
|
||||
: m_madt(search_for_madt())
|
||||
{
|
||||
m_interrupt_controllers.resize(1);
|
||||
}
|
||||
|
||||
void InterruptManagement::switch_to_pic_mode()
|
||||
UNMAP_AFTER_INIT void InterruptManagement::switch_to_pic_mode()
|
||||
{
|
||||
klog() << "Interrupts: Switch to Legacy PIC mode";
|
||||
InterruptDisabler disabler;
|
||||
|
@ -159,7 +159,7 @@ void InterruptManagement::switch_to_pic_mode()
|
|||
}
|
||||
}
|
||||
|
||||
void InterruptManagement::switch_to_ioapic_mode()
|
||||
UNMAP_AFTER_INIT void InterruptManagement::switch_to_ioapic_mode()
|
||||
{
|
||||
klog() << "Interrupts: Switch to IOAPIC mode";
|
||||
InterruptDisabler disabler;
|
||||
|
@ -196,7 +196,7 @@ void InterruptManagement::switch_to_ioapic_mode()
|
|||
APIC::the().init_bsp();
|
||||
}
|
||||
|
||||
void InterruptManagement::locate_apic_data()
|
||||
UNMAP_AFTER_INIT void InterruptManagement::locate_apic_data()
|
||||
{
|
||||
ASSERT(!m_madt.is_null());
|
||||
auto madt = map_typed<ACPI::Structures::MADT>(m_madt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue