Subversion Repositories Kolibri OS

Rev

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

Rev 378 Rev 380
Line 157... Line 157...
157
           mov ecx, -0x20      ; too many processes
157
           mov ecx, -0x20      ; too many processes
158
           jz .err
158
           jz .err
Line 159... Line 159...
159
 
159
 
160
           mov [slot], eax
160
           mov [slot], eax
161
           shl eax, 8
161
           shl eax, 8
162
           add eax, PROC_BASE
162
           add eax, SLOT_BASE
163
           mov [slot_base], eax
163
           mov [slot_base], eax
164
           mov edi, eax
164
           mov edi, eax
Line 165... Line 165...
165
           _clear_ 256     ;clean extended information about process
165
           _clear_ 256     ;clean extended information about process
Line 485... Line 485...
485
align 4
485
align 4
486
set_cr3:
486
set_cr3:
487
           mov esi, [CURRENT_TASK]
487
           mov esi, [CURRENT_TASK]
488
           mov ebx, esi
488
           mov ebx, esi
489
           shl esi,8
489
           shl esi,8
490
           mov [PROC_BASE+esi+0xB8],eax
490
           mov [SLOT_BASE+esi+0xB8],eax
491
           imul   ebx,tss_step
491
           imul   ebx,tss_step
492
           add    ebx,tss_data
492
           add    ebx,tss_data
493
           mov [ebx+28], eax
493
           mov [ebx+28], eax
494
           mov cr3, eax
494
           mov cr3, eax
495
           ret
495
           ret
Line 529... Line 529...
529
           mov   ecx,eax
529
           mov   ecx,eax
530
           shl   ecx,5
530
           shl   ecx,5
531
           cmp   byte [CURRENT_TASK+ecx+0xa],9  ;if process running?
531
           cmp   byte [CURRENT_TASK+ecx+0xa],9  ;if process running?
532
           jz    @f                              ;skip empty slots
532
           jz    @f                              ;skip empty slots
533
           shl   ecx,3
533
           shl   ecx,3
534
           cmp   [PROC_BASE+ecx+0xB8],ebx       ;compare page directory addresses
534
           cmp   [SLOT_BASE+ecx+0xB8],ebx       ;compare page directory addresses
535
           jnz   @f
535
           jnz   @f
536
           inc   edx                            ;thread found
536
           inc   edx                            ;thread found
537
@@:
537
@@:
538
           inc   eax
538
           inc   eax
539
           cmp   eax,[TASK_COUNT]               ;exit loop if we look through all processes
539
           cmp   eax,[TASK_COUNT]               ;exit loop if we look through all processes
Line 633... Line 633...
633
     jle  .ok
633
     jle  .ok
634
     shl  eax,5
634
     shl  eax,5
635
     cmp  word [CURRENT_TASK+eax+0xa],0
635
     cmp  word [CURRENT_TASK+eax+0xa],0
636
     jnz  .failed
636
     jnz  .failed
637
     shl  eax,3
637
     shl  eax,3
638
     mov  eax,[PROC_BASE+eax+0xb8]
638
     mov  eax,[SLOT_BASE+eax+0xb8]
639
     test eax,eax
639
     test eax,eax
640
     jz   .failed
640
     jz   .failed
Line 641... Line 641...
641
 
641
 
642
     mov  eax,1
642
     mov  eax,1
Line 736... Line 736...
736
           shl  eax,8
736
           shl  eax,8
737
           mov ebx, [offset]
737
           mov ebx, [offset]
738
           add ebx, new_app_base
738
           add ebx, new_app_base
739
           push ecx
739
           push ecx
740
           stdcall map_memEx, [proc_mem_map],\
740
           stdcall map_memEx, [proc_mem_map],\
741
                              [PROC_BASE+eax+0xB8],\
741
                              [SLOT_BASE+eax+0xB8],\
742
                              ebx, ecx
742
                              ebx, ecx
743
           pop ecx
