Rev 4423 | Rev 5565 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4423 | Rev 5201 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2012. 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: 4423 $ |
8 | $Revision: 5201 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 68... | Line 68... | ||
68 | cmdline_flag dd ? ; +8 ; cmdline -4 |
68 | cmdline_flag dd ? ; +8 ; cmdline -4 |
69 | cmdline rd 64 ;256/4 |
69 | cmdline rd 64 ;256/4 |
70 | filename rd 256 ;1024/4 |
70 | filename rd 256 ;1024/4 |
71 | flags dd ? |
71 | flags dd ? |
Line 72... | Line 72... | ||
72 | 72 | ||
73 | save_cr3 dd ? |
73 | save_proc dd ? |
74 | slot dd ? |
74 | slot dd ? |
75 | slot_base dd ? |
75 | slot_base dd ? |
76 | file_base dd ? |
76 | file_base dd ? |
77 | file_size dd ? |
77 | file_size dd ? |
Line 213... | Line 213... | ||
213 | test eax, eax |
213 | test eax, eax |
214 | jz .err_hdr |
214 | jz .err_hdr |
Line 215... | Line 215... | ||
215 | 215 | ||
Line 216... | Line 216... | ||
216 | call lock_application_table |
216 | call lock_application_table |
217 | 217 | ||
218 | call get_new_process_place |
218 | call alloc_thread_slot |
219 | test eax, eax |
219 | test eax, eax |
Line 220... | Line 220... | ||
220 | mov esi, -0x20 ; too many processes |
220 | mov esi, -0x20 ; too many processes |
Line 246... | Line 246... | ||
246 | jz .copy_process_name_done |
246 | jz .copy_process_name_done |
247 | stosb |
247 | stosb |
248 | loop .copy_process_name_loop |
248 | loop .copy_process_name_loop |
249 | .copy_process_name_done: |
249 | .copy_process_name_done: |
Line 250... | Line 250... | ||
250 | 250 | ||
251 | mov ebx, cr3 |
251 | mov ebx, [current_process] |
Line 252... | Line 252... | ||
252 | mov [save_cr3], ebx |
252 | mov [save_proc], ebx |
253 | 253 | ||
254 | stdcall create_app_space, [hdr_mem], [file_base], [file_size] |
254 | stdcall create_process, [hdr_mem], [file_base], [file_size] |
255 | mov esi, -30; no memory |
255 | mov esi, -30; no memory |
Line -... | Line 256... | ||
- | 256 | test eax, eax |
|
- | 257 | jz .failed |
|
- | 258 | ||
256 | test eax, eax |
259 | mov ebx, [hdr_mem] |
257 | jz .failed |
260 | mov [eax+PROC.mem_used], ebx |
- | 261 | ||
258 | 262 | mov ebx, [slot_base] |
|
259 | mov ebx, [slot_base] |
263 | mov [ebx+APPDATA.process], eax |
- | 264 | ||
Line 260... | Line 265... | ||
260 | mov [ebx+APPDATA.dir_table], eax |
265 | lea edx, [ebx+APPDATA.list] |
261 | mov eax, [hdr_mem] |
266 | lea ecx, [eax+PROC.thr_list] |
262 | mov [ebx+APPDATA.mem_size], eax |
267 | list_add_tail edx, ecx |
Line 290... | Line 295... | ||
290 | lea eax, [hdr_cmdline] |
295 | lea eax, [hdr_cmdline] |
291 | lea ebx, [cmdline] |
296 | lea ebx, [cmdline] |
292 | lea ecx, [filename] |
297 | lea ecx, [filename] |
293 | stdcall set_app_params , [slot], eax, ebx, ecx, [flags] |
298 | stdcall set_app_params , [slot], eax, ebx, ecx, [flags] |
Line 294... | Line 299... | ||
294 | 299 | ||
295 | mov eax, [save_cr3] |
300 | mov eax, [save_proc] |
Line 296... | Line 301... | ||
296 | call set_cr3 |
301 | call set_cr3 |
297 | 302 | ||
Line 298... | Line 303... | ||
298 | mov eax, [process_number];set result |
303 | mov eax, [process_number];set result |
Line 299... | Line 304... | ||
299 | call unlock_application_table |
304 | call unlock_application_table |
300 | 305 | ||
301 | jmp .final |
306 | jmp .final |
302 | 307 | ||
303 | .failed: |
308 | .failed: |
304 | mov eax, [save_cr3] |
309 | mov eax, [save_proc] |
305 | call set_cr3 |
310 | call set_cr3 |
Line 383... | Line 388... | ||
383 | .fail: |
388 | .fail: |
384 | xor eax, eax |
389 | xor eax, eax |
385 | ret |
390 | ret |
Line 386... | Line 391... | ||
386 | 391 | ||
387 | align 4 |
392 | align 4 |
388 | proc get_new_process_place |
393 | alloc_thread_slot: |
389 | ;input: |
394 | ;input: |
390 | ; none |
395 | ; none |
391 | ;result: |
396 | ;result: |
392 | ; eax=[new_process_place]<>0 - ok |
397 | ; eax=[new_thread_slot]<>0 - ok |
393 | ; 0 - failed. |
398 | ; 0 - failed. |
394 | ;This function find least empty slot. |
399 | ;This function find least empty slot. |
395 | ;It doesn't increase [TASK_COUNT]! |
- | |
- | 400 | ;It doesn't increase [TASK_COUNT]! |
|
- | 401 | ||
396 | mov eax, CURRENT_TASK |
402 | |
397 | mov ebx, [TASK_COUNT] |
403 | mov edx, thr_slot_map |
398 | inc ebx |
404 | pushfd |
399 | shl ebx, 5 |
- | |
400 | add ebx, eax ;ebx - address of process information for (last+1) slot |
405 | cli |
401 | .newprocessplace: |
- | |
402 | ;eax = address of process information for current slot |
406 | .l1: |
403 | cmp eax, ebx |
- | |
404 | jz .endnewprocessplace ;empty slot after high boundary |
407 | bsf eax, [edx] |
405 | add eax, 0x20 |
- | |
406 | cmp word [eax+0xa], 9;check process state, 9 means that process slot is empty |
- | |
407 | jnz .newprocessplace |
- | |
408 | .endnewprocessplace: |
408 | jnz .found |
409 | mov ebx, eax |
409 | add edx, 4 |
410 | sub eax, CURRENT_TASK |
- | |
411 | shr eax, 5 ;calculate slot index |
410 | cmp edx, thr_slot_map+32 |
412 | cmp eax, 256 |
- | |
413 | jge .failed ;it should be <256 |
- | |
- | 411 | jb .l1 |
|
414 | mov word [ebx+0xa], 9;set process state to 9 (for slot after hight boundary) |
412 | |
415 | ret |
- | |
416 | .failed: |
413 | popfd |
417 | xor eax, eax |
414 | xor eax, eax |
418 | ret |
415 | ret |
- | 416 | .found: |
|
- | 417 | btr [edx], eax |
|
- | 418 | sub edx, thr_slot_map |
|
- | 419 | lea eax, [eax+edx*8] |
|
- | 420 | popfd |
|
- | 421 | ret |
|
Line 419... | Line 422... | ||
419 | endp |
422 | |
420 | 423 | ||
421 | align 4 |
424 | align 4 |
422 | proc create_app_space stdcall, app_size:dword,img_base:dword,img_size:dword |
425 | proc create_process stdcall, app_size:dword,img_base:dword,img_size:dword |
423 | locals |
426 | locals |
424 | app_pages dd ? |
427 | app_pages dd ? |
425 | img_pages dd ? |
428 | img_pages dd ? |
426 | dir_addr dd ? |
429 | process dd ? |
Line -... | Line 430... | ||
- | 430 | app_tabs dd ? |
|
- | 431 | endl |
|
- | 432 | ||
- | 433 | push ebx |
|
427 | app_tabs dd ? |
434 | push esi |
428 | endl |
435 | push edi |
Line 429... | Line 436... | ||
429 | 436 | ||
430 | mov ecx, pg_data.mutex |
437 | mov ecx, pg_data.mutex |
Line 431... | Line 438... | ||
431 | call mutex_lock |
438 | call mutex_lock |
432 | 439 | ||
433 | xor eax, eax |
440 | xor eax, eax |
434 | mov [dir_addr], eax |
441 | mov [process], eax |
Line 452... | Line 459... | ||
452 | 459 | ||
453 | mov [img_size], ecx |
460 | mov [img_size], ecx |
454 | shr ecx, 12 |
461 | shr ecx, 12 |
Line 455... | Line -... | ||
455 | mov [img_pages], ecx |
- | |
456 | - | ||
457 | if GREEDY_KERNEL |
- | |
458 | lea eax, [ecx+ebx+2];only image size |
462 | mov [img_pages], ecx |
459 | else |
463 | |
460 | lea eax, [eax+ebx+2];all requested memory |
464 | lea eax, [eax+ebx+2];all requested memory |
461 | end if |
465 | |
Line 462... | Line 466... | ||
462 | cmp eax, [pg_data.pages_free] |
466 | cmp eax, [pg_data.pages_free] |
463 | ja .fail |
467 | ja .fail |
464 | 468 | ||
465 | call alloc_page |
469 | stdcall kernel_alloc, 0x2000 |
- | 470 | test eax, eax |
|
- | 471 | jz .fail |
|
466 | test eax, eax |
472 | mov [process], eax |
- | 473 | ||
- | 474 | lea edi, [eax+PROC.heap_lock] |
|
- | 475 | mov ecx, (PROC.ht_next-PROC.heap_lock)/4 |
|
- | 476 | ||
Line 467... | Line -... | ||
467 | jz .fail |
- | |
468 | mov [dir_addr], eax |
- | |
469 | stdcall map_page, [tmp_task_pdir], eax, dword PG_SW |
477 | list_init eax |
470 | 478 | add eax, PROC.thr_list |
|
471 | mov edi, [tmp_task_pdir] |
479 | list_init eax |
Line -... | Line 480... | ||
- | 480 | ||
- | 481 | xor eax, eax |
|
- | 482 | cld |
|
- | 483 | rep stosd |
|
- | 484 | ||
- | 485 | mov ecx, (PROC.pdt_0 - PROC.htab)/4 |
|
- | 486 | @@: |
|
- | 487 | stosd |
|
- | 488 | inc eax |
|
- | 489 | cmp eax, ecx |
|
- | 490 | jbe @B |
|
- | 491 | ||
- | 492 | mov [edi-4096+PROC.ht_next], 1 ;reserve handle 0 |
|
- | 493 | mov eax, edi |
|
- | 494 | call get_pg_addr |
|
- | 495 | mov [edi-4096+PROC.pdt_0_phys], eax |
|
472 | mov ecx, (OS_BASE shr 20)/4 |
496 | |
473 | xor eax, eax |
497 | mov ecx, (OS_BASE shr 20)/4 |
474 | cld |
498 | xor eax, eax |
Line 475... | Line 499... | ||
475 | rep stosd |
499 | rep stosd |
476 | 500 | ||
477 | mov ecx, (OS_BASE shr 20)/4 |
501 | mov ecx, (OS_BASE shr 20)/4 |
Line 478... | Line 502... | ||
478 | mov esi, sys_pgdir+(OS_BASE shr 20) |
502 | mov esi, sys_proc+PROC.pdt_0+(OS_BASE shr 20) |
479 | rep movsd |
503 | rep movsd |
Line 480... | Line 504... | ||
480 | 504 | ||
- | 505 | mov eax, [edi-8192+PROC.pdt_0_phys] |
|
- | 506 | or eax, PG_SW |
|
- | 507 | mov [edi-4096+(page_tabs shr 20)], eax |
|
481 | mov eax, [dir_addr] |
508 | |
482 | or eax, PG_SW |
509 | lea eax, [edi-8192] |
483 | mov [edi-4096+(page_tabs shr 20)], eax |
510 | call set_cr3 |
484 | 511 | ||
485 | and eax, -4096 |
512 | mov ecx, [app_tabs] |
Line 486... | Line 513... | ||
486 | call set_cr3 |
513 | test ecx, ecx |
487 | 514 | jz .done |
|
488 | mov edx, [app_tabs] |
- | |
489 | mov edi, new_app_base |
515 | |
Line 490... | Line -... | ||
490 | @@: |
- | |
491 | call alloc_page |
- | |
492 | test eax, eax |
516 | xor edi, edi |
Line 493... | Line 517... | ||
493 | jz .fail |
517 | @@: |
494 | 518 | call alloc_page |
|
495 | stdcall map_page_table, edi, eax |
519 | test eax, eax |
496 | add edi, 0x00400000 |
520 | jz .fail |
Line -... | Line 521... | ||
- | 521 | ||
497 | dec edx |
522 | stdcall map_page_table, edi, eax |
- | 523 | add edi, 0x00400000 |
|
- | 524 | loop @B |
|
- | 525 | ||
- | 526 | mov edi, page_tabs |
|
498 | jnz @B |
527 | |
499 | - | ||
500 | mov edi, new_app_base |
528 | mov ecx, [app_tabs] |
501 | shr edi, 10 |
- | |
502 | add edi, page_tabs |
529 | shl ecx, 10 |
503 | - | ||
504 | mov ecx, [app_tabs] |
530 | xor eax, eax |
505 | shl ecx, 10 |
531 | rep stosd |
506 | xor eax, eax |
532 | |
507 | rep stosd |
533 | xor edx, edx |
508 | 534 | mov ecx, [img_pages] |
|
509 | mov ecx, [img_pages] |
535 | jcxz .bss |
510 | mov ebx, PG_UW |
536 | |
511 | mov edx, new_app_base |
537 | sub [app_pages], ecx |
512 | mov esi, [img_base] |
- | |
513 | mov edi, new_app_base |
- | |
514 | shr esi, 10 |
538 | |
515 | shr edi, 10 |
539 | mov ebx, PG_UW |
516 | add esi, page_tabs |
540 | mov esi, [img_base] |
517 | add edi, page_tabs |
541 | shr esi, 10 |
518 | .remap: |
542 | add esi, page_tabs |
Line 519... | Line -... | ||
519 | lodsd |
- | |
520 | and eax, 0xFFFFF000 |
- | |
521 | or eax, ebx; force user level r/w access |
- | |
522 | stosd |
- | |
523 | add edx, 0x1000 |
- | |
524 | dec [app_pages] |
543 | mov edi, page_tabs |
525 | dec ecx |
544 | .remap: |
526 | jnz .remap |
545 | lodsd |
527 | 546 | and eax, 0xFFFFF000 |
|
Line 528... | Line 547... | ||
528 | mov ecx, [app_pages] |
547 | or eax, ebx; force user level r/w access |
529 | test ecx, ecx |
548 | stosd |
530 | jz .done |
549 | add edx, 0x1000 |
531 | 550 | loop .remap |
|
532 | if GREEDY_KERNEL |
- | |
Line 533... | Line 551... | ||
533 | mov eax, 0x02 |
551 | .bss: |
534 | rep stosd |
- | |
535 | else |
- | |
536 | 552 | mov ebx, [app_pages] |
|
537 | .alloc: |
553 | test ebx, ebx |
538 | call alloc_page |
554 | jz .done |
- | 555 | ||
- | 556 | .map_bss: |
|
- | 557 | call alloc_page |
|
- | 558 | test eax, eax |
|
539 | test eax, eax |
559 | jz .fail |
540 | jz .fail |
560 | |
541 | 561 | stdcall map_page, edx, eax, dword PG_UW |
|
542 | stdcall map_page, edx, eax, dword PG_UW |
562 | add edx, 0x1000 |
543 | add edx, 0x1000 |
563 | dec ebx |
544 | dec [app_pages] |
564 | jnz .map_bss |
545 | jnz .alloc |
565 | |
546 | end if |
566 | .done: |
547 | 567 | mov ecx, pg_data.mutex |
|
- | 568 | call mutex_unlock |
|
- | 569 | mov eax, [process] |
|
- | 570 | ||
548 | .done: |
571 | pop edi |
549 | stdcall map_page, [tmp_task_pdir], dword 0, dword PG_UNMAP |
572 | pop esi |
Line 550... | Line 573... | ||
550 | 573 | pop ebx |
|
551 | mov ecx, pg_data.mutex |
574 | ret |
- | 575 | .fail: |
|
552 | call mutex_unlock |
576 | mov ecx, pg_data.mutex |
553 | mov eax, [dir_addr] |
577 | call mutex_unlock |
- | 578 | cmp [process], 0 |
|
554 | ret |
579 | je @f |
- | 580 | ;; stdcall destroy_app_space, [dir_addr], 0 |
|
555 | .fail: |
581 | @@: |
- | 582 | xor eax, eax |
|
556 | mov ecx, pg_data.mutex |
583 | pop edi |
Line 557... | Line 584... | ||
557 | call mutex_unlock |
584 | pop esi |
558 | cmp [dir_addr], 0 |
585 | pop ebx |
Line 580... | Line 607... | ||
580 | mov ecx, 1024 |
607 | mov ecx, 1024 |
581 | .free: |
608 | .free: |
582 | mov eax, [esi] |
609 | mov eax, [esi] |
583 | test eax, 1 |
610 | test eax, 1 |
584 | jz .next |
611 | jz .next |
- | 612 | test eax, 2 |
|
- | 613 | jz .next |
|
585 | test eax, 1 shl 9 |
614 | test eax, 1 shl 9 |
586 | jnz .next ;skip shared pages |
615 | jnz .next ;skip shared pages |
587 | call free_page |
616 | call free_page |
588 | .next: |
617 | .next: |
589 | add esi, 4 |
618 | add esi, 4 |
Line 592... | Line 621... | ||
592 | pop esi |
621 | pop esi |
593 | ret |
622 | ret |
594 | endp |
623 | endp |
Line 595... | Line 624... | ||
595 | 624 | ||
596 | align 4 |
625 | align 4 |
Line 597... | Line -... | ||
597 | proc destroy_app_space stdcall, pg_dir:dword, dlls_list:dword |
- | |
598 | - | ||
599 | xor edx, edx |
- | |
600 | push edx |
626 | destroy_process: ;fastcall ecx= ptr to process |
601 | mov eax, 0x1 |
- | |
602 | mov ebx, [pg_dir] |
- | |
603 | .loop: |
627 | |
604 | ;eax = current slot of process |
- | |
605 | mov ecx, eax |
- | |
606 | shl ecx, 5 |
- | |
607 | cmp byte [CURRENT_TASK+ecx+0xa], 9;if process running? |
- | |
608 | jz @f ;skip empty slots |
- | |
609 | shl ecx, 3 |
- | |
610 | add ecx, SLOT_BASE |
- | |
611 | cmp [ecx+APPDATA.dir_table], ebx;compare page directory addresses |
- | |
612 | jnz @f |
- | |
613 | mov [ebp-4], ecx |
- | |
614 | inc edx ;thread found |
- | |
615 | @@: |
- | |
616 | inc eax |
628 | lea eax, [ecx+PROC.thr_list] |
Line 617... | Line -... | ||
617 | cmp eax, [TASK_COUNT] ;exit loop if we look through all processes |
- | |
618 | jle .loop |
- | |
619 | 629 | cmp eax, [eax+LHEAD.next] |
|
620 | ;edx = number of threads |
630 | jne .exit |
621 | ;our process is zombi so it isn't counted |
631 | |
622 | pop ecx |
- | |
623 | cmp edx, 1 |
- | |
624 | jg .ret |
- | |
Line 625... | Line 632... | ||
625 | ;if there isn't threads then clear memory. |
632 | align 4 |
626 | mov esi, [dlls_list] |
633 | .internal: |
Line 627... | Line 634... | ||
627 | call destroy_all_hdlls;ecx=APPDATA |
634 | push ecx |
628 | 635 | ||
- | 636 | mov esi, [ecx+PROC.dlls_list_ptr] |
|
629 | mov ecx, pg_data.mutex |
637 | call destroy_all_hdlls |
630 | call mutex_lock |
638 | |
631 | 639 | ; mov ecx, pg_data.mutex |
|
632 | mov eax, [pg_dir] |
640 | ; call mutex_lock |
633 | and eax, not 0xFFF |
641 | |
634 | stdcall map_page, [tmp_task_pdir], eax, PG_SW |
642 | mov esi, [esp] |
635 | mov esi, [tmp_task_pdir] |
643 | add esi, PROC.pdt_0 |
636 | mov edi, (OS_BASE shr 20)/4 |
644 | mov edi, (0x80000000 shr 20)/4 |
Line 646... | Line 654... | ||
646 | .next: |
654 | .next: |
647 | add esi, 4 |
655 | add esi, 4 |
648 | dec edi |
656 | dec edi |
649 | jnz .destroy |
657 | jnz .destroy |
Line 650... | Line -... | ||
650 | - | ||
651 | mov eax, [pg_dir] |
658 | |
652 | call free_page |
- | |
653 | .exit: |
659 | call kernel_free ;ecx still in stack |
654 | stdcall map_page, [tmp_task_ptab], 0, PG_UNMAP |
- | |
655 | stdcall map_page, [tmp_task_pdir], 0, PG_UNMAP |
660 | stdcall map_page, [tmp_task_ptab], 0, PG_UNMAP |
656 | mov ecx, pg_data.mutex |
661 | ; mov ecx, pg_data.mutex |
- | 662 | ; call mutex_unlock |
|
657 | call mutex_unlock |
663 | |
658 | .ret: |
664 | .exit: |
659 | ret |
- | |
Line 660... | Line 665... | ||
660 | endp |
665 | ret |
661 | 666 | ||
662 | align 4 |
667 | align 4 |
663 | get_pid: |
668 | get_pid: |
Line 706... | Line 711... | ||
706 | ; esi - start of buffer |
711 | ; esi - start of buffer |
707 | ; edx - size of buffer |
712 | ; edx - size of buffer |
708 | ;result: |
713 | ;result: |
709 | ; eax = 1 region lays in app memory |
714 | ; eax = 1 region lays in app memory |
710 | ; eax = 0 region don't lays in app memory |
715 | ; eax = 0 region don't lays in app memory |
- | 716 | ||
- | 717 | mov eax, 1 |
|
- | 718 | ret |
|
- | 719 | if 0 |
|
711 | mov eax, [CURRENT_TASK] |
720 | mov eax, [CURRENT_TASK] |
712 | ; jmp check_process_region |
721 | ; jmp check_process_region |
713 | ;----------------------------------------------------------------------------- |
722 | ;----------------------------------------------------------------------------- |
714 | ;check_process_region: |
723 | ;check_process_region: |
715 | ;input: |
724 | ;input: |
Line 730... | Line 739... | ||
730 | test eax, eax |
739 | test eax, eax |
731 | jz .failed |
740 | jz .failed |
Line 732... | Line 741... | ||
732 | 741 | ||
733 | mov eax, 1 |
742 | mov eax, 1 |
734 | ret |
- | |
735 | - | ||
736 | - | ||
737 | ; call MEM_Get_Linear_Address |
- | |
738 | ; push ebx |
- | |
739 | ; push ecx |
- | |
740 | ; push edx |
- | |
741 | ; mov edx,ebx |
- | |
742 | ; and edx,not (4096-1) |
- | |
743 | ; sub ebx,edx |
- | |
744 | ; add ecx,ebx |
- | |
745 | ; mov ebx,edx |
- | |
746 | ; add ecx,(4096-1) |
- | |
747 | ; and ecx,not (4096-1) |
- | |
748 | ;.loop: |
- | |
749 | ;;eax - linear address of page directory |
- | |
750 | ;;ebx - current page |
- | |
751 | ;;ecx - current size |
- | |
752 | ; mov edx,ebx |
- | |
753 | ; shr edx,22 |
- | |
754 | ; mov edx,[eax+4*edx] |
- | |
755 | ; and edx,not (4096-1) |
- | |
756 | ; test edx,edx |
- | |
757 | ; jz .failed1 |
- | |
758 | ; push eax |
- | |
759 | ; mov eax,edx |
- | |
760 | ; call MEM_Get_Linear_Address |
- | |
761 | ; mov edx,ebx |
- | |
762 | ; shr edx,12 |
- | |
763 | ; and edx,(1024-1) |
- | |
764 | ; mov eax,[eax+4*edx] |
- | |
765 | ; and eax,not (4096-1) |
- | |
766 | ; test eax,eax |
- | |
767 | ; pop eax |
- | |
768 | ; jz .failed1 |
- | |
769 | ; add ebx,4096 |
- | |
770 | ; sub ecx,4096 |
- | |
771 | ; jg .loop |
- | |
772 | ; pop edx |
- | |
773 | ; pop ecx |
- | |
774 | ; pop ebx |
743 | ret |
775 | .ok: |
744 | .ok: |
776 | mov eax, 1 |
745 | mov eax, 1 |
777 | ret |
- | |
778 | ; |
- | |
779 | ;.failed1: |
- | |
780 | ; pop edx |
- | |
781 | ; pop ecx |
- | |
782 | ; pop ebx |
746 | ret |
783 | .failed: |
747 | .failed: |
784 | xor eax, eax |
748 | xor eax, eax |
- | 749 | ret |
|
Line 785... | Line 750... | ||
785 | ret |
750 | end if |
786 | 751 | ||
787 | align 4 |
752 | align 4 |
788 | proc read_process_memory |
753 | proc read_process_memory |
Line 952... | Line 917... | ||
952 | mov [app_esp], edx |
917 | mov [app_esp], edx |
953 | mov [app_path], eax |
918 | mov [app_path], eax |
Line 954... | Line 919... | ||
954 | 919 | ||
Line 955... | Line 920... | ||
955 | call lock_application_table |
920 | call lock_application_table |
956 | 921 | ||
957 | call get_new_process_place |
922 | call alloc_thread_slot |
Line 958... | Line 923... | ||
958 | test eax, eax |
923 | test eax, eax |
Line 974... | Line 939... | ||
974 | mov esi, ebx |
939 | mov esi, ebx |
975 | mov edi, edx |
940 | mov edi, edx |
976 | mov ecx, 11 |
941 | mov ecx, 11 |
977 | rep movsb ;copy process name |
942 | rep movsb ;copy process name |
Line 978... | Line 943... | ||
978 | 943 | ||
979 | mov eax, [ebx+APPDATA.heap_base] |
944 | mov eax, [ebx+APPDATA.process] |
Line 980... | Line -... | ||
980 | mov [edx+APPDATA.heap_base], eax |
- | |
981 | - | ||
982 | mov ecx, [ebx+APPDATA.heap_top] |
- | |
983 | mov [edx+APPDATA.heap_top], ecx |
945 | mov [edx+APPDATA.process], eax |
984 | - | ||
985 | mov eax, [ebx+APPDATA.mem_size] |
- | |
986 | mov [edx+APPDATA.mem_size], eax |
946 | |
987 | 947 | lea ebx, [edx+APPDATA.list] |
|
988 | mov ecx, [ebx+APPDATA.dir_table] |
- | |
989 | mov [edx+APPDATA.dir_table], ecx;copy page directory |
- | |
990 | - | ||
Line 991... | Line 948... | ||
991 | mov eax, [ebx+APPDATA.dlls_list_ptr] |
948 | lea ecx, [eax+PROC.thr_list] |
992 | mov [edx+APPDATA.dlls_list_ptr], eax |
949 | list_add_tail ebx, ecx ;add thread to process child's list |
993 | 950 | ||
Line 1116... | Line 1073... | ||
1116 | 1073 | ||
1117 | mov eax, edx |
1074 | mov eax, edx |
1118 | add eax, 256 |
1075 | add eax, 256 |
Line 1119... | Line 1076... | ||
1119 | jc @f |
1076 | jc @f |
1120 | 1077 | ||
Line 1121... | Line 1078... | ||
1121 | cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
1078 | ; cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
Line 1122... | Line 1079... | ||
1122 | ja @f |
1079 | ; ja @f |
1123 | 1080 | ||
Line 1156... | Line 1113... | ||
1156 | test edx, edx |
1113 | test edx, edx |
1157 | jz @F ;application don't need path of file |
1114 | jz @F ;application don't need path of file |
1158 | mov eax, edx |
1115 | mov eax, edx |
1159 | add eax, 1024 |
1116 | add eax, 1024 |
1160 | jc @f |
1117 | jc @f |
1161 | cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
1118 | ; cmp eax, [SLOT_BASE+APPDATA.mem_size+ebx*8] |
1162 | ja @f |
1119 | ; ja @f |
1163 | stdcall strncpy, edx, [app_path], 1024 |
1120 | stdcall strncpy, edx, [app_path], 1024 |
1164 | @@: |
1121 | @@: |
1165 | mov ebx, [slot] |
1122 | mov ebx, [slot] |
1166 | mov eax, ebx |
1123 | mov eax, ebx |
1167 | shl ebx, 5 |
1124 | shl ebx, 5 |
Line 1186... | Line 1143... | ||
1186 | 1143 | ||
1187 | ;set draw data to full screen |
1144 | ;set draw data to full screen |
1188 | xor eax, eax |
1145 | xor eax, eax |
1189 | mov [ecx+0], dword eax |
1146 | mov [ecx+0], dword eax |
1190 | mov [ecx+4], dword eax |
1147 | mov [ecx+4], dword eax |
1191 | mov eax, [_display.width] |
1148 | mov eax, [Screen_Max_X] |
1192 | mov [ecx+8], eax |
1149 | mov [ecx+8], eax |
1193 | mov eax, [_display.height] |
1150 | mov eax, [Screen_Max_Y] |
Line 1194... | Line 1151... | ||
1194 | mov [ecx+12], eax |
1151 | mov [ecx+12], eax |
1195 | 1152 | ||
1196 | mov ebx, [pl0_stack] |
1153 | mov ebx, [pl0_stack] |