Refactor ACPI table caching to use a static array
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 29s
Builds / ExectOS (i686, release) (push) Failing after 29s
Builds / ExectOS (amd64, debug) (push) Failing after 42s
Builds / ExectOS (i686, debug) (push) Failing after 38s

This commit is contained in:
2026-04-12 18:16:33 +02:00
parent d7f390b236
commit a08e07e515
4 changed files with 32 additions and 5 deletions

View File

@@ -101,6 +101,12 @@
#define ACPI_MADT_PLACE_ENABLED 0 /* Processor Local APIC CPU Enabled */
#define ACPI_MADT_PLAOC_ENABLED 1 /* Processor Local APIC Online Capable */
/* ACPI address space definitions */
#define ACPI_ADDRESS_SPACE_MEMORY 0x00
/* Maximum number of cached ACPI tables */
#define ACPI_MAX_CACHED_TABLES 32
/* Default serial port settings */
#define COMPORT_CLOCK_RATE 0x1C200
#define COMPORT_WAIT_TIMEOUT 204800
@@ -222,7 +228,7 @@ typedef struct _ACPI_SUBTABLE_HEADER
typedef struct _ACPI_CACHE_LIST
{
LIST_ENTRY ListEntry;
ACPI_DESCRIPTION_HEADER Header;
PACPI_DESCRIPTION_HEADER Table;
} ACPI_CACHE_LIST, *PACPI_CACHE_LIST;
/* ACPI Root System Description Table Pointer (RSDP) structure */

View File

@@ -26,8 +26,21 @@ HL::Acpi::CacheAcpiTable(IN PACPI_DESCRIPTION_HEADER AcpiTable)
{
PACPI_CACHE_LIST AcpiCache;
/* Create new ACPI table cache entry */
AcpiCache = CONTAIN_RECORD(AcpiTable, ACPI_CACHE_LIST, Header);
/* Check if there are free slots in static early-boot cache array */
if(CacheCount >= ACPI_MAX_CACHED_TABLES)
{
/* Cache is full, the table is mapped but not cached */
return;
}
/* Get the next available static cache entry */
AcpiCache = &CacheEntries[CacheCount];
CacheCount++;
/* Store the pointer to the mapped ACPI table */
AcpiCache->Table = AcpiTable;
/* Insert entry into the global ACPI cache list */
RTL::LinkedList::InsertTailList(&CacheList, &AcpiCache->ListEntry);
}
@@ -539,10 +552,10 @@ HL::Acpi::QueryAcpiCache(IN ULONG Signature,
AcpiCache = CONTAIN_RECORD(ListEntry, ACPI_CACHE_LIST, ListEntry);
/* Check if ACPI table signature matches */
if(AcpiCache->Header.Signature == Signature)
if(AcpiCache->Table->Signature == Signature)
{
/* ACPI table found in cache, return it */
TableHeader = &AcpiCache->Header;
TableHeader = AcpiCache->Table;
break;
}

View File

@@ -9,6 +9,12 @@
#include <xtos.hh>
/* ACPI tables cache count */
ULONG HL::Acpi::CacheCount = 0;
/* ACPI tables cache entries */
ACPI_CACHE_LIST HL::Acpi::CacheEntries[ACPI_MAX_CACHED_TABLES];
/* ACPI tables cache list */
LIST_ENTRY HL::Acpi::CacheList;

View File

@@ -18,6 +18,8 @@ namespace HL
class Acpi
{
private:
STATIC ULONG CacheCount;
STATIC ACPI_CACHE_LIST CacheEntries[ACPI_MAX_CACHED_TABLES];
STATIC LIST_ENTRY CacheList;
STATIC PACPI_RSDP RsdpStructure;
STATIC ACPI_SYSTEM_INFO SystemInfo;