743
           pop ecx
Line 744... Line 744...
744
 
744
 
745
           mov esi, [offset]
745
           mov esi, [offset]
Line 802... Line 802...
802
           shl  eax,8
802
           shl  eax,8
803
           mov ebx, [offset]
803
           mov ebx, [offset]
804
           add ebx, new_app_base
804
           add ebx, new_app_base
805
           push ecx
805
           push ecx
806
           stdcall map_memEx, [proc_mem_map],\
806
           stdcall map_memEx, [proc_mem_map],\
807
                              [PROC_BASE+eax+0xB8],\
807
                              [SLOT_BASE+eax+0xB8],\
808
                              ebx, ecx
808
                              ebx, ecx
809
           pop ecx
809
           pop ecx
Line 810... Line 810...
810
 
810
 
811
           mov edi, [offset]
811
           mov edi, [offset]
Line 866... Line 866...
866
 
866
 
Line 867... Line 867...
867
           mov [slot], eax
867
           mov [slot], eax
868
 
868
 
869
           mov    esi,[CURRENT_TASK]
869
           mov    esi,[CURRENT_TASK]
870
           shl    esi,8
870
           shl    esi,8
Line 871... Line 871...
871
           add    esi,PROC_BASE
871
           add    esi,SLOT_BASE
872
           mov    ebx,esi             ;ebx=esi - pointer to extended information about current thread
872
           mov    ebx,esi             ;ebx=esi - pointer to extended information about current thread
873
 
873
 
874
           mov    edi, eax
874
           mov    edi, eax
875
           shl    edi,8
875
           shl    edi,8
876
           add    edi,PROC_BASE
876
           add    edi,SLOT_BASE
877
           mov    edx,edi             ;edx=edi - pointer to extended infomation about new thread
877
           mov    edx,edi             ;edx=edi - pointer to extended infomation about new thread
878
           mov    ecx,256/4
878
           mov    ecx,256/4
Line 948... Line 948...
948
 
948
 
949
           mov eax, [slot]
949
           mov eax, [slot]
Line 950... Line 950...
950
           mov ebx, eax
950
           mov ebx, eax
951
 
951
 
952
           shl eax, 8
952
           shl eax, 8
953
           mov [eax+PROC_BASE+APPDATA.fpu_state], edi
953
           mov [eax+SLOT_BASE+APPDATA.fpu_state], edi
Line 954... Line 954...
954
           mov [eax+PROC_BASE+APPDATA.fpu_handler], 0
954
           mov [eax+SLOT_BASE+APPDATA.fpu_handler], 0
955
           mov [eax+PROC_BASE+APPDATA.sse_handler], 0
955
           mov [eax+SLOT_BASE+APPDATA.sse_handler], 0
956
 
956
 
Line 957... Line 957...
957
           mov esi, fpu_data
957
           mov esi, fpu_data
958
           mov ecx, 512/4
958
           mov ecx, 512/4
959
           rep movsd
959
           rep movsd
960
 
960
 
961
           cmp    ebx,[TASK_COUNT]
961
           cmp    ebx,[TASK_COUNT]
962
           jle    .noinc
962
           jle    .noinc
963
           inc    dword [TASK_COUNT]       ;update number of processes
963
           inc    dword [TASK_COUNT]       ;update number of processes
964
.noinc:
964
.noinc:
Line 965... Line 965...
965
           shl ebx,8
965
           shl ebx,8
966
           lea edx, [ebx+PROC_BASE+APP_EV_OFFSET]
966
           lea edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
967
           mov [PROC_BASE+APPDATA.fd_ev+ebx],edx
967
           mov [SLOT_BASE+APPDATA.fd_ev+ebx],edx
Line 968... Line 968...
968
           mov [PROC_BASE+APPDATA.bk_ev+ebx],edx
968
           mov [SLOT_BASE+APPDATA.bk_ev+ebx],edx
969
 
969
 
