Subversion Repositories Kolibri OS

Rev

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

Rev 9692 Rev 9709
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2021. 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: 9692 $
8
$Revision: 9709 $
Line 9... Line 9...
9
 
9
 
Line 485... Line 485...
485
;  eax - slot of process or 0 if process don't exists
485
;  eax - slot of process or 0 if process don't exists
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.TASKDATA ; multiply by size
-
 
491
        ;shl     ebx, BSF sizeof.APPDATA ; multiply by size
490
        shl     ebx, BSF sizeof.APPDATA ; multiply by size
492
        ; add 2*32 cause:
491
        ; add 2*32 cause:
493
        ; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
492
        ; [TASK_TABLE; TASK_TABLE + 32) isnt a task actually
494
        ; skip first process in the task table
493
        ; skip first process in the task table
495
        mov     ecx, 2*32    ;sizeof.TASKDATA
494
        ;mov     ecx, 2*32    ;sizeof.TASKDATA
496
        ;mov     ecx, sizeof.APPDATA
495
        mov     ecx, sizeof.APPDATA
Line 497... Line 496...
497
 
496
 
498
.loop:
497
.loop:
499
;ecx = offset of current process info entry
498
;ecx = offset of current process info entry
500
;ebx = maximum permitted offset
499
;ebx = maximum permitted offset
501
        cmp     [TASK_TABLE+ecx+TASKDATA.state], TSTATE_FREE
500
        cmp     [SLOT_BASE + ecx + APPDATA.state], TSTATE_FREE
502
        jz      .endloop ;skip empty slots
-
 
503
        ;cmp     [ecx+SLOT_BASE+APPDATA.state], TSTATE_FREE
-
 
504
        ;jz      .endloop ;skip empty slots
501
        jz      .endloop ;skip empty slots
505
        cmp     [ecx*8 + SLOT_BASE + APPDATA.tid], eax;check PID
502
        cmp     [ecx + SLOT_BASE + APPDATA.tid], eax;check PID
506
        jz      .pid_found
503
        jz      .pid_found
507
.endloop:
-
 
508
        add     ecx, sizeof.TASKDATA
504
.endloop:
509
        ;add     ecx, sizeof.APPDATA
505
        add     ecx, sizeof.APPDATA
510
        cmp     ecx, ebx
506
        cmp     ecx, ebx
Line 511... Line 507...
511
        jle     .loop
507
        jle     .loop
512
 
508
 
513
        pop     ecx
509
        pop     ecx
514
        pop     ebx
510
        pop     ebx
Line 515... Line 511...
515
        xor     eax, eax
511
        xor     eax, eax
516
        ret
512
        ret
517
 
-
 
518
.pid_found:
513
 
519
        shr     ecx, BSF sizeof.TASKDATA ; divide by size
514
.pid_found:
520
        ;shr     ecx, BSF sizeof.APPDATA
515
        shr     ecx, BSF sizeof.APPDATA ; divide by size
521
        mov     eax, ecx ;convert offset to index of slot
516
        mov     eax, ecx ;convert offset to index of slot
Line 901... Line 896...
901
        stdcall kernel_free, ebp
896
        stdcall kernel_free, ebp
902
        mov     ebx, [current_slot]
897
        mov     ebx, [current_slot]
903
        cmp     [ebx+APPDATA.debugger_slot], 0
898
        cmp     [ebx+APPDATA.debugger_slot], 0
904
        je      .exit
899
        je      .exit
