Subversion Repositories Kolibri OS

Rev

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

Rev 9710 Rev 9715
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2022. 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: 9710 $
8
$Revision: 9715 $
Line 9... Line 9...
9
 
9
 
Line 125... Line 125...
125
        mov     esi, -TASKMAN_ERROR_TOO_MANY_PROCESSES
125
        mov     esi, -TASKMAN_ERROR_TOO_MANY_PROCESSES
126
        test    eax, eax
126
        test    eax, eax
127
        jz      .err_0
127
        jz      .err_0
Line 128... Line 128...
128
 
128
 
129
        mov     [slot], eax
129
        mov     [slot], eax
130
        shl     eax, 8
130
        shl     eax, BSF sizeof.APPDATA
131
        lea     edi, [SLOT_BASE+eax]
131
        lea     edi, [SLOT_BASE + eax]
132
        mov     [slot_base], edi
132
        mov     [slot_base], edi
133
; clean extended information about process
133
; clean extended information about process
134
        mov     ecx, sizeof.APPDATA/4
134
        mov     ecx, sizeof.APPDATA/4
Line 486... Line 486...
486
;Search process by PID.
486
;Search process by PID.
487
        push    ebx
487
        push    ebx
488
        push    ecx
488
        push    ecx
489
        mov     ebx, [thread_count]
489
        mov     ebx, [thread_count]
490
        shl     ebx, BSF sizeof.APPDATA ; multiply by size
490
        shl     ebx, BSF sizeof.APPDATA ; multiply by size
491
        ; add 2*32 cause:
-
 
492
        ; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
-
 
493
        ; skip first process in the task table
491
        ; skip first process in the task table
494
        ;mov     ecx, 2*32    ;sizeof.TASKDATA
-
 
495
        mov     ecx, sizeof.APPDATA
492
        mov     ecx, sizeof.APPDATA
Line 496... Line 493...
496
 
493
 
497
.loop:
494
.loop:
498
;ecx = offset of current process info entry
495
;ecx = offset of current process info entry
499
;ebx = maximum permitted offset
496
;ebx = maximum permitted offset
500
        cmp     [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
497
        cmp     [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
501
        jz      .endloop ;skip empty slots
498
        jz      .endloop ;skip empty slots
502
        cmp     [ecx + SLOT_BASE + APPDATA.tid], eax;check PID
499
        cmp     [SLOT_BASE + ecx + APPDATA.tid], eax
503
        jz      .pid_found
500
        jz      .pid_found
504
.endloop:
501
.endloop:
505
        add     ecx, sizeof.APPDATA
502
        add     ecx, sizeof.APPDATA
506
        cmp     ecx, ebx
503
        cmp     ecx, ebx
Line 696... Line 693...
696
 
693
 
697
        mov     esi, [current_slot]
694
        mov     esi, [current_slot]
Line 698... Line 695...
698
        mov     ebx, esi      ;ebx=esi - pointer to extended information about current thread
695
        mov     ebx, esi      ;ebx=esi - pointer to extended information about current thread
699
 
696
 
700
        mov     edi, eax
697
        mov     edi, eax
701
        shl     edi, 8
698
        shl     edi, BSF sizeof.APPDATA
702
        add     edi, SLOT_BASE
699
        add     edi, SLOT_BASE
703
        mov     edx, edi      ;edx=edi - pointer to extended infomation about new thread
700
        mov     edx, edi      ;edx=edi - pointer to extended infomation about new thread
704
        mov     ecx, sizeof.APPDATA/4
701
        mov     ecx, sizeof.APPDATA/4
Line 925... Line 922...
925
 
922
 
926
        mov     eax, [slot]
923
        mov     eax, [slot]
Line 927... Line 924...
927
        mov     ebx, eax
924
        mov     ebx, eax
928
 
925
 
929
        shl     eax, BSF sizeof.APPDATA
926
        shl     eax, BSF sizeof.APPDATA
930
        mov     [eax+SLOT_BASE+APPDATA.fpu_state], edi
927
        mov     [SLOT_BASE + eax + APPDATA.fpu_state], edi
931
        mov     [eax+SLOT_BASE+APPDATA.exc_handler], 0
928
        mov     [SLOT_BASE + eax + APPDATA.exc_handler], 0
Line 932... Line 929...
932
        mov     [eax+SLOT_BASE+APPDATA.except_mask], 0
929
        mov     [SLOT_BASE + eax + APPDATA.except_mask], 0
933
        mov     [eax+SLOT_BASE+APPDATA.terminate_protection], 80000001h
930
        mov     [SLOT_BASE + eax + APPDATA.terminate_protection], 80000001h
934
 
931
 
935
;set default io permission map
932
;set default io permission map
936
        mov     ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map]
933
        mov     ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map]
Line 937... Line 934...
937
        mov     [eax+SLOT_BASE+APPDATA.io_map], ecx
934
        mov     [SLOT_BASE + eax + APPDATA.io_map], ecx
938
        mov     ecx, [SLOT_BASE+sizeof.APPDATA+APPDATA.io_map+4]
935
        mov     ecx, [SLOT_BASE + sizeof.APPDATA + APPDATA.io_map + 4]
939
        mov     [eax+SLOT_BASE+APPDATA.io_map+4], ecx
936
        mov     [SLOT_BASE + eax + APPDATA.io_map + 4], ecx
