fix errors in slides
[lunaix-os.git] / lunaix-os / hal / acpi / acpi.c
index 47812197bf954cf70fde28aa67c2c4d1848c9504..a99827803a14e729bb9b4fdb07591fdd767ad57d 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "parser/madt_parser.h"
 
-acpi_context* toc = NULL;
+static acpi_context* toc = NULL;
 
 LOG_MODULE("ACPI")
 
@@ -51,7 +51,7 @@ acpi_init(multiboot_info_t* mb_info)
     kprintf(KINFO "OEM: %s\n", toc->oem_id);
     kprintf(KINFO "IOAPIC address: %p\n", toc->madt.ioapic->ioapic_addr);
     kprintf(KINFO "APIC address: %p\n", toc->madt.apic_addr);
-    
+
     for (size_t i = 0; i < 24; i++) {
         acpi_intso_t* intso = toc->madt.irq_exception[i];
         if (!intso)
@@ -115,11 +115,11 @@ acpi_locate_rsdp(multiboot_info_t* mb_info)
 #else
     // You know what, I just search the entire 1MiB for Celestia's sake.
     uint8_t* mem_start = 0x4000;
-    for (size_t j = 0; j < 0x100000; j += 16) {
-        uint32_t sig_low = *((uint32_t*)(mem_start + j));
+    for (; mem_start < 0x100000; mem_start += 16) {
+        uint32_t sig_low = *((uint32_t*)(mem_start));
         // uint32_t sig_high = *((uint32_t*)(mem_start+j) + 1);
         if (sig_low == ACPI_RSDP_SIG_L) {
-            rsdp = (acpi_rsdp_t*)(mem_start + j);
+            rsdp = (acpi_rsdp_t*)(mem_start);
             break;
         }
     }