Rev 3725 | Rev 5201 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3725 | Rev 3908 | ||
---|---|---|---|
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: 3725 $ |
8 | $Revision: 3908 $ |
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 |