970
           add edx, APP_OBJ_OFFSET-APP_EV_OFFSET
970
           add edx, APP_OBJ_OFFSET-APP_EV_OFFSET
971
           mov [PROC_BASE+APPDATA.fd_obj+ebx],edx
971
           mov [SLOT_BASE+APPDATA.fd_obj+ebx],edx
Line 972... Line 972...
972
           mov [PROC_BASE+APPDATA.bk_obj+ebx],edx
972
           mov [SLOT_BASE+APPDATA.bk_obj+ebx],edx
973
 
973
 
974
           mov ecx, [def_cursor]
974
           mov ecx, [def_cursor]
Line 988... Line 988...
988
 
988
 
989
           mov     eax, edx
989
           mov     eax, edx
990
           add     eax, 256
990
           add     eax, 256
Line 991... Line 991...
991
           jc      @f
991
           jc      @f
992
 
992
 
Line 993... Line 993...
993
           cmp     eax, [PROC_BASE+APPDATA.mem_size+ebx*8]
993
           cmp     eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
994
           ja      @f
994
           ja      @f
995
 
995
 
Line 1001... Line 1001...
1001
           test edx,edx
1001
           test edx,edx
1002
           jz @F                   ;application don't need path of file
1002
           jz @F                   ;application don't need path of file
1003
        mov     eax, edx
1003
        mov     eax, edx
1004
        add     eax, 1024
1004
        add     eax, 1024
1005
        jc      @f
1005
        jc      @f
1006
        cmp     eax, [PROC_BASE+APPDATA.mem_size+ebx*8]
1006
        cmp     eax, [SLOT_BASE+APPDATA.mem_size+ebx*8]
1007
        ja      @f
1007
        ja      @f
1008
           add edx, new_app_base
1008
           add edx, new_app_base
1009
           stdcall k_strncpy, edx, [app_path], 1024
1009
           stdcall k_strncpy, edx, [app_path], 1024
1010
@@:
1010
@@:
1011
           mov    ebx,[slot]
1011
           mov    ebx,[slot]
Line 1048... Line 1048...
1048
           sub edi, tss_step
1048
           sub edi, tss_step
Line 1049... Line 1049...
1049
 
1049
 
1050
;set cr3 register in TSS of application
1050
;set cr3 register in TSS of application
1051
           mov ecx, [slot]
1051
           mov ecx, [slot]
1052
           shl ecx, 8
1052
           shl ecx, 8
1053
           mov eax,[PROC_BASE+ecx+APPDATA.dir_table]
1053
           mov eax,[SLOT_BASE+ecx+APPDATA.dir_table]
Line 1054... Line 1054...
1054
           mov [edi+TSS._cr3],eax
1054
           mov [edi+TSS._cr3],eax
1055
 
1055
 
1056
           mov esi,[params]
1056
           mov esi,[params]
Line 1102... Line 1102...
1102
           mov eax, [flags]
1102
           mov eax, [flags]
1103
           test byte [flags], 1
1103
           test byte [flags], 1
1104
           jz   .no_debug
1104
           jz   .no_debug
1105
           mov  [CURRENT_TASK+ebx+0xa],byte 1 ;set process state - suspended
1105
           mov  [CURRENT_TASK+ebx+0xa],byte 1 ;set process state - suspended
1106
           mov  eax,[CURRENT_TASK]
1106
           mov  eax,[CURRENT_TASK]
1107
           mov  [PROC_BASE+ebx*8+0xac],eax ;set debugger PID - current
1107
           mov  [SLOT_BASE+ebx*8+0xac],eax ;set debugger PID - current
1108
.no_debug:
1108
.no_debug:
1109
           mov    esi,new_process_running
1109
           mov    esi,new_process_running
1110
           call   sys_msg_board_str     ;output information about succefull startup
1110
           call   sys_msg_board_str     ;output information about succefull startup
1111
           ret
1111
           ret
1112
endp
1112
endp