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

Kernel: Add typed_map<T>(PhysicalAddress) and use it in ACPI parsing

There was a frequently occurring pattern of "map this physical address
into kernel VM, then read from it, then unmap it again".

This new typed_map() encapsulates that logic by giving you back a
typed pointer to the kind of structure you're interested in accessing.

It returns a TypedMapping<T> that can be used mostly like a pointer.
When destroyed, the TypedMapping object will unmap the memory. :^)
This commit is contained in:
Andreas Kling 2020-04-09 17:12:58 +02:00
parent 4644217094
commit f614f0e2cb
5 changed files with 140 additions and 98 deletions

View file

@ -336,14 +336,12 @@ class DynamicParser;
class Parser;
namespace StaticParsing {
PhysicalAddress search_rsdp_in_ebda(u16 ebda_segment);
PhysicalAddress search_rsdp_in_bios_area();
PhysicalAddress search_rsdp();
PhysicalAddress find_rsdp();
bool match_table_signature(PhysicalAddress table_header, const char*);
PhysicalAddress search_table(PhysicalAddress rsdp, const char*);
PhysicalAddress search_table_in_xsdt(PhysicalAddress xsdt, const char*);
PhysicalAddress search_table_in_rsdt(PhysicalAddress rsdt, const char*);
inline bool validate_table(Structures::SDTHeader&, size_t length);
bool validate_table(const Structures::SDTHeader&, size_t length);
};
}
}