Subversion Repositories Kolibri OS

Rev

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

Rev 2010 Rev 2130
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2009. 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: 2010 $
8
$Revision: 2130 $
9
 
9
 
Line 212... Line 212...
212
;  ebx= linear address
212
;  ebx= linear address
213
;  ecx= count
213
;  ecx= count
Line 214... Line 214...
214
 
214
 
215
align 4
215
align 4
216
commit_pages:
-
 
217
           push edi
216
commit_pages:
218
           test ecx, ecx
217
           test ecx, ecx
Line -... Line 218...
-
 
218
           jz .fail
-
 
219
 
219
           jz .fail
220
           push edi
220
 
221
           push eax
221
           mov edi, ebx
222
           push ecx
-
 
223
           mov ecx, pg_data.mutex
-
 
224
           call mutex_lock
Line 222... Line 225...
222
           mov ebx, pg_data.pg_mutex
225
           pop ecx
223
           call wait_mutex      ;ebx
226
           pop eax
224
 
227
 
225
           mov edx, 0x1000
228
           mov edi, ebx
226
           mov ebx, edi
-
 
227
           shr ebx, 12
229
           shr edi, 12
228
@@:
230
           lea edi, [page_tabs+edi*4]
229
           mov [page_tabs+ebx*4], eax
-
 
230
          ; push eax
231
@@:
231
           invlpg [edi]
232
           stosd
232
          ; pop eax
-
 
233
           add edi, edx
-
 
234
           add eax, edx
233
           invlpg [ebx]
235
           inc ebx
-
 
236
           dec ecx
234
           add eax, 0x1000
237
           jnz @B
235
           add ebx, 0x1000
-
 
236
           loop @B
-
 
237
 
-
 
238
           pop edi
-
 
239
 
238
           mov [pg_data.pg_mutex],ecx
240
           mov ecx, pg_data.mutex
Line 239... Line 241...
239
.fail:
241
           call mutex_unlock
240
           pop edi
242
.fail:
241
           ret
243
           ret
Line 242... Line 244...
242
 
244
 
243
 
245
 
Line -... Line 246...
-
 
246
; param
244
; param
247
;  eax= base
245
;  eax= base
248
;  ecx= count
246
;  ecx= count
249
 
Line 247... Line 250...
247
 
250
align 4
248
align 4
251
release_pages:
Line 249... Line 252...
249
release_pages:
252
 
250
 
253
           push ebp
-
 
254
           push esi
-
 
255
           push edi
-
 
256
           push ebx
-
 
257
 
-
 
258
           mov esi, eax
Line 251... Line 259...
251
           pushad
259
           mov edi, eax
252
           mov ebx, pg_data.pg_mutex
260
 
253
           call wait_mutex      ;ebx
261
           shr esi, 12
254
 
262
           lea esi, [page_tabs+esi*4]
255
           mov esi, eax
263
 
256
           mov edi, eax
264
           push ecx
257
 
-
 
258
           shr esi, 10
265
           mov ecx, pg_data.mutex
259
           add esi, page_tabs
-
 
Line 260... Line 266...
260
 
266
           call mutex_lock
261
           mov ebp, [pg_data.pages_free]
267
           pop ecx
Line 262... Line 268...
262
           mov ebx, [page_start]
268
 
Line 283... Line 289...
283
 
289
 
284
           mov ebx, eax
290
           mov ebx, eax
285
.next:
291
.next:
286
           add edi, 0x1000
292
           add edi, 0x1000
287
           add esi, 4
-
 
288
           dec ecx
293
           add esi, 4
-
 
294
           loop @B
289
           jnz @B
295
 
290
           mov [pg_data.pages_free], ebp
296
           mov [pg_data.pages_free], ebp
-
 
297
           mov ecx, pg_data.mutex
-
 
298
           call mutex_unlock
-
 
299
 
291
           and [pg_data.pg_mutex],0
300
           pop ebx
-
 
301
           pop edi
-
 
302
           pop esi
292
           popad
303
           pop ebp
Line 293... Line 304...
293
           ret
304
           ret
294
 
305
 
295
; param
306
; param
Line 421... Line 432...
421
endp
432
endp
Line 422... Line 433...
422
 
433
 
423
align 4
434
align 4
Line 424... Line 435...
424
proc new_mem_resize stdcall, new_size:dword
435
proc new_mem_resize stdcall, new_size:dword
425
 
436
 
Line 426... Line 437...
426
           mov ebx, pg_data.pg_mutex
437
           mov ecx, pg_data.mutex
427
           call wait_mutex    ;ebx
438
           call mutex_lock
428
 
439
 
429
           mov edi, [new_size]
440
           mov edi, [new_size]
Line 462... Line 473...
462
 
473
 
463
.update_size:
474
.update_size:
464
           mov     ebx, [new_size]
475
           mov     ebx, [new_size]
Line -... Line 476...
-
 
476
           call    update_mem_size
-
 
477
 
-
 
478
           mov ecx, pg_data.mutex
465
           call    update_mem_size
479
           call mutex_unlock
466
 
-
 
467
           xor eax, eax
480
 
468
           dec [pg_data.pg_mutex]
481
           xor eax, eax
Line 469... Line 482...
469
           ret
482
           ret
470
.expand:
483
.expand:
Line 537... Line 550...
537
.out_of_memory:
550
.out_of_memory:
538
;//-
551
;//-
539
           pop edi
552
           pop edi
540
           pop esi
553
           pop esi
541
.exit:
554
.exit:
-
 
555
           mov ecx, pg_data.mutex
-
 
556
           call mutex_unlock
-
 
557
 
542
           xor eax, eax
558
           xor eax, eax
543
           inc eax
559
           inc eax
544
           dec [pg_data.pg_mutex]
-
 
545
           ret
560
           ret
546
endp
561
endp
Line 547... Line 562...
547
 
562
 
548
update_mem_size:
563
update_mem_size: