From 6bdd3cd6aa6fbbbcce7b0986d82aa4a0cb10ff93 Mon Sep 17 00:00:00 2001 From: NDRAEY Date: Mon, 22 Jan 2024 12:05:31 +0900 Subject: [PATCH] ACPI: Fix table searching process --- config.mk | 2 +- kernel/src/sys/acpi.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config.mk b/config.mk index c9ed4637c..91f16f5c6 100755 --- a/config.mk +++ b/config.mk @@ -295,7 +295,7 @@ QEMU_FLAGS = -cdrom kernel.iso -m $(MEMORY_SIZE) \ -rtc base=localtime \ -d guest_errors,cpu_reset,int \ -audiodev pa,id=pa0 \ - -smp 1 \ + -smp 2 \ -netdev user,id=net0,net=192.168.111.0,dhcpstart=192.168.111.128,hostfwd=tcp::9999-:8888 \ -device rtl8139,netdev=net0,id=mydev0 \ -M pcspk-audiodev=pa0 \ diff --git a/kernel/src/sys/acpi.c b/kernel/src/sys/acpi.c index be0670dea..6c32eebdb 100644 --- a/kernel/src/sys/acpi.c +++ b/kernel/src/sys/acpi.c @@ -74,11 +74,11 @@ void acpi_scan_all_tables(uint32_t rsdt_addr) { get_kernel_page_directory(), rsdt_addr, rsdt_addr, - PAGE_SIZE, + PAGE_SIZE * 2, PAGE_PRESENT ); - uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)); + uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)) / sizeof(uint32_t); qemu_log("LEN: %d (// %d)", rsdt->Length, sizeof(ACPISDTHeader)); @@ -95,11 +95,12 @@ void acpi_scan_all_tables(uint32_t rsdt_addr) { break; } - tty_printf("[%x] Found table: %.4s", entry, entry->Signature); + tty_printf("[%x] Found table: %.4s\n", entry, entry->Signature); qemu_log("[%x] Found table: %.4s", entry, entry->Signature); } unmap_single_page(get_kernel_page_directory(), (virtual_addr_t) rsdt_addr); + unmap_single_page(get_kernel_page_directory(), ((virtual_addr_t) rsdt_addr) + PAGE_SIZE); } @@ -133,7 +134,7 @@ void find_facp(size_t rsdt_addr) { qemu_log("OEMID: %s", rsdt->OEMID); qemu_log("Length: %d entries", rsdt->Length); - uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)); + uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)) / sizeof(uint32_t); qemu_log("SDTs available: %d", sdt_count); @@ -193,7 +194,7 @@ void find_apic(size_t rsdt_addr) { qemu_log("OEMID: %s", rsdt->OEMID); qemu_log("Length: %d entries", rsdt->Length); - uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)); + uint32_t sdt_count = (rsdt->Length - sizeof(ACPISDTHeader)) / sizeof(uint32_t); qemu_log("SDTs available: %d", sdt_count);