Rev 897 | Rev 914 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 897 | Rev 908 | ||
---|---|---|---|
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: 897 $ |
8 | $Revision: 908 $ |
9 | 9 | ||
10 | EFL_IF equ 0x0200 |
10 | EFL_IF equ 0x0200 |
11 | EFL_IOPL1 equ 0x1000 |
11 | EFL_IOPL1 equ 0x1000 |
Line 108... | Line 108... | ||
108 | ret |
108 | ret |
109 | .fail: |
109 | .fail: |
110 | xor eax, eax |
110 | xor eax, eax |
111 | ret |
111 | ret |
Line 112... | Line 112... | ||
112 | 112 | ||
113 | 113 | align 4 |
|
114 | proc mnt_exec stdcall file_base:dword, file_size:dword, \ |
114 | proc mnt_exec stdcall file_base:dword, file_size:dword, \ |
Line 115... | Line 115... | ||
115 | path:dword, cmd_line:dword, flags:dword |
115 | path:dword, cmd_line:dword, flags:dword |
116 | 116 | ||
Line 278... | Line 278... | ||
278 | mov eax, ecx |
278 | mov eax, ecx |
279 | ret |
279 | ret |
280 | endp |
280 | endp |
Line 281... | Line 281... | ||
281 | 281 | ||
282 | align 4 |
282 | align 4 |
Line 283... | Line 283... | ||
283 | proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack_page:dword |
283 | proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword |
284 | 284 | ||
285 | locals |
285 | locals |
- | 286 | slot dd ? |
|
286 | slot dd ? |
287 | slot_base dd ? |
Line 287... | Line 288... | ||
287 | slot_base dd ? |
288 | pl0_stack dd ? |
288 | endl |
289 | endl |
289 | 290 | ||
Line 307... | Line 308... | ||
307 | mov [slot_base], eax |
308 | mov [slot_base], eax |
308 | mov edi, eax |
309 | mov edi, eax |
309 | _clear_ 256 ;clean extended information about process |
310 | _clear_ 256 ;clean extended information about process |
Line 310... | Line 311... | ||
310 | 311 | ||
311 | ; write application name |
- | |
312 | lea eax, [path] |
312 | ; write application name |
313 | stdcall strrchr, eax, '/' ; now eax points to name without path |
313 | stdcall strrchr, [path], '/' ; now eax points to name without path |
314 | lea esi, [eax+1] |
314 | lea esi, [eax+1] |
315 | test eax, eax |
315 | test eax, eax |
316 | jnz @F |
316 | jnz @F |
317 | lea esi, [path] |
317 | lea esi, [path] |
Line 333... | Line 333... | ||
333 | mov [ebx+APPDATA.dir_table],eax |
333 | mov [ebx+APPDATA.dir_table],eax |
Line 334... | Line 334... | ||
334 | 334 | ||
335 | ;mov eax,[hdr_mem] |
335 | ;mov eax,[hdr_mem] |
Line -... | Line 336... | ||
- | 336 | ;mov [ebx+APPDATA.mem_size],eax |
|
- | 337 | ||
- | 338 | ||
336 | ;mov [ebx+APPDATA.mem_size],eax |
339 | mov ecx, 1 |
- | 340 | call @core_alloc@4 |
|
Line 337... | Line 341... | ||
337 | 341 | lea edi, [eax+OS_BASE] |
|
338 | lea edi, [eax+OS_BASE+8192] |
342 | mov [pl0_stack], edi |
339 | 343 | ||
340 | mov [ebx+APPDATA.pl0_stack], edi |
344 | mov [ebx+APPDATA.pl0_stack], edi |
Line 370... | Line 374... | ||
370 | mov ecx, [def_cursor] |
374 | mov ecx, [def_cursor] |
371 | mov [ebx+APPDATA.cursor],ecx |
375 | mov [ebx+APPDATA.cursor],ecx |
Line 372... | Line 376... | ||
372 | 376 | ||
373 | xor ecx, ecx |
377 | xor ecx, ecx |
- | 378 | call @core_alloc@4 |
|
Line 374... | Line -... | ||
374 | call @core_alloc@4 |
- | |
375 | 379 | lea edi, [eax+OS_BASE] ; FIXME |
|
376 | add eax, OS_BASE ;FIXME |
380 | |
377 | mov esi,[current_slot] |
381 | mov esi,[current_slot] |
378 | mov esi,[esi+APPDATA.cur_dir] |
- | |
379 | mov ecx,0x1000/4 |
382 | mov esi,[esi+APPDATA.cur_dir] |
380 | mov edi,eax |
383 | mov ecx,0x1000/4 |
Line 381... | Line 384... | ||
381 | mov [ebx+APPDATA.cur_dir],eax |
384 | mov [ebx+APPDATA.cur_dir],edi |
382 | rep movsd |
385 | rep movsd |
383 | 386 | ||
Line 407... | Line 410... | ||
407 | mov eax,[Screen_Max_X] |
410 | mov eax,[Screen_Max_X] |
408 | mov [ecx+8],eax |
411 | mov [ecx+8],eax |
409 | mov eax,[Screen_Max_Y] |
412 | mov eax,[Screen_Max_Y] |
410 | mov [ecx+12],eax |
413 | mov [ecx+12],eax |
Line 411... | Line 414... | ||
411 | 414 | ||
412 | mov ebx, [ex_pg_dir] |
- | |
Line 413... | Line -... | ||
413 | add ebx, OS_BASE+8192-16 |
- | |
414 | 415 | mov ebx, [pl0_stack] |
|
- | 416 | ||
415 | mov [ebx], dword _sys_app_entry |
417 | mov eax, [raw] |
- | 418 | lea ecx, [ebx+REG_EDI] |
|
- | 419 | mov edx, [ex_stack] |
|
- | 420 | ||
416 | mov eax, [raw] |
421 | mov [ebx+REG_ENTRY], dword _sys_app_entry |
- | 422 | mov [ebx+REG_RESTART], dword _pe_restart |
|
417 | mov edx, [ex_stack_page] |
423 | mov [ebx+REG_RAW], eax |
- | 424 | mov [ebx+REG_CSTACK], ecx |
|
- | 425 | mov [ebx+REG_USTACK], edx |
|
Line 418... | Line 426... | ||
418 | mov [ebx+8], eax |
426 | |
419 | mov [ebx+12], edx |
427 | lea ebx, [ebx+REG_ENTRY] |
420 | 428 | ||
421 | mov ecx, [slot] |
- | |
422 | shl ecx, 5 |
429 | mov ecx, [slot] |
Line 423... | Line 430... | ||
423 | mov [ecx*8+SLOT_BASE+APPDATA.saved_esp], ebx |
430 | shl ecx, 5 |
424 | xor ebx, ebx ; process state - running |
431 | mov [ecx*8+SLOT_BASE+APPDATA.saved_esp], ebx |
425 | mov [CURRENT_TASK+ecx+TASKDATA.state], bl |
432 | mov [CURRENT_TASK+ecx+TASKDATA.state], 0 |
426 | 433 | ||
Line 427... | Line 434... | ||
427 | ; DEBUGF 1,"%s",new_process_running |
434 | DEBUGF 1,"%s",new_process_running |
Line 434... | Line 441... | ||
434 | pop ebx |
441 | pop ebx |
Line 435... | Line 442... | ||
435 | 442 | ||
436 | ret |
443 | ret |
Line -... | Line 444... | ||
- | 444 | endp |
|
- | 445 | ||
- | 446 | align 4 |
|
- | 447 | _pe_restart: |
|
- | 448 | xchg bx, bx |
|
- | 449 | add esp, 12 |
|
- | 450 | popad |
|
Line 437... | Line 451... | ||
437 | endp |
451 | iretd |
438 | 452 | ||
439 | 453 | ||
440 | align 4 |
454 | align 4 |
Line 588... | Line 602... | ||
588 | @@: |
602 | @@: |
589 | xor eax, eax |
603 | xor eax, eax |
590 | ret |
604 | ret |
591 | endp |
605 | endp |
Line -... | Line 606... | ||
- | 606 | ||
592 | 607 | ;addr_t __fastcall pe_app_space(size_t size); |
|
593 | align 4 |
608 | align 4 |
- | 609 | @pe_app_space@4: |
|
- | 610 | sub esp, 16 |
|
- | 611 | ||
- | 612 | mov [esp+4], ebx |
|
- | 613 | mov [esp+8], esi |
|
- | 614 | mov [esp+12], edi |
|
- | 615 | ||
- | 616 | lea ebx, [ecx+0x3FFFFF] |
|
594 | _new_app_space: |
617 | |
595 | mov ecx, 2 |
618 | xor ecx, ecx |
596 | call @core_alloc@4 |
619 | call @core_alloc@4 |
- | 620 | test eax, eax |
|
597 | test eax, eax |
621 | mov [esp], eax |
Line 598... | Line -... | ||
598 | jz .fail |
- | |
599 | - | ||
600 | push esi |
- | |
601 | push edi |
- | |
602 | 622 | jz .fail |
|
603 | mov edx, eax |
623 | |
604 | mov ecx, 512 |
624 | mov ecx, 512 |
605 | lea edi, [eax + OS_BASE] |
625 | lea edi, [eax + OS_BASE] |
606 | xor eax, eax |
626 | xor eax, eax |
Line 607... | Line 627... | ||
607 | cld |
627 | cld |
608 | rep stosd |
628 | rep stosd |
609 | 629 | ||
Line -... | Line 630... | ||
- | 630 | mov ecx, 512 |
|
- | 631 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
|
- | 632 | rep movsd |
|
- | 633 | ||
- | 634 | mov esi, [esp] |
|
- | 635 | shr ebx, 22 |
|
- | 636 | .new_ptab: |
|
- | 637 | xor ecx, ecx |
|
610 | mov ecx, 512 |
638 | call @core_alloc@4 |
- | 639 | test eax, eax |
|
611 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
640 | jz .fail |
Line 612... | Line 641... | ||
612 | rep movsd |
641 | |
613 | 642 | lea edi, [eax+OS_BASE] |
|
- | 643 | or eax, PG_UW |
|
- | 644 | mov [esi+OS_BASE], eax |
|
- | 645 | ||
- | 646 | mov ecx, 1024 |
|
- | 647 | xor eax, eax |
|
Line -... | Line 648... | ||
- | 648 | rep stosd |
|
- | 649 | ||
- | 650 | add esi, 4 |
|
- | 651 | dec ebx |
|
- | 652 | jnz .new_ptab |
|
614 | lea eax, [edx+PG_SW] |
653 | |
- | 654 | xor ecx, ecx |
|
- | 655 | call @core_alloc@4 |
|
- | 656 | test eax, eax |
|
- | 657 | jz .fail |
|
- | 658 | ||
- | 659 | lea edi, [eax+OS_BASE] |
|
- | 660 | or eax, PG_UW |
|
615 | mov [edx+OS_BASE+(page_tabs shr 20)], eax |
661 | |
616 | 662 | mov ebx, [esp] |
|
617 | add eax, 4096 |
663 | lea edx, [ebx+PG_SW] |
Line 618... | Line 664... | ||
618 | mov [edx+OS_BASE+0x7FC], eax |
664 | mov [ebx+OS_BASE+(0x7FC00000 shr 20)], eax |
619 | 665 | mov [ebx+OS_BASE+(page_tabs shr 20)], edx |
|
- | 666 | ||
- | 667 | mov ecx, 1024 |
|
620 | lea edi, [edx+OS_BASE+8192] |
668 | xor eax, eax |
- | 669 | rep stosd |
|
621 | mov ecx, 2048 |
670 | |
622 | xor eax, eax |
671 | mov eax, ebx |
Line 623... | Line 672... | ||
623 | rep stosd |
672 | .fail: |
624 | 673 | mov ebx, [esp+4] |