905
        mov     [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
900
        mov     [ebx+APPDATA.state], TSTATE_RUN_SUSPENDED
906
        mov     eax, [TASK_BASE]
-
 
907
        mov     [eax+TASKDATA.state], TSTATE_RUN_SUSPENDED
901
        mov     [ebx + APPDATA.state], TSTATE_RUN_SUSPENDED
908
        call    change_task
902
        call    change_task
909
.exit:
903
.exit:
910
        popad
904
        popad
911
        iretd
905
        iretd
Line 930... Line 924...
930
        lea     edi, [eax+RING0_STACK_SIZE]
924
        lea     edi, [eax+RING0_STACK_SIZE]
Line 931... Line 925...
931
 
925
 
932
        mov     eax, [slot]
926
        mov     eax, [slot]
Line 933... Line 927...
933
        mov     ebx, eax
927
        mov     ebx, eax
934
 
928
 
935
        shl     eax, 8
929
        shl     eax, BSF sizeof.APPDATA
936
        mov     [eax+SLOT_BASE+APPDATA.fpu_state], edi
930
        mov     [eax+SLOT_BASE+APPDATA.fpu_state], edi
937
        mov     [eax+SLOT_BASE+APPDATA.exc_handler], 0
931
        mov     [eax+SLOT_BASE+APPDATA.exc_handler], 0
Line 950... Line 944...
950
        shr     ecx, 2
944
        shr     ecx, 2
951
        rep movsd
945
        rep movsd
Line 952... Line 946...
952
 
946
 
953
        cmp     [thread_count], ebx
947
        cmp     [thread_count], ebx
954
        adc     [thread_count], 0   ; update number of processes
948
        adc     [thread_count], 0   ; update number of processes
955
        shl     ebx, 8
949
        shl     ebx, BSF sizeof.APPDATA
956
        lea     edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
950
        lea     edx, [ebx+SLOT_BASE+APP_EV_OFFSET]
957
        mov     [SLOT_BASE+APPDATA.fd_ev+ebx], edx
951
        mov     [SLOT_BASE+APPDATA.fd_ev+ebx], edx
Line 958... Line 952...
958
        mov     [SLOT_BASE+APPDATA.bk_ev+ebx], edx
952
        mov     [SLOT_BASE+APPDATA.bk_ev+ebx], edx
Line 985... Line 979...
985
        mov     [ebx+SLOT_BASE+APPDATA.tid], eax    ;set TID
979
        mov     [ebx+SLOT_BASE+APPDATA.tid], eax    ;set TID
Line 986... Line 980...
986
 
980
 
987
        mov     eax, [slot]
981
        mov     eax, [slot]
988
        mov     [ebx+SLOT_BASE+APPDATA.wnd_number], al
982
        mov     [ebx+SLOT_BASE+APPDATA.wnd_number], al
989
        mov     ebx, eax
983
        mov     ebx, eax
990
        shl     ebx, 5
984
        shl     ebx, BSF sizeof.WDATA
Line 991... Line 985...
991
        lea     ecx, [draw_data+ebx];ecx - pointer to draw data
985
        lea     ecx, [draw_data+ebx];ecx - pointer to draw data
992
 
986
 
993
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
987
; set window state to 'normal' (non-minimized/maximized/rolled-up) state
Line 1035... Line 1029...
1035
        mov     [ebx+REG_APP_ESP], eax
1029
        mov     [ebx+REG_APP_ESP], eax
1036
        mov     [ebx+REG_SS], dword app_data
1030
        mov     [ebx+REG_SS], dword app_data
Line 1037... Line 1031...
1037
 
1031
 
1038
        lea     edx, [ebx+REG_RET]
1032
        lea     edx, [ebx+REG_RET]
1039
        mov     ebx, [slot]
1033
        mov     ebx, [slot]
1040
        shl     ebx, 5
1034
        shl     ebx, BSF sizeof.APPDATA
Line 1041... Line 1035...
1041
        mov     [ebx*8+SLOT_BASE+APPDATA.saved_esp], edx
1035
        mov     [ebx+SLOT_BASE+APPDATA.saved_esp], edx
1042
 
1036
 
1043
        xor     edx, edx; process state - running
1037
        xor     edx, edx; process state - running
1044
; set if debuggee
1038
; set if debuggee
1045
        test    byte [flags], 1
1039
        test    byte [flags], 1
1046
        jz      .no_debug
1040
        jz      .no_debug
1047
        mov     eax, [current_slot_idx]
1041
        mov     eax, [current_slot_idx]
1048
        mov     [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
1042
        mov     [SLOT_BASE+ebx+APPDATA.debugger_slot], eax
1049
.no_debug:
-
 
1050
        mov     [TASK_TABLE+ebx+TASKDATA.state], dl
-
 
1051
        ;shl     ebx, 3
1043
.no_debug:
1052
        ;mov     [ebx+SLOT_BASE+APPDATA.state], dl
1044
        mov     [SLOT_BASE + ebx + APPDATA.state], dl
1053
        lea     edx, [SLOT_BASE+ebx*8]
1045
        lea     edx, [SLOT_BASE+ebx]
1054
        call    scheduler_add_thread
1046
        call    scheduler_add_thread
Line 1055... Line 1047...
1055
        ret
1047
        ret