Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2293 Serge 1
format MS COFF
2
 
3
extrn  _acpi_rsdt_base
4
 
5
public _acpi_locate
6
public @rsdt_find@8
7
 
8
OS_BASE                    equ 0x80000000
9
 
10
ACPI_HI_RSDP_WINDOW_START  equ (OS_BASE+0x000E0000)
11
ACPI_HI_RSDP_WINDOW_END    equ (OS_BASE+0x00100000)
12
ACPI_RSDP_CHECKSUM_LENGTH  equ 20
13
 
14
section '.text' code readable executable align 16
15
 
16
 
17
_acpi_locate:
18
        push ebx
19
        mov ebx, ACPI_HI_RSDP_WINDOW_START
20
.check:
21
        cmp [ebx], dword 0x20445352
22
        jne .next
23
        cmp [ebx+4], dword 0x20525450
24
        jne .next
25
 
26
        mov edx, ebx
27
        mov ecx, ACPI_RSDP_CHECKSUM_LENGTH
28
        xor eax, eax
29
.sum:
30
        add al, [edx]
31
        inc edx
32
        loop .sum
33
 
34
        test al, al
35
        jnz .next
36
 
37
        mov eax, ebx
38
        pop ebx
39
        ret
40
.next:
41
        add ebx, 16
42
        cmp ebx, ACPI_HI_RSDP_WINDOW_END
43
        jb .check
44
 
45
        pop ebx
46
        xor eax, eax
47
        ret
48
 
49
align 4
50
@rsdt_find@8:           ;ecx= rsdt edx= SIG
51
        push ebx
52
        push esi
53
 
54
        lea ebx, [ecx+36]
55
        mov esi, [ecx+4]
56
        add esi, ecx
57
.next:
58
        mov eax, [ebx]
59
        sub eax, [_acpi_rsdt_base]
60
        add eax, ecx
61
 
62
        cmp [eax], edx
63
        je .done
64
 
65
        add ebx, 4
66
        cmp ebx, esi
67
        jb .next
68
 
69
        xor eax, eax
70
        pop esi
71
        pop ebx
72
        ret
73
 
74
.done:
75
        mov eax, [ebx]
76
        pop esi
77
        pop ebx
78
        ret
79