Subversion Repositories Kolibri OS

Rev

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

Rev 837 Rev 839
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: 837 $
8
$Revision: 839 $
Line 9... Line 9...
9
 
9
 
Line 136... Line 136...
136
	   call test_app_header
136
	   call test_app_header
137
	   mov ecx, -0x1F
137
	   mov ecx, -0x1F
138
	   test eax, eax
138
	   test eax, eax
139
	   jz .err_hdr
139
	   jz .err_hdr
Line 140... Line -...
140
 
-
 
141
	   ;mov esi, new_process_loading
-
 
142
	   ;call sys_msg_board_str       ; write message to message board
140
 
Line 143... Line 141...
143
	   DEBUGF 1,"%s",new_process_loading
141
	   DEBUGF 1,"%s",new_process_loading
144
 
142
 
145
.wait_lock:
143
.wait_lock:
Line 187... Line 185...
187
	   jz .copy_process_name_done
185
	   jz .copy_process_name_done
188
	   stosb
186
	   stosb
189
	   loop .copy_process_name_loop
187
	   loop .copy_process_name_loop
190
.copy_process_name_done:
188
.copy_process_name_done:
Line -... Line 189...
-
 
189
 
191
 
190
 
192
	   mov ebx, cr3
191
	   mov ebx, cr3
Line 193... Line 192...
193
	   mov [save_cr3], ebx
192
	   mov [save_cr3], ebx
194
 
193
 
Line 386... Line 385...
386
 
385
 
387
	   call alloc_page
386
	   call alloc_page
388
	   test eax, eax
387
	   test eax, eax
389
	   jz .fail
388
	   jz .fail
390
	   mov [dir_addr], eax
-
 
Line 391... Line 389...
391
	   stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
389
	   mov [dir_addr], eax
392
 
390
 
393
	   mov edi, [tmp_task_pdir]
391
           lea edi, [eax + OS_BASE]
394
	   mov ecx, (OS_BASE shr 20)/4
392
           mov ecx, (OS_BASE shr 20)/4
395
	   xor eax, eax
393
	   xor eax, eax
Line 396... Line 394...
396
	   cld
394
	   cld
397
	   rep stosd
395
	   rep stosd
398
 
396
 
Line 399... Line 397...
399
           mov ecx, 1024-(OS_BASE shr 20)/4
397
           mov ecx, 1024-(OS_BASE shr 20)/4
400
	   mov esi, sys_pgdir+(OS_BASE shr 20)
398
	   mov esi, sys_pgdir+(OS_BASE shr 20)
401
	   rep movsd
399
	   rep movsd
Line 402... Line 400...
402
 
400
 
403
	   mov eax, [dir_addr]
401
           mov edi, [dir_addr]
Line 404... Line 402...
404
	   or eax, PG_SW
402
           lea eax, [edi+PG_SW]
405
	   mov [edi-4096+(page_tabs shr 20)], eax
403
           mov [edi+OS_BASE+(page_tabs shr 20)], eax
406
 
404
 
407
	   and eax, -4096
405
           and eax, -4096
408
	   call set_cr3
406
	   call set_cr3
409
 
407
 
Line 410... Line 408...
410
	   mov edx, [app_tabs]
408
	   mov edx, [app_tabs]
411
	   mov edi, new_app_base
409
           xor edi, edi
412
@@:
410
@@:
413
	   call alloc_page
411
	   call alloc_page
Line 414... Line -...
414
	   test eax, eax
-
 
415
	   jz .fail
-
 
416
 
412
	   test eax, eax
Line 417... Line 413...
417
	   stdcall map_page_table, edi, eax
413
	   jz .fail
418
	   add edi, 0x00400000
414
 
419
	   dec edx
415
	   stdcall map_page_table, edi, eax
420
	   jnz @B
416
	   add edi, 0x00400000
Line 421... Line 417...
421
 
417
	   dec edx
422
	   mov edi, new_app_base
418
	   jnz @B
423
	   shr edi, 10
-
 
424
	   add edi, page_tabs
419
 
425
 
-
 
426
	   mov ecx, [app_tabs]
420
           mov edi, page_tabs
427
	   shl ecx, 10
-
 
428
	   xor eax, eax
421
 
-
 
422
	   mov ecx, [app_tabs]
429
	   rep stosd
423
	   shl ecx, 10
430
 
424
	   xor eax, eax
431
	   mov ecx, [img_pages]
425
	   rep stosd
432
	   mov ebx, PG_UW
426
 
433
	   mov edx, new_app_base
427
	   mov ecx, [img_pages]
