From e51dea0b6e34c2959b3b0f4a5db6b11d4b619960 Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Wed, 27 Mar 2024 19:49:10 +0700 Subject: Some updates: rename memAddr, define architecture --- drivers/acpi/Acpi.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'drivers/acpi/Acpi.cpp') diff --git a/drivers/acpi/Acpi.cpp b/drivers/acpi/Acpi.cpp index 207c9bb..6551c6a 100644 --- a/drivers/acpi/Acpi.cpp +++ b/drivers/acpi/Acpi.cpp @@ -3,10 +3,10 @@ const char *Rsdp::signatureString = "RSD PTR "; const uint8 Rsdp::validFieldRevision = 2; -const memAddr Rsdp::romAreaStart = 0xe0000; -const memAddr Rsdp::romAreaEnd = 0xfffff; -const memAddr Rsdp::ebdaAreaStart = 0x80000; -const memAddr Rsdp::ebdaAreaEnd = 0x803ff; +const uintptr Rsdp::romAreaStart = 0xe0000; +const uintptr Rsdp::romAreaEnd = 0xfffff; +const uintptr Rsdp::ebdaAreaStart = 0x80000; +const uintptr Rsdp::ebdaAreaEnd = 0x803ff; const uint8 Rsdp::checksunFieldSize = 20; const uint8 Entry::size = 4; const uint8 sizeWithoutIcs = 44; @@ -45,7 +45,7 @@ uint8 Rsdp::checksumCheck() const uint8 check = 0; for(uint32 offset = 0; offset < checksunFieldSize; offset++) { - check += *(uint8 *)((memAddr)this + offset); + check += *(uint8 *)((uintptr)this + offset); } return check; }; @@ -55,13 +55,15 @@ uint8 DescHeader::checksumCheck() const uint8 check = 0; for(uint32 offset = 0; offset < length; offset++) { - check += *(uint8 *)((memAddr)this + offset); + check += *(uint8 *)((uintptr)this + offset); } return check; }; const Ics *Madt::getIcs(uint8 index) const { + if(header.checksumCheck()) return nullptr; + uint32 icsBytesRemain = header.getLength() - ::sizeWithoutIcs; uint16 indexAmass = 0; const Ics *icsPtr = (Ics *)(&icsBegin); @@ -73,7 +75,7 @@ const Ics *Madt::getIcs(uint8 index) const { icsBytesRemain -= icsPtr->getLength(); indexAmass++; - icsPtr = (Ics *)((memAddr)icsPtr + icsPtr->getLength()); + icsPtr = (Ics *)((uintptr)icsPtr + icsPtr->getLength()); } } -- cgit v1.2.3