Rev 1376 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1376 | Rev 2382 | ||
---|---|---|---|
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: 1376 $ |
8 | $Revision: 2382 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 46... | Line 46... | ||
46 | rep stosd |
46 | rep stosd |
47 | } |
47 | } |
Line 48... | Line 48... | ||
48 | 48 | ||
49 | fs_execute_from_sysdir: |
49 | fs_execute_from_sysdir: |
- | 50 | xor ebx, ebx |
|
50 | xor ebx, ebx |
51 | fs_execute_from_sysdir_param: |
51 | xor edx, edx |
52 | xor edx, edx |
Line 52... | Line 53... | ||
52 | mov esi, sysdir_path |
53 | mov esi, sysdir_path |
53 | 54 | ||
Line 124... | Line 125... | ||
124 | mov dword [eax+252], 0 |
125 | mov dword [eax+252], 0 |
125 | stdcall strncpy, eax, ebx, 255 |
126 | stdcall strncpy, eax, ebx, 255 |
126 | @@: |
127 | @@: |
127 | lea eax, [filename] |
128 | lea eax, [filename] |
128 | stdcall load_file, eax |
129 | stdcall load_file, eax |
129 | mov ecx, -ERROR_FILE_NOT_FOUND |
130 | mov esi, -ERROR_FILE_NOT_FOUND |
130 | test eax, eax |
131 | test eax, eax |
131 | jz .err_file |
132 | jz .err_file |
Line 132... | Line 133... | ||
132 | 133 | ||
133 | mov [file_base], eax |
134 | mov [file_base], eax |
Line 134... | Line 135... | ||
134 | mov [file_size], ebx |
135 | mov [file_size], ebx |
135 | 136 | ||
136 | lea ebx, [hdr_cmdline] |
137 | lea ebx, [hdr_cmdline] |
137 | call test_app_header |
138 | call test_app_header |
138 | mov ecx, -0x1F |
139 | mov esi, -0x1F |
Line 139... | Line -... | ||
139 | test eax, eax |
- | |
140 | jz .err_hdr |
- | |
141 | - | ||
142 | ;mov esi, new_process_loading |
140 | test eax, eax |
143 | ;call sys_msg_board_str ; write message to message board |
141 | jz .err_hdr |
144 | 142 | ||
145 | .wait_lock: |
143 | .wait_lock: |
146 | cmp [application_table_status],0 |
144 | cmp [application_table_status], 0 |
Line 156... | Line 154... | ||
156 | 154 | ||
Line 157... | Line 155... | ||
157 | call set_application_table_status |
155 | call set_application_table_status |
158 | 156 | ||
159 | call get_new_process_place |
157 | call get_new_process_place |
160 | test eax, eax |
158 | test eax, eax |
Line 161... | Line 159... | ||
161 | mov ecx, -0x20 ; too many processes |
159 | mov esi, -0x20 ; too many processes |
162 | jz .err |
160 | jz .err |
163 | 161 | ||
Line 191... | Line 189... | ||
191 | 189 | ||
192 | mov ebx, cr3 |
190 | mov ebx, cr3 |
Line 193... | Line 191... | ||
193 | mov [save_cr3], ebx |
191 | mov [save_cr3], ebx |
194 | 192 | ||
195 | stdcall create_app_space,[hdr_mem],[file_base],[file_size] |
193 | stdcall create_app_space, [hdr_mem], [file_base], [file_size] |
196 | mov ecx, -30 ; no memory |
194 | mov esi, -30; no memory |
Line 197... | Line 195... | ||
197 | test eax, eax |
195 | test eax, eax |
198 | jz .failed |
196 | jz .failed |
Line 247... | Line 245... | ||
247 | .err_hdr: |
245 | .err_hdr: |
248 | stdcall kernel_free,[file_base] |
246 | stdcall kernel_free, [file_base] |
249 | .err_file: |
247 | .err_file: |
250 | xor eax, eax |
248 | xor eax, eax |
251 | mov [application_table_status],eax |
249 | mov [application_table_status], eax |
252 | mov eax, ecx |
250 | mov eax, esi |
253 | ret |
251 | ret |
254 | endp |
252 | endp |
Line 255... | Line 253... | ||
255 | 253 | ||
256 | align 4 |
254 | align 4 |
Line 357... | Line 355... | ||
357 | img_pages dd ? |
355 | img_pages dd ? |
358 | dir_addr dd ? |
356 | dir_addr dd ? |
359 | app_tabs dd ? |
357 | app_tabs dd ? |
360 | endl |
358 | endl |
Line 361... | Line 359... | ||
361 | 359 | ||
362 | mov ebx, pg_data.pg_mutex |
360 | mov ecx, pg_data.mutex |
Line 363... | Line 361... | ||
363 | call wait_mutex ;ebx |
361 | call mutex_lock |
364 | 362 | ||
Line 365... | Line 363... | ||
365 | xor eax, eax |
363 | xor eax, eax |
Line 477... | Line 475... | ||
477 | end if |
475 | end if |
Line 478... | Line 476... | ||
478 | 476 | ||
479 | .done: |
477 | .done: |
Line 480... | Line 478... | ||
480 | stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP |
478 | stdcall map_page, [tmp_task_pdir], dword 0, dword PG_UNMAP |
- | 479 | ||
481 | 480 | mov ecx, pg_data.mutex |
|
482 | dec [pg_data.pg_mutex] |
481 | call mutex_unlock |
483 | mov eax, [dir_addr] |
482 | mov eax, [dir_addr] |
484 | ret |
483 | ret |
- | 484 | .fail: |
|
485 | .fail: |
485 | mov ecx, pg_data.mutex |
486 | dec [pg_data.pg_mutex] |
486 | call mutex_unlock |
487 | cmp [dir_addr], 0 |
487 | cmp [dir_addr], 0 |
488 | je @f |
488 | je @f |
489 | stdcall destroy_app_space, [dir_addr], 0 |
489 | stdcall destroy_app_space, [dir_addr], 0 |
Line 551... | Line 551... | ||
551 | pop ecx |
551 | pop ecx |
552 | cmp edx,1 |
552 | cmp edx, 1 |
553 | jg .ret |
553 | jg .ret |
554 | ;if there isn't threads then clear memory. |
554 | ;if there isn't threads then clear memory. |
555 | mov esi, [dlls_list] |
555 | mov esi, [dlls_list] |
556 | call destroy_all_hdlls |
556 | call destroy_all_hdlls;ecx=APPDATA |
Line 557... | Line 557... | ||
557 | 557 | ||
558 | mov ebx, pg_data.pg_mutex |
558 | mov ecx, pg_data.mutex |
Line 559... | Line 559... | ||
559 | call wait_mutex ;ebx |
559 | call mutex_lock |
560 | 560 | ||
561 | mov eax, [pg_dir] |
561 | mov eax, [pg_dir] |
562 | and eax, not 0xFFF |
562 | and eax, not 0xFFF |
Line 580... | Line 580... | ||
580 | mov eax, [pg_dir] |
580 | mov eax, [pg_dir] |
581 | call free_page |
581 | call free_page |
582 | .exit: |
582 | .exit: |
583 | stdcall map_page,[tmp_task_ptab],0,PG_UNMAP |
583 | stdcall map_page, [tmp_task_ptab], 0, PG_UNMAP |
584 | stdcall map_page,[tmp_task_pdir],0,PG_UNMAP |
584 | stdcall map_page, [tmp_task_pdir], 0, PG_UNMAP |
585 | dec [pg_data.pg_mutex] |
585 | mov ecx, pg_data.mutex |
- | 586 | call mutex_unlock |
|
586 | .ret: |
587 | .ret: |
587 | ret |
588 | ret |
588 | endp |
589 | endp |
Line 589... | Line 590... | ||
589 | 590 | ||
Line 953... | Line 954... | ||
953 | mov [application_table_status],eax |
954 | mov [application_table_status], eax |
954 | dec eax ;-1 |
955 | dec eax ;-1 |
955 | ret |
956 | ret |
956 | endp |
957 | endp |
Line 957... | Line -... | ||
957 | - | ||
958 | ; param |
- | |
959 | ; ebx=mutex |
- | |
960 | - | ||
961 | align 4 |
- | |
962 | wait_mutex: |
- | |
963 | ;;Maxis use atomic bts for mutex 4.4.2009 |
- | |
964 | push eax |
- | |
965 | push ebx |
- | |
966 | .do_wait: |
- | |
967 | bts dword [ebx],0 |
- | |
968 | jnc .locked |
- | |
969 | call change_task |
- | |
970 | jmp .do_wait |
- | |
971 | .locked: |
- | |
972 | pop ebx |
- | |
973 | pop eax |
- | |
974 | ret |
- | |
975 | 958 | ||
976 | align 4 |
959 | align 4 |
Line 977... | Line 960... | ||
977 | tls_app_entry: |
960 | tls_app_entry: |
978 | 961 | ||
Line 1164... | Line 1147... | ||
1164 | ;mov esi,new_process_running |
1147 | ;mov esi,new_process_running |
1165 | ;call sys_msg_board_str ;output information about succefull startup |
1148 | ;call sys_msg_board_str ;output information about succefull startup |
1166 | ret |
1149 | ret |
1167 | endp |
1150 | endp |
Line -... | Line 1151... | ||
- | 1151 | ||
- | 1152 | ||
- | 1153 | align 4 |
|
- | 1154 | ||
- | 1155 | get_stack_base: |
|
- | 1156 | mov eax, [current_slot] |
|
- | 1157 | mov eax, [eax+APPDATA.pl0_stack] |
|
- | 1158 | ret |
|
- | 1159 | ||
1168 | 1160 |