Rev 837 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 837 | Rev 838 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. 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: 837 $ |
8 | $Revision: 838 $ |
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 | - | ||
18 | mov eax, cr0 |
- | |
19 | and eax, not (CR0_CD+CR0_NW) |
- | |
20 | or eax, CR0_CD ;disable caching |
- | |
21 | mov cr0, eax |
- | |
22 | wbinvd ;invalidate cache |
- | |
23 | - | ||
24 | xor edi, edi |
- | |
25 | mov ebx, 'TEST' |
- | |
26 | @@: |
- | |
27 | add edi, 0x100000 |
- | |
28 | xchg ebx, dword [edi] |
- | |
29 | cmp dword [edi], 'TEST' |
- | |
30 | xchg ebx, dword [edi] |
- | |
31 | je @b |
- | |
32 | mov [MEM_AMOUNT-OS_BASE], edi |
- | |
33 | - | ||
34 | and eax, not (CR0_CD+CR0_NW) ;enable caching |
- | |
Line 35... | Line 11... | ||
35 | mov cr0, eax |
11 | MEM_WB equ 6 ;write-back memory |
36 | mov eax, edi |
12 | MEM_WC equ 1 ;write combined memory |
Line 37... | Line 13... | ||
37 | ret |
13 | MEM_UC equ 0 ;uncached memory |
38 | endp |
- | |
39 | - | ||
40 | align 4 |
- | |
41 | proc init_mem |
- | |
42 | 14 | ||
- | 15 | ||
43 | mov ecx, [0x2F0000 + 0x9100] |
16 | align 4 |
44 | test ecx, ecx |
17 | proc init_mem |
45 | jz .nosmap |
18 | |
46 | 19 | mov ecx, [0x2F0000 + 0x9100] |
|
47 | xor eax, eax |
20 | mov esi, 0x2F0000 + 0x9104 |
Line 56... | Line 29... | ||
56 | mov eax, [esi+8] |
29 | mov eax, [esi+8] |
57 | .next: |
30 | .next: |
58 | add esi, 20 |
31 | add esi, 20 |
59 | loop @B |
32 | loop @B |
Line 60... | Line -... | ||
60 | - | ||
61 | mov [MEM_AMOUNT-OS_BASE], eax |
33 | |
62 | jmp @F |
- | |
63 | .nosmap: |
- | |
Line 64... | Line 34... | ||
64 | call mem_test |
34 | and eax, -4096 |
65 | - | ||
66 | mov eax, [MEM_AMOUNT-OS_BASE] |
35 | |
Line 67... | Line 36... | ||
67 | @@: |
36 | mov [MEM_AMOUNT-OS_BASE], eax |
68 | mov [pg_data.mem_amount-OS_BASE], eax |
37 | mov [pg_data.mem_amount-OS_BASE], eax |
69 | 38 |