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

Kernel: Slap UNMAP_AFTER_INIT on a bunch more functions

We're now able to unmap 100 KiB of kernel text after init. :^)
This commit is contained in:
Andreas Kling 2021-02-19 21:29:46 +01:00
parent e920c74cae
commit 2b2828ae52
36 changed files with 105 additions and 105 deletions

View file

@ -30,7 +30,7 @@
namespace Kernel {
namespace ACPI {
DynamicParser::DynamicParser(PhysicalAddress rsdp)
UNMAP_AFTER_INIT DynamicParser::DynamicParser(PhysicalAddress rsdp)
: IRQHandler(9)
, Parser(rsdp)
{

View file

@ -37,7 +37,7 @@ enum class FeatureLevel {
Disabled,
};
static FeatureLevel determine_feature_level()
UNMAP_AFTER_INIT static FeatureLevel determine_feature_level()
{
auto value = kernel_command_line().lookup("acpi").value_or("on");
if (value == "limited")
@ -47,7 +47,7 @@ static FeatureLevel determine_feature_level()
return FeatureLevel::Enabled;
}
void initialize()
UNMAP_AFTER_INIT void initialize()
{
auto feature_level = determine_feature_level();
if (feature_level == FeatureLevel::Disabled)

View file

@ -36,7 +36,7 @@
namespace Kernel {
OwnPtr<MultiProcessorParser> MultiProcessorParser::autodetect()
UNMAP_AFTER_INIT OwnPtr<MultiProcessorParser> MultiProcessorParser::autodetect()
{
auto floating_pointer = find_floating_pointer();
if (!floating_pointer.has_value())
@ -44,7 +44,7 @@ OwnPtr<MultiProcessorParser> MultiProcessorParser::autodetect()
return adopt_own(*new MultiProcessorParser(floating_pointer.value()));
}
MultiProcessorParser::MultiProcessorParser(PhysicalAddress floating_pointer)
UNMAP_AFTER_INIT MultiProcessorParser::MultiProcessorParser(PhysicalAddress floating_pointer)
: m_floating_pointer(floating_pointer)
{
klog() << "MultiProcessor: Floating Pointer Structure @ " << m_floating_pointer;
@ -52,14 +52,14 @@ MultiProcessorParser::MultiProcessorParser(PhysicalAddress floating_pointer)
parse_configuration_table();
}
void MultiProcessorParser::parse_floating_pointer_data()
UNMAP_AFTER_INIT void MultiProcessorParser::parse_floating_pointer_data()
{
auto floating_pointer = map_typed<MultiProcessor::FloatingPointer>(m_floating_pointer);
m_configuration_table = PhysicalAddress(floating_pointer->physical_address_ptr);
dbgln("Features {}, IMCR? {}", floating_pointer->feature_info[0], (floating_pointer->feature_info[0] & (1 << 7)));
}
void MultiProcessorParser::parse_configuration_table()
UNMAP_AFTER_INIT void MultiProcessorParser::parse_configuration_table()
{
auto configuration_table_length = map_typed<MultiProcessor::ConfigurationTableHeader>(m_configuration_table)->length;
auto config_table = map_typed<MultiProcessor::ConfigurationTableHeader>(m_configuration_table, configuration_table_length);
@ -102,7 +102,7 @@ void MultiProcessorParser::parse_configuration_table()
}
}
Optional<PhysicalAddress> MultiProcessorParser::find_floating_pointer()
UNMAP_AFTER_INIT Optional<PhysicalAddress> MultiProcessorParser::find_floating_pointer()
{
StringView signature("_MP_");
auto mp_floating_pointer = map_ebda().find_chunk_starting_with(signature, 16);
@ -111,7 +111,7 @@ Optional<PhysicalAddress> MultiProcessorParser::find_floating_pointer()
return map_bios().find_chunk_starting_with(signature, 16);
}
Vector<u8> MultiProcessorParser::get_pci_bus_ids() const
UNMAP_AFTER_INIT Vector<u8> MultiProcessorParser::get_pci_bus_ids() const
{
Vector<u8> pci_bus_ids;
for (auto& entry : m_bus_entries) {
@ -121,7 +121,7 @@ Vector<u8> MultiProcessorParser::get_pci_bus_ids() const
return pci_bus_ids;
}
Vector<PCIInterruptOverrideMetadata> MultiProcessorParser::get_pci_interrupt_redirections()
UNMAP_AFTER_INIT Vector<PCIInterruptOverrideMetadata> MultiProcessorParser::get_pci_interrupt_redirections()
{
dbgln("MultiProcessor: Get PCI IOAPIC redirections");
Vector<PCIInterruptOverrideMetadata> overrides;
@ -148,7 +148,7 @@ Vector<PCIInterruptOverrideMetadata> MultiProcessorParser::get_pci_interrupt_red
return overrides;
}
PCIInterruptOverrideMetadata::PCIInterruptOverrideMetadata(u8 bus_id, u8 polarity, u8 trigger_mode, u8 source_irq, u32 ioapic_id, u16 ioapic_int_pin)
UNMAP_AFTER_INIT PCIInterruptOverrideMetadata::PCIInterruptOverrideMetadata(u8 bus_id, u8 polarity, u8 trigger_mode, u8 source_irq, u32 ioapic_id, u16 ioapic_int_pin)
: m_bus_id(bus_id)
, m_polarity(polarity)
, m_trigger_mode(trigger_mode)

View file

@ -56,7 +56,7 @@ static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsdt, const StringVi
static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsdt, const StringView& signature);
static bool validate_table(const Structures::SDTHeader&, size_t length);
void Parser::locate_static_data()
UNMAP_AFTER_INIT void Parser::locate_static_data()
{
locate_main_system_description_table();
initialize_main_system_description_table();
@ -64,7 +64,7 @@ void Parser::locate_static_data()
init_facs();
}
PhysicalAddress Parser::find_table(const StringView& signature)
UNMAP_AFTER_INIT PhysicalAddress Parser::find_table(const StringView& signature)
{
dbgln_if(ACPI_DEBUG, "ACPI: Calling Find Table method!");
for (auto p_sdt : m_sdt_pointers) {
@ -78,12 +78,12 @@ PhysicalAddress Parser::find_table(const StringView& signature)
return {};
}
void Parser::init_facs()
UNMAP_AFTER_INIT void Parser::init_facs()
{
m_facs = find_table("FACS");
}
void Parser::init_fadt()
UNMAP_AFTER_INIT void Parser::init_fadt()
{
klog() << "ACPI: Initializing Fixed ACPI data";
klog() << "ACPI: Searching for the Fixed ACPI Data Table";
@ -250,7 +250,7 @@ u8 Parser::get_table_revision(PhysicalAddress table_header)
return map_typed<Structures::SDTHeader>(table_header)->revision;
}
void Parser::initialize_main_system_description_table()
UNMAP_AFTER_INIT void Parser::initialize_main_system_description_table()
{
#if ACPI_DEBUG
dbgln("ACPI: Checking Main SDT Length to choose the correct mapping size");
@ -284,7 +284,7 @@ void Parser::initialize_main_system_description_table()
}
}
void Parser::locate_main_system_description_table()
UNMAP_AFTER_INIT void Parser::locate_main_system_description_table()
{
auto rsdp = map_typed<Structures::RSDPDescriptor20>(m_rsdp);
if (rsdp->base.revision == 0) {
@ -303,7 +303,7 @@ void Parser::locate_main_system_description_table()
}
}
Parser::Parser(PhysicalAddress rsdp)
UNMAP_AFTER_INIT Parser::Parser(PhysicalAddress rsdp)
: m_rsdp(rsdp)
{
klog() << "ACPI: Using RSDP @ " << rsdp;
@ -321,7 +321,7 @@ static bool validate_table(const Structures::SDTHeader& v_header, size_t length)
return false;
}
Optional<PhysicalAddress> StaticParsing::find_rsdp()
UNMAP_AFTER_INIT Optional<PhysicalAddress> StaticParsing::find_rsdp()
{
StringView signature("RSD PTR ");
auto rsdp = map_ebda().find_chunk_starting_with(signature, 16);
@ -330,7 +330,7 @@ Optional<PhysicalAddress> StaticParsing::find_rsdp()
return map_bios().find_chunk_starting_with(signature, 16);
}
PhysicalAddress StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature)
UNMAP_AFTER_INIT PhysicalAddress StaticParsing::find_table(PhysicalAddress rsdp_address, const StringView& signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
ASSERT(signature.length() == 4);
@ -348,7 +348,7 @@ PhysicalAddress StaticParsing::find_table(PhysicalAddress rsdp_address, const St
ASSERT_NOT_REACHED();
}
static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature)
UNMAP_AFTER_INIT static PhysicalAddress search_table_in_xsdt(PhysicalAddress xsdt_address, const StringView& signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
ASSERT(signature.length() == 4);
@ -371,7 +371,7 @@ static bool match_table_signature(PhysicalAddress table_header, const StringView
return !strncmp(table->h.sig, signature.characters_without_null_termination(), 4);
}
static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature)
UNMAP_AFTER_INIT static PhysicalAddress search_table_in_rsdt(PhysicalAddress rsdt_address, const StringView& signature)
{
// FIXME: There's no validation of ACPI tables here. Use the checksum to validate the tables.
ASSERT(signature.length() == 4);