Subversion Repositories Kolibri OS

Rev

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

Rev 859 Rev 861
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: 859 $
8
$Revision: 861 $
9
 
9
 
10
 
10
 
Line 29... Line 29...
29
 
29
 
Line 30... Line 30...
30
           ret
30
           ret
31
 
31
 
Line 32... Line -...
32
 
-
 
33
align 4
-
 
34
proc free_page
-
 
35
 
-
 
36
;arg:  eax  page address
-
 
37
;           pushfd
-
 
38
;           cli
-
 
39
;           shr eax, 12                        ;page index
-
 
40
;           bts dword [sys_pgmap], eax         ;that's all!
-
 
41
;           cmc
-
 
42
;           adc [pg_data.pages_free], 0
-
 
43
;           shr eax, 3
-
 
44
;           and eax, not 3                     ;dword offset from page_map
-
 
45
;           add eax, sys_pgmap
-
 
46
;           cmp [page_start], eax
-
 
47
;           ja @f
-
 
48
;           popfd
-
 
49
;           ret
32
 
50
;@@:
-
 
Line 51... Line 33...
51
;           mov [page_start], eax
33
align 4
Line 52... Line 34...
52
;           popfd
34
free_page:
53
           ret
35
 
Line 143... Line 125...
143
           mov edi, eax
125
           mov edi, eax
Line 144... Line 126...
144
 
126
 
145
           shr esi, 10
127
           shr esi, 10
Line 146... Line -...
146
           add esi, page_tabs
-
 
147
 
-
 
148
;           mov ebp, [pg_data.pages_free]
-
 
149
;           mov ebx, [page_start]
128
           add esi, page_tabs
150
     ;      mov edx, sys_pgmap
129
 
151
@@:
130
@@:
152
           xor eax, eax
131
           xor eax, eax
153
           xchg eax, [esi]
132
           xchg eax, [esi]
154
           push eax
133
           push eax
155
           invlpg [edi]
-
 
156
           pop eax
-
 
157
 
-
 
158
;           test eax, 1
-
 
159
;           jz .next
-
 
160
 
-
 
161
;           shr eax, 12
-
 
162
    ;       bts [edx], eax
-
 
163
;           cmc
-
 
164
;           adc ebp, 0
-
 
165
;           shr eax, 3
-
 
166
;           and eax, -4
-
 
167
;           add eax, edx
-
 
168
;           cmp eax, ebx
-
 
169
;           jae .next
-
 
170
 
134
           invlpg [edi]
171
;           mov ebx, eax
135
           pop eax
172
.next:
136
.next:
173
           add edi, 0x1000
137
           add edi, 0x1000
174
           add esi, 4
138
           add esi, 4
175
           dec ecx
-
 
176
           jnz @B
139
           dec ecx
177
         ;  mov [pg_data.pages_free], ebp
140
           jnz @B
178
           and [pg_data.pg_mutex],0
141
           and [pg_data.pg_mutex],0
Line 179... Line 142...
179
           popad
142
           popad
Line 438... Line 401...
438
           inc [pg_data.pages_faults]
401
           inc [pg_data.pages_faults]
Line 439... Line 402...
439
 
402
 
440
           mov ebx, [.err_addr]
403
           mov ebx, [.err_addr]
Line 441... Line -...
441
           mov eax, [.err_code]
-
 
442
 
-
 
443
         ;  xchg bx, bx
404
           mov eax, [.err_code]
444
 
405
 
Line 445... Line 406...
445
           cmp ebx, HEAP_BASE
406
           cmp ebx, HEAP_BASE
446
           jb .user_space      ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
407
           jb .user_space      ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
Line 447... Line 408...
447
 
408
 
448
           cmp ebx, LFB_BASE
409
           cmp ebx, LFB_BASE
Line -... Line 410...
-
 
410
           jb  .kernel_heap
-
 
411
 
-
 
412
           cmp ebx, page_tabs
449
           jb  .kernel_heap
413
           jb .lfb
450
 
414
 
Line 451... Line -...
451
           cmp ebx, page_tabs
-
 
Line 452... Line 415...
452
           jb .lfb
415
           cmp ebx, heap_tabs
453
 
416
           jb .user_tabs
454
           cmp ebx, OS_BASE
417
 
Line -... Line 418...
-
 
418
           cmp ebx, OS_BASE
-
 
419
           jb .heap_tab
455
           jb .core_tabs
420
 
456
 
421
 
457
           jmp .core_tabs
422
         ;  cmp ebx, kernel_tabs
458
 
423
         ;  jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ;
459
         ;  cmp ebx, kernel_tabs
424
                               ;ïðîñòî ñîçäàäèì îäíó
Line 460... Line 425...
460
         ;  jb .alloc;.app_tabs ;òàáëèöû ñòðàíèö ïðèëîæåíèÿ ;
425
 
-
 
426
 
-
 
427
 
-
 
428
.lfb:
-
 
429
           shr ebx, 22
-
 
430
           mov edx, [_sys_pdbr + ebx*4]
-
 
431
           mov [master_tab + ebx*4], edx
-
 
432
           jmp .exit
-
 
433
 
-
 
434
.user_tabs:
-
 
435
           shr ebx, 12
-
 
436
           and ebx, 0x3FF
-
 
437
           mov edx, [master_tab + ebx*4]
-
 
438
           test edx, PG_MAP
-
 
439
           jnz .fail
-
 
440
 
-
 
441
           call _alloc_page
-
 
442
           test eax, eax
-
 
443
           jz .fail
-
 
444
 
Line -... Line 445...
-
 
445
           lea edx, [eax + PG_UW]
461
                               ;ïðîñòî ñîçäàäèì îäíó
446
           lea edi, [eax + OS_BASE]
462
 
447
           mov ecx, 1024
463
.lfb:
448
           xor eax, eax
464
           shr ebx, 22
449
           cld
465
           mov edx, [_sys_pdbr + ebx*4]
450
           rep stosd
Line -... Line 451...
-
 
451
 
-
 
452
           mov [master_tab + ebx*4], edx
-
 
453
           jmp .exit
466
           mov [master_tab + ebx*4], edx
454
 
467
           jmp .exit
455
.heap_tab:
Line 468... Line -...
468
 
-
 
469
.core_tabs:
456
           shr ebx, 12
470
 
457
           and ebx, 0x3FF
471
           shr ebx, 12
458
           mov edx, [master_tab + ebx*4]
472
           and ebx, 0x3FF
459
           test edx, PG_MAP
Line -... Line 460...
-
 
460
           jz .check_ptab      ;òàáëèöà ñòðàíèö íå ñîçäàíà
473
           mov edx, [master_tab + ebx*4]
461
 
474
           test edx, PG_MAP
-
 
Line 475... Line 462...
475
           jz .check_ptab      ;òàáëèöà ñòðàíèö íå ñîçäàíà
462
           jmp .fail
476
 
463
 
477
align 4
464
 
478
.kernel_heap:
465
align 4