434
	   mov esi, [img_base]
428
	   mov ebx, PG_UW
Line 465... Line 459...
465
	   dec [app_pages]
459
	   dec [app_pages]
466
	   jnz .alloc
460
	   jnz .alloc
467
end if
461
end if
Line 468... Line 462...
468
 
462
 
469
.done:
-
 
470
	   stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP
-
 
471
 
463
.done:
472
	   dec [pg_data.pg_mutex]
464
           dec [pg_data.pg_mutex]
473
	   mov eax, [dir_addr]
465
	   mov eax, [dir_addr]
474
	   ret
466
	   ret
475
.fail:
467
.fail:
Line 541... Line 533...
541
	   cmp	 edx,1
533
	   cmp	 edx,1
542
	   jg	 .exit
534
	   jg	 .exit
543
;if there isn't threads then clear memory.
535
;if there isn't threads then clear memory.
Line 544... Line 536...
544
 
536
 
545
	   mov eax, [pg_dir]
537
	   mov eax, [pg_dir]
-
 
538
           and eax, -4096
546
	   and eax, not 0xFFF
539
           add eax, OS_BASE
547
	   stdcall map_page,[tmp_task_pdir],eax,dword PG_SW
540
           mov [tmp_task_pdir], eax
548
	   mov esi, [tmp_task_pdir]
541
           mov esi, eax
549
	   mov edi, (OS_BASE shr 20)/4
542
           mov edi, (HEAP_BASE shr 20)/4
550
.destroy:
543
.destroy:
551
	   mov eax, [esi]
544
	   mov eax, [esi]
552
	   test eax, 1
545
	   test eax, 1
553
	   jz .next
546
	   jz .next
554
	   and eax, not 0xFFF
547
	   and eax, not 0xFFF
-
 
548
           add eax, OS_BASE
555
	   stdcall map_page,[tmp_task_ptab],eax,dword PG_SW
549
 
-
 
550
           stdcall destroy_page_table, eax
556
	   stdcall destroy_page_table, [tmp_task_ptab]
551
 
557
	   mov eax, [esi]
552
           mov eax, [esi]
558
	   call free_page
553
	   call free_page
559
.next:
554
.next:
560
	   add esi, 4
555
	   add esi, 4
561
	   dec edi
556
	   dec edi
Line 562... Line 557...
562
	   jnz .destroy
557
	   jnz .destroy
563
 
558
 
564
	   mov eax, [pg_dir]
559
	   mov eax, [pg_dir]
565
	   call free_page
-
 
566
.exit:
-
 
567
	   stdcall map_page,[tmp_task_ptab],dword 0,dword PG_UNMAP
560
	   call free_page
568
	   stdcall map_page,[tmp_task_pdir],dword 0,dword PG_UNMAP
561
.exit:
569
	   dec [pg_data.pg_mutex]
562
	   dec [pg_data.pg_mutex]
Line 570... Line 563...
570
	   ret
563
	   ret
Line 949... Line 942...
949
 
942
 
950
	   locals
943
	   locals
951
	     pl0_stack dd ?
944
	     pl0_stack dd ?
Line 952... Line 945...
952
	   endl
945
	   endl
-
 
946
 
953
 
947
           stdcall alloc_pages, (RING0_STACK_SIZE+512) shr 12
Line 954... Line 948...
954
	   stdcall kernel_alloc, RING0_STACK_SIZE+512
948
           add eax, OS_BASE
Line 955... Line 949...
955
	   mov [pl0_stack], eax
949
	   mov [pl0_stack], eax
Line 992... Line 986...
992
	   mov eax, [pl0_stack]
986
	   mov eax, [pl0_stack]
993
	   mov [SLOT_BASE+APPDATA.pl0_stack+ebx],eax
987
	   mov [SLOT_BASE+APPDATA.pl0_stack+ebx],eax
994
	   add eax, RING0_STACK_SIZE
988
	   add eax, RING0_STACK_SIZE
995
	   mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax
989
	   mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax
Line 996... Line -...
996
 
-
 
997
	   push ebx
990
 
998
	   stdcall kernel_alloc, 0x1000
991
           call alloc_page
999
	   pop ebx
992
           add eax, OS_BASE
1000
	   mov esi,[current_slot]
993
	   mov esi,[current_slot]
1001
	   mov esi,[esi+APPDATA.cur_dir]
994
	   mov esi,[esi+APPDATA.cur_dir]
1002
	   mov ecx,0x1000/4
995
	   mov ecx,0x1000/4
1003
	   mov edi,eax
996
	   mov edi,eax