940
 
937
 
941
        mov     esi, fpu_data
938
        mov     esi, fpu_data
Line 942... Line 939...
942
        mov     ecx, [xsave_area_size]
939
        mov     ecx, [xsave_area_size]
943
        add     ecx, 3
940
        add     ecx, 3
944
        shr     ecx, 2
941
        shr     ecx, 2
945
        rep movsd
942
        rep movsd
946
 
943
 
947
        cmp     [thread_count], ebx
944
        cmp     [thread_count], ebx
Line 948... Line 945...
948
        adc     [thread_count], 0   ; update number of processes
945
        adc     [thread_count], 0   ; update number of processes
949
        shl     ebx, BSF sizeof.APPDATA
946
        shl     ebx, BSF sizeof.APPDATA
950
        lea     edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
947
        lea     edx, [SLOT_BASE + ebx + APP_EV_OFFSET]
Line 951... Line 948...
951
        mov     [SLOT_BASE+APPDATA.fd_ev+ebx], edx
948
        mov     [SLOT_BASE + ebx + APPDATA.fd_ev], edx
952
        mov     [SLOT_BASE+APPDATA.bk_ev+ebx], edx
949
        mov     [SLOT_BASE + ebx + APPDATA.bk_ev], edx
953
 
950
 
954
        add     edx, APP_OBJ_OFFSET-APP_EV_OFFSET
951
        add     edx, APP_OBJ_OFFSET - APP_EV_OFFSET
955
        mov     [SLOT_BASE+APPDATA.fd_obj+ebx], edx
952
        mov     [SLOT_BASE + ebx + APPDATA.fd_obj], edx
956
        mov     [SLOT_BASE+APPDATA.bk_obj+ebx], edx
953
        mov     [SLOT_BASE + ebx + APPDATA.bk_obj], edx
Line 957... Line 954...
957
 
954
 
958
        mov     ecx, [def_cursor]
955
        mov     ecx, [def_cursor]
959
        mov     [SLOT_BASE+APPDATA.cursor+ebx], ecx
956
        mov     [SLOT_BASE + ebx + APPDATA.cursor], ecx
960
        mov     eax, [pl0_stack]
957
        mov     eax, [pl0_stack]
961
        mov     [SLOT_BASE+APPDATA.pl0_stack+ebx], eax
958
        mov     [SLOT_BASE + ebx + APPDATA.pl0_stack], eax
962
        add     eax, RING0_STACK_SIZE
959
        add     eax, RING0_STACK_SIZE
963
        mov     [SLOT_BASE+APPDATA.saved_esp0+ebx], eax
960
        mov     [SLOT_BASE + ebx + APPDATA.saved_esp0], eax
964
 
961
 
965
        push    ebx
962
        push    ebx
Line 966... Line 963...
966
        stdcall kernel_alloc, maxPathLength
963
        stdcall kernel_alloc, maxPathLength
967
        pop     ebx
964
        pop     ebx
968
        mov     esi, [current_slot]
965
        mov     esi, [current_slot]
969
        mov     esi, [esi+APPDATA.cur_dir]
966
        mov     esi, [esi + APPDATA.cur_dir]
Line 970... Line 967...
970
        mov     ecx, maxPathLength/4
967
        mov     ecx, maxPathLength/4
971
        mov     edi, eax
968
        mov     edi, eax
972
        mov     [ebx+SLOT_BASE+APPDATA.cur_dir], eax
969
        mov     [SLOT_BASE + ebx + APPDATA.cur_dir], eax
973
        rep movsd
970
        rep movsd
974
 
971
 
Line 975... Line 972...
975
        mov     [ebx+SLOT_BASE+APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
972
        mov     [SLOT_BASE + ebx + APPDATA.event_mask], dword 1+2+4;set default event flags (see 40 function)
976
        inc     dword [process_number]
973
        inc     dword [process_number]
977
        mov     eax, [process_number]
974
        mov     eax, [process_number]
Line 978... Line 975...
978
        mov     [ebx+SLOT_BASE+APPDATA.tid], eax    ;set TID
975
        mov     [SLOT_BASE + ebx + APPDATA.tid], eax    ;set TID
979
 
976
 
980
        mov     eax, [slot]
977
        mov     eax, [slot]
981
        mov     [ebx+SLOT_BASE+APPDATA.wnd_number], al
978
        mov     [SLOT_BASE + ebx + APPDATA.wnd_number], al
Line 1029... Line 1026...
1029
        mov     [ebx+REG_SS], dword app_data
1026
        mov     [ebx + REG_SS], dword app_data
Line 1030... Line 1027...
1030
 
1027
 
1031
        lea     edx, [ebx+REG_RET]
1028
        lea     edx, [ebx + REG_RET]
1032
        mov     ebx, [slot]
1029
        mov     ebx, [slot]
1033
        shl     ebx, BSF sizeof.APPDATA
1030
        shl     ebx, BSF sizeof.APPDATA
Line 1034... Line 1031...
1034
        mov     [ebx+SLOT_BASE+APPDATA.saved_esp], edx
1031
        mov     [SLOT_BASE + ebx + APPDATA.saved_esp], edx
1035
 
1032
 
1036
        xor     edx, edx; process state - running
1033
        xor     edx, edx; process state - running
1037
; set if debuggee
1034
; set if debuggee