Subversion Repositories Kolibri OS

Rev

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

Rev 211 Rev 212
Line 1... Line 1...
1
tmp_page_tab      equ 0x01000000
1
tmp_page_tab      equ 0x00C00000
Line 2... Line 2...
2
 
2
 
3
align 4
3
align 4
4
proc mem_test
4
proc mem_test
-
 
5
           mov eax, cr0
5
           mov eax, cr0
6
           and eax, not (CR0_CD+CR0_NW)
6
           or eax, (CR0_CD+CR0_NW);disable caching
7
           or eax, CR0_CD       ;disable caching
7
           mov cr0, eax
8
           mov cr0, eax
Line 8... Line 9...
8
           wbinvd                 ;invalidate cache
9
           wbinvd               ;invalidate cache
9
 
10
 
Line 15... Line 16...
15
           cmp dword [edi], 'TEST'
16
           cmp dword [edi], 'TEST'
16
           xchg ebx, dword [edi]
17
           xchg ebx, dword [edi]
17
           je @b
18
           je @b
18
 
19
 
Line 19... Line 20...
19
           and eax, not (CR0_CD+CR0_NW)
20
           and eax, not (CR0_CD+CR0_NW)  ;enable caching
20
           mov cr0, eax
21
           mov cr0, eax
21
           mov eax, edi
22
           mov eax, edi
22
           ret
23
           ret
23
endp
24
endp
Line 46... Line 47...
46
           add eax, 0x00400000
47
           add eax, 0x00400000
47
           mov dword [sys_pgdir+4], eax
48
           mov dword [sys_pgdir+4], eax
48
           add eax, 0x00400000
49
           add eax, 0x00400000
49
           mov dword [sys_pgdir+8], eax
50
           mov dword [sys_pgdir+8], eax
50
           add eax, 0x00400000
51
;           add eax, 0x00400000
51
           mov dword [sys_pgdir+12], eax
52
;           mov dword [sys_pgdir+12], eax
52
 
53
 
Line 53... Line 54...
53
           mov dword [sys_pgdir+0x600], sys_pgdir+PG_SW
54
           mov dword [sys_pgdir+0x600], sys_pgdir+PG_SW
Line 54... Line 55...
54
 
55
 
55
           mov ecx, [pg_data.kernel_tables]
56
           mov ecx, [pg_data.kernel_tables]
56
           sub ecx, 4
57
           sub ecx, 3 ;4
57
           mov eax, tmp_page_tab+PG_SW
58
           mov eax, tmp_page_tab+PG_SW
Line 58... Line 59...
58
           mov edi, sys_pgdir+16
59
           mov edi, sys_pgdir+12     ;16
59
 
60
 
60
           jmp .map_kernel_tabs
61
           jmp .map_kernel_tabs
61
.no_PSE:
62
.no_PSE:
62
           mov eax, PG_SW
63
           mov eax, PG_SW
63
           mov esi, tmp_page_tab
64
           mov esi, tmp_page_tab
64
           mov ecx, 4096/4      ;0x0 - 0x00FFFFFF
65
           mov ecx, 3072/4;  4096/4      ;0x0 - 0x00FFFFFF
65
.map_low:
66
.map_low:
66
           mov [esi], eax
67
           mov [esi], eax
67
           add eax, 0x1000
68
           add eax, 0x1000
Line 89... Line 90...
89
 
90
 
Line 90... Line 91...
90
           mov edi, tmp_page_tab
91
           mov edi, tmp_page_tab
91
           bt [cpu_caps], CAPS_PSE
92
           bt [cpu_caps], CAPS_PSE
92
           jc @F
93
           jc @F
93
           add edi, 4096*4      ;skip low kernel memory
94
           add edi, 3072*4    ;4096*4  ;skip low kernel memory
94
@@:
95
@@:
95
           mov ecx, [pg_data.kernel_tables]
96
           mov ecx, [pg_data.kernel_tables]
96
           sub ecx, 4
97
           sub ecx, 3
97
           shl ecx, 10
98
           shl ecx, 10
98
           xor eax, eax
99
           xor eax, eax
99
           cld
100
           cld
100
           rep stosd
101
           rep stosd
Line 106... Line 107...
106
 
107
 
Line 107... Line 108...
107
align 4
108
align 4
108
proc init_page_map
109
proc init_page_map
109
           mov edi, sys_pgmap
110
           mov edi, sys_pgmap
110
           mov ecx, 512/4
111
           mov ecx, 384/4
111
           xor eax,eax
112
           xor eax,eax
112
           cld
113
           cld
113
           rep stosd
114
           rep stosd
Line 114... Line 115...
114
 
115
 
115
           not eax
116
           not eax
116
           mov ecx, [pg_data.pagemap_size]
117
           mov ecx, [pg_data.pagemap_size]
117
           sub ecx, 512
118
           sub ecx, 384
118
           shr ecx, 2
119
           shr ecx, 2
Line 119... Line 120...
119
           rep stosd
120
           rep stosd
120
 
121
 
121
           mov edi, sys_pgmap+512
122
           mov edi, sys_pgmap+384
122
           mov edx, [pg_data.pages_count]
123
           mov edx, [pg_data.pages_count]
123
           mov ecx, [pg_data.kernel_tables]
124
           mov ecx, [pg_data.kernel_tables]
124
           bt [cpu_caps], CAPS_PSE
125
           bt [cpu_caps], CAPS_PSE
125
           jnc @f
126
           jnc @f
126
           sub ecx, 4
127
           sub ecx, 3
127
@@:
128
@@:
128
           sub edx, 4096
129
           sub edx, 3072
Line 129... Line 130...
129
           sub edx, ecx
130
           sub edx, ecx
130
           mov [pg_data.pages_free], edx
131
           mov [pg_data.pages_free], edx
Line 139... Line 140...
139
           and ecx, 31
140
           and ecx, 31
140
           shl eax, cl
141
           shl eax, cl
141
           stosd
142
           stosd
142
 
143
 
Line 143... Line 144...
143
           mov [page_start], sys_pgmap+512
144
           mov [page_start], sys_pgmap+384
144
           mov ebx, sys_pgmap
145
           mov ebx, sys_pgmap
145
           add ebx, [pg_data.pagemap_size]
146
           add ebx, [pg_data.pagemap_size]
146
           mov [page_end], ebx
147
           mov [page_end], ebx
Line 147... Line 148...
147
 
148