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

Kernel: Don't use references or pointers to physical addresses

Now the ACPI & PCI code is more safer, because we don't use raw pointers
or references to objects or data that are located in the physical
address space, so an accidental dereference cannot happen easily.
Instead, we use the PhysicalAddress class to represent those addresses.
This commit is contained in:
Liav A 2020-02-24 00:59:00 +02:00 committed by Andreas Kling
parent 43d570a1e3
commit 85307dd26e
13 changed files with 91 additions and 102 deletions

View file

@ -39,14 +39,14 @@ namespace Kernel {
class PCI::MMIOAccess final : public PCI::Access {
public:
static void initialize(ACPI_RAW::MCFG&);
static void initialize(PhysicalAddress mcfg);
virtual void enumerate_all(Function<void(Address, ID)>&) override final;
virtual String get_access_type() override final { return "MMIO-Access"; };
virtual u32 get_segments_count();
protected:
explicit MMIOAccess(ACPI_RAW::MCFG&);
explicit MMIOAccess(PhysicalAddress mcfg);
private:
virtual u8 read8_field(Address address, u32) override final;
@ -60,7 +60,7 @@ private:
virtual u8 get_segment_start_bus(u32);
virtual u8 get_segment_end_bus(u32);
ACPI_RAW::MCFG& m_mcfg;
PhysicalAddress m_mcfg;
HashMap<u16, MMIOSegment*>& m_segments;
OwnPtr<Region> m_mmio_window_region;
PCI::ChangeableAddress m_mapped_address;