MAIN_BIOS_AREA_START equ 0xe0000 ; Arguments: ; [Furthest from EBP] ; 1. Pointer to RSDT ; 0. Pointer to driver area of 65536 bytes ; [Nearest to EBP] acpi_enumerate_tables: .prolog: push esi sub esp, 32 mov esi, esp mov [esi + (32 - 4)], eax mov [esi + (32 - 8)], ebx mov [esi + (32 - 12)], ecx mov [esi + (32 - 16)], edx mov [esi + (32 - 20)], edi ; ESI + 4: Number of RSDT entries ; ESI + 8: Start of RSDT's entries .get_table_metrics: ; First, get the length of the full RSDT with header mov ebx, [ebp + 8] mov eax, [ebx + 4] ; Subtract the length of the RSDT's header to just get ; the length of all the table sub eax, 36 ; Save the value for later, to get the start of the entries. mov edx, eax ; Divide through 4 to get the number of entries shr eax, 2 mov [esi + 4], eax ; Save the table entries' start add edx, [ebp + 4] mov [esi + 4], edx .initialize_enumeration_loop: xor ecx, ecx .enumeration_loop: cmp ecx, [esi + 4] ; Calculate the address of the current entry mov eax, ecx shl eax, 2 mov ebx, [esi + 8] add ebx, eax mov eax, [ebx]Z inc ecx jmp .enumeration_loop .epilog: mov edi, [esi + (32 - 20)] mov edx, [esi + (32 - 16)] mov ecx, [esi + (32 - 12)] mov ebx, [esi + (32 - 8)] mov eax, [esi + (32 - 4)] add esp, 32 pop esi ret ; Arguments: ; -- None -- acpi_search_rsdt: .prolog: push esi sub esp, 8 mov esi, esp mov [esi], dword 0 mov [esi + 4], ecx .search_loop_header: mov ecx, MAIN_BIOS_AREA_START .search_loop: push ebp mov ebp, esp push ecx push dword .signature push dword 8 call mem_equal mov esp, ebp pop ebp cmp ax, 0 jne .rsdp_found add ecx, 16 cmp ecx, 0x100000 jb .search_loop ; If no "RSD PTR "-signature could be found xor ecx, ecx .resolve_rsdp: ; The 4-byte RSDT-pointer is at byte-offset 4 into the RSDP strucfture. mov eax, ecx add eax, 4 mov eax, [eax] .epilog: mov ecx, [esi + 4] add esp, 8 pop esi ret .signature: db "RSD PTR "