Subversion Repositories Kolibri OS

Rev

Rev 3539 | Rev 4390 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3539 Rev 3732
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 3539 $
8
$Revision: 3732 $
9
 
9
 
10
 
10
 
Line 11... Line 11...
11
MEM_WB     equ 6               ;write-back memory
11
MEM_WB     equ 6               ;write-back memory
12
MEM_WC     equ 1               ;write combined memory
12
MEM_WC     equ 1               ;write combined memory
13
MEM_UC     equ 0               ;uncached memory
13
MEM_UC     equ 0               ;uncached memory
14
 
14
 
15
align 4
15
align 4
Line 16... Line 16...
16
proc mem_test
16
proc mem_test
17
; if we have BIOS with fn E820, skip the test
17
; if we have BIOS with fn E820, skip the test
18
        cmp     dword [BOOT_VAR-OS_BASE + 0x9100], 0
18
        cmp     dword [BOOT_VARS-OS_BASE + 0x9100], 0
Line 33... Line 33...
33
        xchg    ebx, dword [edi]
33
        xchg    ebx, dword [edi]
34
        je      @b
34
        je      @b
Line 35... Line 35...
35
 
35
 
36
        and     eax, not (CR0_CD+CR0_NW) ;enable caching
36
        and     eax, not (CR0_CD+CR0_NW) ;enable caching
37
        mov     cr0, eax
37
        mov     cr0, eax
38
        inc     dword [BOOT_VAR-OS_BASE + 0x9100]
38
        inc     dword [BOOT_VARS-OS_BASE + 0x9100]
39
        xor     eax, eax
39
        xor     eax, eax
40
        mov     [BOOT_VAR-OS_BASE + 0x9104], eax
40
        mov     [BOOT_VARS-OS_BASE + 0x9104], eax
41
        mov     [BOOT_VAR-OS_BASE + 0x9108], eax
41
        mov     [BOOT_VARS-OS_BASE + 0x9108], eax
42
        mov     [BOOT_VAR-OS_BASE + 0x910C], edi
42
        mov     [BOOT_VARS-OS_BASE + 0x910C], edi
43
        mov     [BOOT_VAR-OS_BASE + 0x9110], eax
43
        mov     [BOOT_VARS-OS_BASE + 0x9110], eax
44
.ret:
44
.ret:
45
        ret
45
        ret
Line 46... Line 46...
46
endp
46
endp
47
 
47
 
48
align 4
48
align 4
49
proc init_mem
49
proc init_mem
50
; calculate maximum allocatable address and number of allocatable pages
50
; calculate maximum allocatable address and number of allocatable pages
51
        mov     edi, BOOT_VAR-OS_BASE + 0x9104
51
        mov     edi, BOOT_VARS-OS_BASE + 0x9104
52
        mov     ecx, [edi-4]
52
        mov     ecx, [edi-4]
53
        xor     esi, esi; esi will hold total amount of memory
53
        xor     esi, esi; esi will hold total amount of memory
54
        xor     edx, edx; edx will hold maximum allocatable address
54
        xor     edx, edx; edx will hold maximum allocatable address
Line 193... Line 193...
193
        xor     eax, eax
193
        xor     eax, eax
194
        cld
194
        cld
195
        rep stosd
195
        rep stosd
Line 196... Line 196...
196
 
196
 
197
; scan through memory map and mark free areas as available
197
; scan through memory map and mark free areas as available
198
        mov     ebx, BOOT_VAR-OS_BASE + 0x9104
198
        mov     ebx, BOOT_VARS-OS_BASE + 0x9104
199
        mov     edx, [ebx-4]
199
        mov     edx, [ebx-4]
200
.scanmap:
200
.scanmap:
201
        cmp     [ebx+16], byte 1
201
        cmp     [ebx+16], byte 1
Line 451... Line 451...
451
 
451
 
452
acpi_dev_data     rd 1
452
acpi_dev_data     rd 1
Line 453... Line 453...
453
acpi_dev_size     rd 1
453
acpi_dev_size     rd 1
-
 
454
 
-
 
455
acpi_rsdt_base    rd 1
-
 
456
acpi_fadt_base    rd 1
454
 
457
acpi_dsdt_base    rd 1
455
acpi_rsdt_base    rd 1
458
acpi_dsdt_size    rd 1
Line 456... Line 459...
456
acpi_madt_base    rd 1
459
acpi_madt_base    rd 1
457
acpi_ioapic_base  rd 1
460
acpi_ioapic_base  rd 1
Line 462... Line 465...
462
 
465
 
463
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
466
ACPI_HI_RSDP_WINDOW_START  equ 0x000E0000
464
ACPI_HI_RSDP_WINDOW_END    equ 0x00100000
467
ACPI_HI_RSDP_WINDOW_END    equ 0x00100000
465
ACPI_RSDP_CHECKSUM_LENGTH  equ 20
468
ACPI_RSDP_CHECKSUM_LENGTH  equ 20
-
 
469
ACPI_MADT_SIGN             equ 0x43495041
Line 466... Line 470...
466
ACPI_MADT_SIGN             equ 0x43495041
470
ACPI_FADT_SIGN             equ 0x50434146
467
 
471
 
468
 
472
 
Line 533... Line 537...
533
        call    acpi_locate
537
        call    acpi_locate
534
        test    eax, eax
538
        test    eax, eax
535
        jz      .done
539
        jz      .done
Line 536... Line 540...
536
 
540
 
537
        mov     ecx, [eax+16]
541
        mov     ecx, [eax+16]
538
        mov     edx, ACPI_MADT_SIGN
542
        mov     edx, 0x50434146
539
        mov     [acpi_rsdt_base-OS_BASE], ecx
543
        mov     [acpi_rsdt_base-OS_BASE], ecx
-
 
544
        call    rsdt_find
-
 
545
        mov     [acpi_fadt_base-OS_BASE], eax
-
 
546
        test    eax, eax
-
 
547
        jz      @f
-
 
548
 
-
 
549
        mov     eax, [eax+40]
-
 
550
        mov     [acpi_dsdt_base-OS_BASE], eax
-
 
551
        mov     eax, [eax+4]
-
 
552
        mov     [acpi_dsdt_size-OS_BASE], eax
-
 
553
 
-
 
554
@@:
-
 
555
        mov     edx, ACPI_MADT_SIGN
-
 
556
        mov     ecx, [acpi_rsdt_base-OS_BASE]
540
        call    rsdt_find
557
        call    rsdt_find
541
        test    eax, eax
558
        test    eax, eax
Line 542... Line 559...
542
        jz      .done
559
        jz      .done
543
 
560