fix: kernel concurrency, interrupt context, and user VA safety

This commit is contained in:
daniel committed 2026-08-01 15:43:38 +02:00
1 parent f222bf1f04
commit b1c55073c7
71 files changed
+2654 -1092

No files matched your search

+23
View File
@@ -21,6 +21,21 @@ namespace Hal {
return true;
}
static uint32_t ExtendedSystemIoAddress(const Table* fadt,
const uint8_t gas[12],
size_t fieldOffset) {
// Generic Address Structure: byte 0 is AddressSpaceId and bytes
// 4..11 are the little-endian address. This event code uses x86
// port I/O, so accept only SystemIO GAS entries that fit the
// architectural 16-bit port space.
if (fadt->Header.Length < fieldOffset + 12 || gas[0] != 1) return 0;
uint64_t address = 0;
for (int i = 0; i < 8; i++)
address |= (uint64_t)gas[4 + i] << (i * 8);
return address <= 0xFFFF ? (uint32_t)address : 0;
}
static Table* FindFADTInXSDT(ACPI::CommonSDTHeader* xsdt) {
uint32_t entryCount = (xsdt->Length - sizeof(ACPI::CommonSDTHeader)) / 8;
uint64_t* entries = (uint64_t*)((uint64_t)xsdt + sizeof(ACPI::CommonSDTHeader));
@@ -73,6 +88,14 @@ namespace Hal {
result.PMTimerBlock = fadt->PMTimerBlock;
result.GPE0Block = fadt->GPE0Block;
result.GPE1Block = fadt->GPE1Block;
if (result.GPE0Block == 0) {
result.GPE0Block = ExtendedSystemIoAddress(
fadt, fadt->X_GPE0Block, offsetof(Table, X_GPE0Block));
}
if (result.GPE1Block == 0) {
result.GPE1Block = ExtendedSystemIoAddress(
fadt, fadt->X_GPE1Block, offsetof(Table, X_GPE1Block));
}
result.SMI_CommandPort = fadt->SMI_CommandPort;
result.SCI_Interrupt = fadt->SCI_Interrupt;
result.PM1EventLength = fadt->PM1EventLength;