Rev 6590 | Rev 7126 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6590 | Rev 7122 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. 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: 6590 $ |
8 | $Revision: 7122 $ |
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_VARS-OS_BASE + 0x9100], 0 |
18 | cmp dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT], 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_VARS-OS_BASE + 0x9100] |
38 | inc dword [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCK_CNT] |
39 | xor eax, eax |
39 | xor eax, eax |
40 | mov [BOOT_VARS-OS_BASE + 0x9104], eax |
40 | mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.lo], eax |
41 | mov [BOOT_VARS-OS_BASE + 0x9108], eax |
41 | mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.addr.hi], eax |
42 | mov [BOOT_VARS-OS_BASE + 0x910C], edi |
42 | mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.lo], edi |
43 | mov [BOOT_VARS-OS_BASE + 0x9110], eax |
43 | mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.size.hi], eax |
44 | inc eax |
44 | inc eax |
45 | mov [BOOT_VARS-OS_BASE + 0x9114], eax |
45 | mov [BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS + e820entry.type], eax |
46 | .ret: |
46 | .ret: |
47 | ret |
47 | ret |
Line 48... | Line 48... | ||
48 | endp |
48 | endp |
49 | 49 | ||
50 | align 4 |
50 | align 4 |
51 | proc init_mem |
51 | proc init_mem |
52 | ; calculate maximum allocatable address and number of allocatable pages |
52 | ; calculate maximum allocatable address and number of allocatable pages |
53 | mov edi, BOOT_VARS-OS_BASE + 0x9104 |
53 | mov edi, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS |
54 | mov ecx, [edi-4] |
54 | mov ecx, [edi-4] |
55 | xor esi, esi; esi will hold total amount of memory |
55 | xor esi, esi; esi will hold total amount of memory |
56 | xor edx, edx; edx will hold maximum allocatable address |
56 | xor edx, edx; edx will hold maximum allocatable address |
Line 195... | Line 195... | ||
195 | xor eax, eax |
195 | xor eax, eax |
196 | cld |
196 | cld |
197 | rep stosd |
197 | rep stosd |
Line 198... | Line 198... | ||
198 | 198 | ||
199 | ; scan through memory map and mark free areas as available |
199 | ; scan through memory map and mark free areas as available |
200 | mov ebx, BOOT_VARS-OS_BASE + 0x9104 |
200 | mov ebx, BOOT_VARS-OS_BASE + BOOT_MEMMAP_BLOCKS |
201 | mov edx, [ebx-4] |
201 | mov edx, [ebx-4] |
202 | .scanmap: |
202 | .scanmap: |
203 | cmp [ebx+16], byte 1 |
203 | cmp [ebx+16], byte 1 |
Line 446... | Line 446... | ||
446 | 446 | ||
447 | ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 |
447 | ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 |
448 | ACPI_HI_RSDP_WINDOW_END equ 0x00100000 |
448 | ACPI_HI_RSDP_WINDOW_END equ 0x00100000 |
Line 449... | Line 449... | ||
449 | ACPI_RSDP_CHECKSUM_LENGTH equ 20 |
449 | ACPI_RSDP_CHECKSUM_LENGTH equ 20 |
450 | 450 | ||
451 | ACPI_HPET_SIGN equ 0x54455048 |
451 | ACPI_HPET_SIGN equ 'HPET' |
Line 452... | Line 452... | ||
452 | ACPI_MADT_SIGN equ 0x43495041 |
452 | ACPI_MADT_SIGN equ 'APIC' |
453 | ACPI_FADT_SIGN equ 0x50434146 |
453 | ACPI_FADT_SIGN equ 'FACP' |
454 | 454 | ||
Line 475... | Line 475... | ||
475 | pop edi |
475 | pop edi |
476 | pop ebx |
476 | pop ebx |
477 | ret |
477 | ret |
Line 478... | Line 478... | ||
478 | 478 | ||
479 | .check: |
479 | .check: |
480 | cmp [ebx], dword 0x20445352 |
480 | cmp [ebx], dword 'RSD ' |
481 | jne .next |
481 | jne .next |
482 | cmp [ebx+4], dword 0x20525450 |
482 | cmp [ebx+4], dword 'PTR ' |
Line 483... | Line 483... | ||
483 | jne .next |
483 | jne .next |
484 | 484 | ||
485 | mov edx, ebx |
485 | mov edx, ebx |