Subversion Repositories Kolibri OS

Rev

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

Rev 3500 Rev 3555
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. 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: 3500 $
8
$Revision: 3555 $
Line 9... Line 9...
9
 
9
 
Line 88... Line 88...
88
        jbe     @f
88
        jbe     @f
89
        pushad
89
        pushad
90
        stdcall set_cursor, [def_cursor_clock]
90
        stdcall set_cursor, [def_cursor_clock]
91
        mov     [handle], eax
91
        mov     [handle], eax
92
        mov     [redrawmouse_unconditional], 1
92
        mov     [redrawmouse_unconditional], 1
93
        call    __sys_draw_pointer
93
        call    wakeup_osloop
94
        popad
94
        popad
95
@@:
95
@@:
96
        mov     [flags], edx
96
        mov     [flags], edx
Line 97... Line 97...
97
 
97
 
Line 150... Line 150...
150
        call    test_app_header
150
        call    test_app_header
151
        mov     esi, -0x1F
151
        mov     esi, -0x1F
152
        test    eax, eax
152
        test    eax, eax
153
        jz      .err_hdr
153
        jz      .err_hdr
Line 154... Line -...
154
 
-
 
155
.wait_lock:
-
 
156
        cmp     [application_table_status], 0
-
 
157
        je      .get_lock
-
 
158
        call    change_task
-
 
159
        jmp     .wait_lock
-
 
160
 
-
 
161
.get_lock:
-
 
162
        mov     eax, 1
-
 
163
        xchg    eax, [application_table_status]
-
 
164
        test    eax, eax
-
 
165
        jnz     .wait_lock
-
 
166
 
154
 
Line 167... Line 155...
167
        call    set_application_table_status
155
        call    lock_application_table
168
 
156
 
169
        call    get_new_process_place
157
        call    get_new_process_place
170
        test    eax, eax
158
        test    eax, eax
Line 244... Line 232...
244
        stdcall set_app_params , [slot], eax, ebx, ecx, [flags]
232
        stdcall set_app_params , [slot], eax, ebx, ecx, [flags]
Line 245... Line 233...
245
 
233
 
246
        mov     eax, [save_cr3]
234
        mov     eax, [save_cr3]
Line 247... Line -...
247
        call    set_cr3
-
 
248
 
-
 
249
        xor     ebx, ebx
235
        call    set_cr3
-
 
236
 
Line 250... Line 237...
250
        mov     [application_table_status], ebx;unlock application_table_status mutex
237
        mov     eax, [process_number];set result
Line 251... Line 238...
251
        mov     eax, [process_number];set result
238
        call    unlock_application_table
252
 
239
 
253
        jmp     .final
240
        jmp     .final
254
 
241
 
255
.failed:
242
.failed:
256
        mov     eax, [save_cr3]
243
        mov     eax, [save_cr3]
257
        call    set_cr3
244
        call    set_cr3
258
.err:
-
 
259
.err_hdr:
245
.err:
260
        stdcall kernel_free, [file_base]
246
.err_hdr:
261
.err_file:
247
        stdcall kernel_free, [file_base]
262
        xor     eax, eax
248
.err_file:
263
        mov     [application_table_status], eax
249
        call    unlock_application_table
264
        mov     eax, esi
250
        mov     eax, esi
265
.final:
251
.final:
266
        cmp     [SCR_MODE], word 0x13
252
        cmp     [SCR_MODE], word 0x13
267
        jbe     @f
253
        jbe     @f
268
        pushad
254
        pushad
269
        stdcall set_cursor, [handle]
255
        stdcall set_cursor, [handle]
270
        mov     [redrawmouse_unconditional], 1
256
        mov     [redrawmouse_unconditional], 1
271
        call    __sys_draw_pointer
257
        call    wakeup_osloop
Line 548... Line 534...
548
align 4
534
align 4
549
proc destroy_app_space stdcall, pg_dir:dword, dlls_list:dword
535
proc destroy_app_space stdcall, pg_dir:dword, dlls_list:dword
Line 550... Line 536...
550
 
536
 
551
        xor     edx, edx
537
        xor     edx, edx
552
        push    edx
538
        push    edx
553
        mov     eax, 0x2
539
        mov     eax, 0x1
554
        mov     ebx, [pg_dir]
540
        mov     ebx, [pg_dir]
555
.loop:
541
.loop:
556
;eax = current slot of process
542
;eax = current slot of process
557
        mov     ecx, eax
543
        mov     ecx, eax
Line 896... Line 882...
896
        mov     [app_cmdline], eax
882
        mov     [app_cmdline], eax
897
        mov     [app_esp], edx
883
        mov     [app_esp], edx
898
        mov     [app_path], eax
884
        mov     [app_path], eax
899
       ;mov    esi,new_process_loading
885
       ;mov    esi,new_process_loading
900
       ;call   sys_msg_board_str
886
       ;call   sys_msg_board_str
901
.wait_lock:
-
 
902
        cmp     [application_table_status], 0
-
 
903
        je      .get_lock
-
 
904
        call    change_task
-
 
905
        jmp     .wait_lock
-
 
906
 
-
 
907
.get_lock:
-
 
908
        mov     eax, 1
-
 
