Rev 2010 | Rev 2166 | 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-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: 2010 $ |
8 | $Revision: 2130 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 358... | Line 358... | ||
358 | img_pages dd ? |
358 | img_pages dd ? |
359 | dir_addr dd ? |
359 | dir_addr dd ? |
360 | app_tabs dd ? |
360 | app_tabs dd ? |
361 | endl |
361 | endl |
Line 362... | Line 362... | ||
362 | 362 | ||
363 | mov ebx, pg_data.pg_mutex |
363 | mov ecx, pg_data.mutex |
Line 364... | Line 364... | ||
364 | call wait_mutex ;ebx |
364 | call mutex_lock |
365 | 365 | ||
Line 366... | Line 366... | ||
366 | xor eax, eax |
366 | xor eax, eax |
Line 478... | Line 478... | ||
478 | end if |
478 | end if |
Line 479... | Line 479... | ||
479 | 479 | ||
480 | .done: |
480 | .done: |
Line 481... | Line 481... | ||
481 | stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP |
481 | stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP |
- | 482 | ||
482 | 483 | mov ecx, pg_data.mutex |
|
483 | dec [pg_data.pg_mutex] |
484 | call mutex_unlock |
484 | mov eax, [dir_addr] |
485 | mov eax, [dir_addr] |
485 | ret |
486 | ret |
- | 487 | .fail: |
|
486 | .fail: |
488 | mov ecx, pg_data.mutex |
487 | dec [pg_data.pg_mutex] |
489 | call mutex_unlock |
488 | cmp [dir_addr], 0 |
490 | cmp [dir_addr], 0 |
489 | je @f |
491 | je @f |
490 | stdcall destroy_app_space, [dir_addr], 0 |
492 | stdcall destroy_app_space, [dir_addr], 0 |
Line 552... | Line 554... | ||
552 | pop ecx |
554 | pop ecx |
553 | cmp edx,1 |
555 | cmp edx,1 |
554 | jg .ret |
556 | jg .ret |
555 | ;if there isn't threads then clear memory. |
557 | ;if there isn't threads then clear memory. |
556 | mov esi, [dlls_list] |
558 | mov esi, [dlls_list] |
557 | call destroy_all_hdlls |
559 | call destroy_all_hdlls ;ecx=APPDATA |
Line 558... | Line 560... | ||
558 | 560 | ||
559 | mov ebx, pg_data.pg_mutex |
561 | mov ecx, pg_data.mutex |
Line 560... | Line 562... | ||
560 | call wait_mutex ;ebx |
562 | call mutex_lock |
561 | 563 | ||
562 | mov eax, [pg_dir] |
564 | mov eax, [pg_dir] |
563 | and eax, not 0xFFF |
565 | and eax, not 0xFFF |
Line 581... | Line 583... | ||
581 | mov eax, [pg_dir] |
583 | mov eax, [pg_dir] |
582 | call free_page |
584 | call free_page |
583 | .exit: |
585 | .exit: |
584 | stdcall map_page,[tmp_task_ptab],0,PG_UNMAP |
586 | stdcall map_page,[tmp_task_ptab],0,PG_UNMAP |
585 | stdcall map_page,[tmp_task_pdir],0,PG_UNMAP |
587 | stdcall map_page,[tmp_task_pdir],0,PG_UNMAP |
586 | dec [pg_data.pg_mutex] |
588 | mov ecx, pg_data.mutex |
- | 589 | call mutex_unlock |
|
587 | .ret: |
590 | .ret: |
588 | ret |
591 | ret |
589 | endp |
592 | endp |
Line 590... | Line 593... | ||
590 | 593 | ||
Line 954... | Line 957... | ||
954 | mov [application_table_status],eax |
957 | mov [application_table_status],eax |
955 | dec eax ;-1 |
958 | dec eax ;-1 |
956 | ret |
959 | ret |
957 | endp |
960 | endp |
Line 958... | Line -... | ||
958 | - | ||
959 | ; param |
- | |
960 | ; ebx=mutex |
- | |
961 | - | ||
962 | align 4 |
- | |
963 | wait_mutex: |
- | |
964 | ;;Maxis use atomic bts for mutex 4.4.2009 |
- | |
965 | push eax |
- | |
966 | push ebx |
- | |
967 | .do_wait: |
- | |
968 | bts dword [ebx],0 |
- | |
969 | jnc .locked |
- | |
970 | call change_task |
- | |
971 | jmp .do_wait |
- | |
972 | .locked: |
- | |
973 | pop ebx |
- | |
974 | pop eax |
- | |
975 | ret |
- | |
976 | 961 | ||
977 | align 4 |
962 | align 4 |
Line 978... | Line 963... | ||
978 | tls_app_entry: |
963 | tls_app_entry: |
979 | 964 |