diff options
author | Liav A <liavalb@gmail.com> | 2020-02-24 00:59:00 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-24 11:27:03 +0100 |
commit | 85307dd26eb1d9b72560bf6afb63cb3736521b73 (patch) | |
tree | 2a6527b4384f9a21a430708e08ccd2dd7bfdba65 /Kernel/PCI/Initializer.cpp | |
parent | 43d570a1e3fb85476f9c2520b147bd836a6966e3 (diff) | |
download | serenity-85307dd26eb1d9b72560bf6afb63cb3736521b73.zip |
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.
Diffstat (limited to 'Kernel/PCI/Initializer.cpp')
-rw-r--r-- | Kernel/PCI/Initializer.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Kernel/PCI/Initializer.cpp b/Kernel/PCI/Initializer.cpp index 1b5d258344..3dd4c04638 100644 --- a/Kernel/PCI/Initializer.cpp +++ b/Kernel/PCI/Initializer.cpp @@ -44,7 +44,7 @@ PCI::Initializer& PCI::Initializer::the() } return *s_pci_initializer; } -void PCI::Initializer::initialize_pci_mmio_access(ACPI_RAW::MCFG& mcfg) +void PCI::Initializer::initialize_pci_mmio_access(PhysicalAddress mcfg) { PCI::MMIOAccess::initialize(mcfg); detect_devices(); @@ -129,15 +129,12 @@ bool PCI::Initializer::test_pci_io() bool PCI::Initializer::test_pci_mmio() { - if (ACPIParser::the().find_table("MCFG") != nullptr) - return true; - else - return false; + return !ACPIParser::the().find_table("MCFG").is_null(); } void PCI::Initializer::initialize_pci_mmio_access_after_test() { - initialize_pci_mmio_access(*(ACPI_RAW::MCFG*)(ACPIParser::the().find_table("MCFG"))); + initialize_pci_mmio_access(ACPIParser::the().find_table("MCFG")); } void PCI::Initializer::dismiss() |