909
        xchg    eax, [application_table_status]
-
 
910
        test    eax, eax
-
 
911
        jnz     .wait_lock
-
 
912
 
-
 
913
        call    set_application_table_status
887
        call    lock_application_table
Line 914... Line 888...
914
 
888
 
915
        call    get_new_process_place
889
        call    get_new_process_place
916
        test    eax, eax
890
        test    eax, eax
Line 965... Line 939...
965
        stdcall set_app_params , [slot], eax, dword 0, \
939
        stdcall set_app_params , [slot], eax, dword 0, \
966
                dword 0,dword 0
940
                dword 0,dword 0
Line 967... Line 941...
967
 
941
 
968
       ;mov    esi,new_process_running
942
       ;mov    esi,new_process_running
969
       ;call   sys_msg_board_str                ;output information about succefull startup
-
 
970
        xor     eax, eax
-
 
971
        mov     [application_table_status], eax ;unlock application_table_status mutex
943
       ;call   sys_msg_board_str                ;output information about succefull startup
-
 
944
        mov     eax, [process_number]           ;set result
972
        mov     eax, [process_number]           ;set result
945
        call    unlock_application_table
973
        ret
946
        ret
974
.failed:
947
.failed:
975
        xor     eax, eax
948
        xor     eax, eax
976
.failed1:
949
.failed1:
977
        mov     [application_table_status], eax
950
        call    unlock_application_table
978
        dec     eax     ;-1
951
        dec     eax     ;-1
979
        ret
952
        ret
Line 980... Line 953...
980
endp
953
endp
Line 1146... Line 1119...
1146
        mov     [ebx+REG_EAX], eax
1119
        mov     [ebx+REG_EAX], eax
Line 1147... Line 1120...
1147
 
1120
 
1148
        mov     eax, [esi+0x08]  ;app_eip
1121
        mov     eax, [esi+0x08]  ;app_eip
1149
        mov     [ebx+REG_EIP], eax;app_entry
1122
        mov     [ebx+REG_EIP], eax;app_entry
-
 
1123
        mov     [ebx+REG_CS], dword app_code
1150
        mov     [ebx+REG_CS], dword app_code
1124
        mov     ecx, USER_PRIORITY
1151
        mov     eax, [CURRENT_TASK]
1125
        mov     eax, [CURRENT_TASK]
1152
        shl     eax, 8                      ; created by kernel?
1126
        shl     eax, 8                      ; created by kernel?
1153
        cmp     [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
1127
        cmp     [SLOT_BASE+eax+APPDATA.dir_table], sys_pgdir - OS_BASE
1154
        jnz     @f
1128
        jnz     @f
1155
        cmp     [app_path], 0               ; it is a thread?
1129
        cmp     [app_path], 0               ; it is a thread?
1156
        jnz     @f
1130
        jnz     @f
-
 
1131
        mov     [ebx+REG_CS], dword os_code ; kernel thread
1157
        mov     [ebx+REG_CS], dword os_code ; kernel thread
1132
        mov     ecx, MAX_PRIORITY
1158
@@:
1133
@@:
Line 1159... Line 1134...
1159
        mov     [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
1134
        mov     [ebx+REG_EFLAGS], dword EFL_IOPL1+EFL_IF
1160
 
1135
 
1161
        mov     eax, [esi+0x0C]  ;app_esp
1136
        mov     eax, [esi+0x0C]  ;app_esp
Line 1162... Line 1137...
1162
        mov     [ebx+REG_APP_ESP], eax;app_stack
1137
        mov     [ebx+REG_APP_ESP], eax;app_stack
1163
        mov     [ebx+REG_SS], dword app_data
1138
        mov     [ebx+REG_SS], dword app_data
1164
 
1139
 
1165
        lea     ecx, [ebx+REG_RET]
1140
        lea     edx, [ebx+REG_RET]
Line 1166... Line 1141...
1166
        mov     ebx, [slot]
1141
        mov     ebx, [slot]
1167
        shl     ebx, 5
1142
        shl     ebx, 5
1168
        mov     [ebx*8+SLOT_BASE+APPDATA.saved_esp], ecx
1143
        mov     [ebx*8+SLOT_BASE+APPDATA.saved_esp], edx
1169
 
1144
 
1170
        xor     ecx, ecx; process state - running
1145
        xor     edx, edx; process state - running
1171
; set if debuggee
1146
; set if debuggee
1172
        test    byte [flags], 1
1147
        test    byte [flags], 1
1173
        jz      .no_debug
1148
        jz      .no_debug
1174
        inc     ecx ; process state - suspended
1149
        inc     edx ; process state - suspended
-
 
1150
        mov     eax, [CURRENT_TASK]
-
 
1151
        mov     [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
1175
        mov     eax, [CURRENT_TASK]
1152
.no_debug:
1176
        mov     [SLOT_BASE+ebx*8+APPDATA.debugger_slot], eax
1153
        mov     [CURRENT_TASK+ebx+TASKDATA.state], dl
1177
.no_debug:
1154
        lea     edx, [SLOT_BASE+ebx*8]
1178
        mov     [CURRENT_TASK+ebx+TASKDATA.state], cl
1155
        call    scheduler_add_thread