Subversion Repositories Kolibri OS

Rev

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

Rev 1505 Rev 1507
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2008. 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: 1455 $
8
$Revision: 1507 $
9
 
9
 
10
 
10
 
Line 11... Line -...
11
MEM_WB     equ 6               ;write-back memory
-
 
12
MEM_WC     equ 1               ;write combined memory
-
 
13
MEM_UC     equ 0               ;uncached memory
-
 
14
 
-
 
15
align 4
-
 
16
proc mem_test
-
 
17
; if we have BIOS with fn E820, skip the test
-
 
18
           cmp dword [BOOT_VAR-OS_BASE + 0x9100], 0
-
 
19
           jnz .ret
-
 
20
 
-
 
21
           mov eax, cr0
-
 
22
           and eax, not (CR0_CD+CR0_NW)
-
 
23
           or eax, CR0_CD         ;disable caching
-
 
24
           mov cr0, eax
-
 
25
           wbinvd                 ;invalidate cache
-
 
26
 
-
 
27
           xor edi, edi
-
 
28
           mov ebx, 'TEST'
-
 
29
@@:
-
 
30
           add edi, 0x100000
-
 
31
           xchg ebx, dword [edi]
-
 
32
           cmp dword [edi], 'TEST'
-
 
33
           xchg ebx, dword [edi]
-
 
34
           je @b
-
 
35
 
-
 
36
           and eax, not (CR0_CD+CR0_NW)  ;enable caching
-
 
37
           mov cr0, eax
-
 
38
           inc dword [BOOT_VAR-OS_BASE + 0x9100]
-
 
39
           xor eax, eax
-
 
40
           mov [BOOT_VAR-OS_BASE + 0x9104], eax
-
 
41
           mov [BOOT_VAR-OS_BASE + 0x9108], eax
-
 
42
           mov [BOOT_VAR-OS_BASE + 0x910C], edi
-
 
Line 43... Line 11...
43
           mov [BOOT_VAR-OS_BASE + 0x9110], eax
11
MEM_WB     equ 6               ;write-back memory
44
.ret:
12
MEM_WC     equ 1               ;write combined memory
45
           ret
13
MEM_UC     equ 0               ;uncached memory
46
endp
14
 
Line 127... Line 95...
127
           mov ecx, 4096/4
95
           mov ecx, 4096/4
128
           cld
96
           cld
129
           rep stosd
97
           rep stosd
Line 130... Line 98...
130
 
98
 
131
           mov edx, (sys_pgdir-OS_BASE)+ 0x800; (OS_BASE shr 20)
-
 
132
           bt [cpu_caps-OS_BASE], CAPS_PSE
-
 
Line 133... Line 99...
133
           jnc .no_PSE
99
           mov edx, (sys_pgdir-OS_BASE)+ 0x800; (OS_BASE shr 20)
134
 
100
 
135
           mov ebx, cr4
101
           mov ebx, cr4
136
           or ebx, CR4_PSE
102
           or ebx, CR4_PSE
Line 140... Line 106...
140
 
106
 
141
           mov [edx], eax
107
           mov [edx], eax
Line 142... Line 108...
142
           add edx, 4
108
           add edx, 4
143
 
-
 
144
           mov edi, [tmp_page_tabs] 
-
 
145
           jmp .map_kernel_heap		; new kernel fits to the first 4Mb - nothing to do with ".map_low"
-
 
146
.no_PSE:
-
 
147
           mov eax, PG_SW
-
 
148
           mov ecx, [tmp_page_tabs]
-
 
149
           shr ecx, 12
-
 
150
.map_low:
-
 
151
           mov edi, [tmp_page_tabs]
-
 
152
@@:                                   ;
-
 
153
           stosd
-
 
154
           add eax, 0x1000
-
 
155
           dec ecx
-
 
156
           jnz @B
-
 
157
 
109
 
158
.map_kernel_heap:
110
           mov edi, [tmp_page_tabs] 
159
           mov ecx, [pg_data.kernel_tables-OS_BASE]
111
           mov ecx, [pg_data.kernel_tables-OS_BASE]
160
           shl ecx, 10
112
           shl ecx, 10