Rev 996 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 996 | Rev 1066 | ||
---|---|---|---|
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: 996 $ |
8 | $Revision: 1066 $ |
9 | 9 | ||
10 | EFL_IF equ 0x0200 |
10 | EFL_IF equ 0x0200 |
11 | EFL_IOPL1 equ 0x1000 |
11 | EFL_IOPL1 equ 0x1000 |
Line 220... | Line 220... | ||
220 | test eax, eax |
220 | test eax, eax |
221 | jz .failed |
221 | jz .failed |
Line 222... | Line 222... | ||
222 | 222 | ||
223 | mov ebx,[slot_base] |
223 | mov ebx,[slot_base] |
224 | mov [ebx+APPDATA.dir_table],eax |
- | |
225 | mov eax,[hdr_mem] |
- | |
226 | mov [ebx+APPDATA.mem_size],eax |
- | |
227 | 224 | mov [ebx+APPDATA.dir_table],eax |
|
- | 225 | mov ecx,[hdr_mem] |
|
- | 226 | mov [ebx+APPDATA.mem_size],ecx |
|
228 | mov ecx, [hdr_mem] |
227 | |
229 | mov edi, [file_size] |
228 | mov edi, [file_size] |
230 | ; add edi, 4095 |
229 | ; add edi, 4095 |
231 | ; and edi, not 4095 |
230 | ; and edi, not 4095 |
232 | sub ecx, edi |
231 | sub ecx, edi |
Line 335... | Line 334... | ||
335 | 334 | ||
336 | ;mov eax,[hdr_mem] |
335 | ;mov eax,[hdr_mem] |
Line 337... | Line 336... | ||
337 | ;mov [ebx+APPDATA.mem_size],eax |
336 | ;mov [ebx+APPDATA.mem_size],eax |
338 | 337 | ||
339 | 338 | ||
340 | mov ecx, 1 |
339 | mov ecx, 2 |
Line 341... | Line 340... | ||
341 | call @core_alloc@4 |
340 | call @frame_alloc@4 |
342 | lea edi, [eax+OS_BASE] |
341 | lea edi, [eax+OS_BASE] |
Line 373... | Line 372... | ||
373 | mov [ebx+APPDATA.bk_obj],edx |
372 | mov [ebx+APPDATA.bk_obj],edx |
Line 374... | Line 373... | ||
374 | 373 | ||
375 | mov ecx, [def_cursor] |
374 | mov ecx, [def_cursor] |
Line 376... | Line -... | ||
376 | mov [ebx+APPDATA.cursor],ecx |
- | |
377 | 375 | mov [ebx+APPDATA.cursor],ecx |
|
378 | xor ecx, ecx |
376 | |
Line 379... | Line 377... | ||
379 | call @core_alloc@4 |
377 | call _alloc_page |
380 | lea edi, [eax+OS_BASE] ; FIXME |
378 | lea edi, [eax+OS_BASE] ; FIXME |
381 | 379 | ||
Line 540... | Line 538... | ||
540 | mov ecx, 512 |
538 | mov ecx, 512 |
541 | xor eax, eax |
539 | xor eax, eax |
542 | cld |
540 | cld |
543 | rep stosd |
541 | rep stosd |
Line 544... | Line 542... | ||
544 | 542 | ||
- | 543 | mov esi, [img_base] |
|
- | 544 | ||
545 | mov ecx, 512 |
545 | mov ecx, 512 ; FIX only core tabs |
546 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
546 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
Line 547... | Line 547... | ||
547 | rep movsd |
547 | rep movsd |
548 | 548 | ||
549 | mov edi, [dir_addr] |
549 | mov edi, [dir_addr] |
Line 550... | Line 550... | ||
550 | lea eax, [edi+PG_SW] |
550 | lea eax, [edi+PG_SW] |
551 | mov [edi+OS_BASE+(page_tabs shr 20)], eax |
551 | mov [edi+OS_BASE+(page_tabs shr 20)], eax |
Line -... | Line 552... | ||
- | 552 | ||
- | 553 | mov eax, edi |
|
552 | 554 | call set_cr3 |
|
553 | mov eax, edi |
555 | |
554 | call set_cr3 |
556 | mov esi, [img_base] |
555 | 557 | ||
556 | mov edx, [app_tabs] |
558 | mov ebx, [app_tabs] |
557 | mov edi, master_tab |
559 | mov edi, master_tab |
Line 558... | Line 560... | ||
558 | @@: |
560 | @@: |
559 | call _alloc_page |
561 | call _alloc_page |
560 | test eax, eax |
562 | test eax, eax |
561 | jz .fail |
563 | jz .fail |
Line 562... | Line 564... | ||
562 | 564 | ||
563 | or eax, PG_UW |
565 | or eax, PG_UW |
564 | stosd |
566 | stosd |
565 | dec edx |
567 | dec ebx |
566 | jnz @B |
568 | jnz @B |
Line 567... | Line -... | ||
567 | - | ||
568 | mov edi, page_tabs |
569 | |
569 | mov ecx, [app_tabs] |
570 | mov edi, page_tabs |
570 | shl ecx, 10 |
- | |
571 | xor eax, eax |
571 | mov ecx, [app_tabs] |
572 | rep stosd |
572 | shl ecx, 10 |
573 | 573 | xor eax, eax |
|
Line 574... | Line 574... | ||
574 | mov ecx, [app_pages] |
574 | rep stosd |
575 | xor ebx, ebx |
575 | |
Line 613... | Line 613... | ||
613 | mov [esp+8], esi |
613 | mov [esp+8], esi |
614 | mov [esp+12], edi |
614 | mov [esp+12], edi |
Line 615... | Line 615... | ||
615 | 615 | ||
Line 616... | Line -... | ||
616 | lea ebx, [ecx+0x3FFFFF] |
- | |
617 | 616 | lea ebx, [ecx+0x3FFFFF] |
|
618 | xor ecx, ecx |
617 | |
619 | call @core_alloc@4 |
618 | call _alloc_page |
620 | test eax, eax |
619 | test eax, eax |
Line 621... | Line 620... | ||
621 | mov [esp], eax |
620 | mov [esp], eax |
622 | jz .fail |
621 | jz .fail |
623 | 622 | ||
624 | mov ecx, 512 |
623 | mov ecx, 512 |
625 | lea edi, [eax + OS_BASE] |
624 | lea edi, [eax + OS_BASE] |
Line 626... | Line 625... | ||
626 | xor eax, eax |
625 | xor eax, eax |
627 | cld |
626 | cld |
628 | rep stosd |
627 | rep stosd |
Line 629... | Line 628... | ||
629 | 628 | ||
630 | mov ecx, 512 |
629 | mov ecx, 512 ; FIX only core tabs |
631 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
630 | mov esi, _sys_pdbr+(HEAP_BASE shr 20) |
632 | rep movsd |
- | |
633 | 631 | rep movsd |
|
634 | mov esi, [esp] |
632 | |
635 | shr ebx, 22 |
633 | mov esi, [esp] |
Line 636... | Line 634... | ||
636 | .new_ptab: |
634 | shr ebx, 22 |
637 | xor ecx, ecx |
635 | .new_ptab: |
Line 649... | Line 647... | ||
649 | 647 | ||
650 | add esi, 4 |
648 | add esi, 4 |
651 | dec ebx |
649 | dec ebx |
Line 652... | Line -... | ||
652 | jnz .new_ptab |
- | |
653 | 650 | jnz .new_ptab |
|
654 | xor ecx, ecx |
651 | |
655 | call @core_alloc@4 |
652 | call _alloc_page |
Line 656... | Line 653... | ||
656 | test eax, eax |
653 | test eax, eax |
657 | jz .fail |
654 | jz .fail |
Line 699... | Line 696... | ||
699 | jz .next |
696 | jz .next |
Line 700... | Line 697... | ||
700 | 697 | ||
701 | test ecx, 1 shl 9 |
698 | test ecx, 1 shl 9 |
Line 702... | Line 699... | ||
702 | jnz .next ;skip shared pages |
699 | jnz .next ;skip shared pages |
703 | 700 | ||
704 | call @core_free@4 |
701 | call @frame_free@4 |
705 | .next: |
702 | .next: |
706 | add esi, 4 |
703 | add esi, 4 |
707 | dec ebx |
704 | dec ebx |
Line 757... | Line 754... | ||
757 | add eax, OS_BASE |
754 | add eax, OS_BASE |
Line 758... | Line 755... | ||
758 | 755 | ||
Line 759... | Line 756... | ||
759 | stdcall destroy_page_table, eax |
756 | stdcall destroy_page_table, eax |
760 | 757 | ||
761 | mov ecx, [esi] |
758 | mov ecx, [esi] |
762 | call @core_free@4 |
759 | call @frame_free@4 |
763 | .next: |
760 | .next: |
764 | add esi, 4 |
761 | add esi, 4 |
Line 765... | Line 762... | ||
765 | dec edi |
762 | dec edi |
766 | jnz .destroy |
763 | jnz .destroy |
767 | 764 | ||
768 | mov ecx, [pg_dir] |
765 | mov ecx, [pg_dir] |
769 | call @core_free@4 |
766 | call @frame_free@4 |
770 | .exit: |
767 | .exit: |
Line 1148... | Line 1145... | ||
1148 | 1145 | ||
1149 | locals |
1146 | locals |
1150 | pl0_stack dd ? |
1147 | pl0_stack dd ? |
Line 1151... | Line 1148... | ||
1151 | endl |
1148 | endl |
1152 | 1149 | ||
1153 | mov ecx, 1 ;(RING0_STACK_SIZE+512) shr 12 |
1150 | mov ecx, 2 ;(RING0_STACK_SIZE+512) shr 12 |
1154 | call @core_alloc@4 |
1151 | call @frame_alloc@4 |
Line 1155... | Line 1152... | ||
1155 | add eax, OS_BASE |
1152 | add eax, OS_BASE |
Line 1194... | Line 1191... | ||
1194 | mov [SLOT_BASE+APPDATA.pl0_stack+ebx],eax |
1191 | mov [SLOT_BASE+APPDATA.pl0_stack+ebx],eax |
1195 | add eax, RING0_STACK_SIZE |
1192 | add eax, RING0_STACK_SIZE |
1196 | mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax |
1193 | mov [SLOT_BASE+APPDATA.saved_esp0+ebx], eax |
Line 1197... | Line 1194... | ||
1197 | 1194 | ||
1198 | call _alloc_page |
1195 | call _alloc_page |
- | 1196 | lea edi, [eax + OS_BASE] |
|
1199 | add eax, OS_BASE |
1197 | mov [ebx+SLOT_BASE+APPDATA.cur_dir], edi |
1200 | mov esi,[current_slot] |
1198 | mov esi,[current_slot] |
1201 | mov esi,[esi+APPDATA.cur_dir] |
1199 | mov esi,[esi+APPDATA.cur_dir] |
1202 | mov ecx,0x1000/4 |
- | |
1203 | mov edi,eax |
- | |
1204 | mov [ebx+SLOT_BASE+APPDATA.cur_dir],eax |
1200 | mov ecx,0x1000/4 |
Line 1205... | Line 1201... | ||
1205 | rep movsd |
1201 | rep movsd |
1206 | 1202 | ||
Line 1300... | Line 1296... | ||
1300 | inc ecx ; process state - suspended |
1296 | inc ecx ; process state - suspended |
1301 | mov eax,[CURRENT_TASK] |
1297 | mov eax,[CURRENT_TASK] |
1302 | mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot],eax |
1298 | mov [SLOT_BASE+ebx*8+APPDATA.debugger_slot],eax |
1303 | .no_debug: |
1299 | .no_debug: |
1304 | mov [CURRENT_TASK+ebx+TASKDATA.state], cl |
1300 | mov [CURRENT_TASK+ebx+TASKDATA.state], cl |
1305 | DEBUGF 1,"%s",new_process_running |
1301 | ; DEBUGF 1,"%s",new_process_running |
1306 | ret |
1302 | ret |
1307 | endp |
1303 | endp |
Line 1308... | Line 1304... | ||
1308 | 1304 |