Subversion Repositories Kolibri OS

Rev

Rev 9692 | Rev 9715 | 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 $
9
 
9
 
10
align 4 ;3A08
10
align 4 ;3A08
11
build_interrupt_table:
11
build_interrupt_table:
Line 148... Line 148...
148
        cli
148
        cli
149
        mov     eax, [esi+APPDATA.debugger_slot]
149
        mov     eax, [esi+APPDATA.debugger_slot]
150
        test    eax, eax
150
        test    eax, eax
151
        jnz     .debug
151
        jnz     .debug
152
; not debuggee => say error and terminate
152
; not debuggee => say error and terminate
153
        call    show_error_parameters
153
        call    show_error_parameters  ; this function output in edx = current_slot
154
        sti
154
        sti
155
        mov     [edx + TASKDATA.state], TSTATE_TERMINATING
155
        mov     [edx + APPDATA.state], TSTATE_TERMINATING
156
        call    wakeup_osloop
156
        call    wakeup_osloop
157
        call    change_task
157
        call    change_task
158
; If we're here, then the main OS thread has crashed before initializing IDLE thread.
158
; If we're here, then the main OS thread has crashed before initializing IDLE thread.
159
; Or they both have crashed. Anyway, things are hopelessly broken.
159
; Or they both have crashed. Anyway, things are hopelessly broken.
160
        hlt
160
        hlt
Line 184... Line 184...
184
        push    [ebx + APPDATA.tid] ; PID
184
        push    [ebx + APPDATA.tid] ; PID
185
        push    ecx             ; debug_message code ((here: ecx==1/3))
185
        push    ecx             ; debug_message code ((here: ecx==1/3))
186
        mov     cl, 12          ; debug_message size
186
        mov     cl, 12          ; debug_message size
187
        call    debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
187
        call    debugger_notify ;; only ONE using, inline ??? SEE: core/debug.inc
188
        add     esp, 12
188
        add     esp, 12
189
        mov     edx, [TASK_BASE]
189
        mov     edx, [current_slot]
190
        mov     [edx+TASKDATA.state], TSTATE_RUN_SUSPENDED
190
        mov     [edx + APPDATA.state], TSTATE_RUN_SUSPENDED
191
        call    change_task     ; SEE: core/shed.inc
191
        call    change_task     ; SEE: core/shed.inc
192
        restore_ring3_context
192
        restore_ring3_context
193
        iretd
193
        iretd
Line 194... Line 194...
194
 
194
 
Line 286... Line 286...
286
        add     ebx, 4
286
        add     ebx, 4
287
        call    .check_ESP
287
        call    .check_ESP
288
        test    eax, eax
288
        test    eax, eax
289
        jnz     .error_ESP
289
        jnz     .error_ESP
290
        DEBUGF  1, " [ESP+32]: %x\n",[ebx]
290
        DEBUGF  1, " [ESP+32]: %x\n",[ebx]
-
 
291
;for input instruction
-
 
292
        mov     ebx, [reg_eip+4]
-
 
293
        call    .check_ESP
-
 
294
        test    eax, eax
-
 
295
        jnz     .error_ESP
-
 
296
        DEBUGF  1, "K : [EIP]: %x",[ebx]
-
 
297
        add     ebx, 4
-
 
298
        call    .check_ESP
-
 
299
        test    eax, eax
-
 
300
        jnz     .error_ESP
-
 
301
        DEBUGF  1, " [EIP+4]: %x",[ebx]
-
 
302
        add     ebx, 4
-
 
303
        call    .check_ESP
-
 
304
        test    eax, eax
-
 
305
        jnz     .error_ESP
-
 
306
        DEBUGF  1, " [EIP+8]: %x\n",[ebx]
-
 
307
        add     ebx, 4
-
 
308
        call    .check_ESP
-
 
309
        test    eax, eax
-
 
310
        jnz     .error_ESP
-
 
311
        DEBUGF  1, "K : [EIP+12]: %x\n",[ebx]
291
        pop     edx ecx ebx eax
312
        pop     edx ecx ebx eax
292
        ret
313
        ret
293
.error_ESP:
314
.error_ESP:
294
        pop     edx ecx ebx eax
315
        pop     edx ecx ebx eax
295
        DEBUGF  1, "\n"
316
        DEBUGF  1, "\n"
Line 410... Line 431...
410
        .process  equ esp               ;ptr to parent process
431
        .process  equ esp               ;ptr to parent process
Line 411... Line 432...
411
 
432
 
Line 412... Line 433...
412
 
433
 
413
        push    esi        ;save .slot
434
        push    esi        ;save .slot
414
 
435
 
415
        shl     esi, 8
436
        shl     esi, BSF sizeof.APPDATA
-
 
437
        mov     edx, [SLOT_BASE+esi+APPDATA.process]
416
        mov     edx, [SLOT_BASE+esi+APPDATA.process]
438
        test    edx, edx
417
        test    edx, edx
-
 
418
        jnz     @F
-
 
419
        pop     esi
439
        jnz     @F
420
        shl     esi, BSF sizeof.TASKDATA
440
        mov     [SLOT_BASE + esi + APPDATA.state], TSTATE_FREE
421
        mov     [TASK_TABLE+esi+TASKDATA.state], TSTATE_FREE
441
        pop     esi
422
        ret
442
        ret
423
@@:
443
@@:
424
        push    edx                     ;save .process
444
        push    edx                     ;save .process
Line 425... Line 445...
425
        lea     edx, [SLOT_BASE+esi]
445
        lea     edx, [SLOT_BASE+esi]
426
        call    scheduler_remove_thread
446
        call    scheduler_remove_thread
427
        call    lock_application_table
447
        call    lock_application_table
428
 
448
 
429
; if the process is in V86 mode...
449
; if the process is in V86 mode...
430
        mov     eax, [.slot]
450
        mov     eax, [.slot]
431
        shl     eax, 8
451
        shl     eax, BSF sizeof.APPDATA
432
        mov     esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
452
        mov     esi, [eax+SLOT_BASE+APPDATA.pl0_stack]
Line 443... Line 463...
443
        mov     ecx, [esi+8]
463
        mov     ecx, [esi+8]
444
        mov     [eax+SLOT_BASE+APPDATA.io_map+4], ecx
464
        mov     [eax+SLOT_BASE+APPDATA.io_map+4], ecx
445
.nov86:
465
.nov86:
446
; destroy per-thread kernel objects
466
; destroy per-thread kernel objects
447
        mov     esi, [.slot]
467
        mov     esi, [.slot]
448
        shl     esi, 8
468
        shl     esi, BSF sizeof.APPDATA
449
        add     esi, SLOT_BASE+APP_OBJ_OFFSET
469
        add     esi, SLOT_BASE+APP_OBJ_OFFSET
450
@@:
470
@@:
451
        mov     eax, [esi+APPOBJ.fd]
471
        mov     eax, [esi+APPOBJ.fd]
452
        test    eax, eax
472
        test    eax, eax
453
        jz      @F
473
        jz      @F
Line 589... Line 609...
589
        pop     ecx
609
        pop     ecx
590
.nodebug:
610
.nodebug:
591
        popad
611
        popad
Line 592... Line 612...
592
 
612
 
593
        mov     ebx, [.slot]
613
        mov     ebx, [.slot]
594
        shl     ebx, 8
614
        shl     ebx, BSF sizeof.APPDATA
595
        push    ebx
615
        push    ebx
Line 596... Line 616...
596
        mov     ebx, [SLOT_BASE+ebx+APPDATA.pl0_stack]
616
        mov     ebx, [SLOT_BASE+ebx+APPDATA.pl0_stack]
Line 597... Line 617...
597
 
617
 
598
        stdcall kernel_free, ebx
618
        stdcall kernel_free, ebx
599
 
619
 
Line 600... Line 620...
600
        pop     ebx
620
        pop     ebx
601
        mov     ebx, [SLOT_BASE+ebx+APPDATA.cur_dir]
621
        mov     ebx, [SLOT_BASE+ebx+APPDATA.cur_dir]
602
        stdcall kernel_free, ebx
622
        stdcall kernel_free, ebx
Line 603... Line 623...
603
 
623
 
604
        mov     edi, [.slot]
624
        mov     edi, [.slot]
605
        shl     edi, 8
625
        shl     edi, BSF sizeof.APPDATA
Line 635... Line 655...
635
        dec     eax
655
        dec     eax
636
        cmp     eax, 1
656
        cmp     eax, 1
637
        jbe     .nothing_to_activate
657
        jbe     .nothing_to_activate
638
        lea     esi, [WIN_POS+eax*2]
658
        lea     esi, [WIN_POS+eax*2]
639
        movzx   edi, word [esi]              ; edi = process
659
        movzx   edi, word [esi]              ; edi = process
640
        shl     edi, BSF sizeof.TASKDATA
660
        shl     edi, BSF sizeof.APPDATA
641
        cmp     [TASK_TABLE + edi + TASKDATA.state], TSTATE_FREE ; skip free slots
661
        cmp     [SLOT_BASE + edi + APPDATA.state], TSTATE_FREE ; skip free slots
642
        je      .check_next_window
662
        je      .check_next_window
-
 
663
        shr     edi, 3
643
        add     edi, window_data
664
        add     edi, window_data
644
; \begin{diamond}[19.09.2006]
665
; \begin{diamond}[19.09.2006]
645
; skip minimized windows
666
; skip minimized windows
646
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
667
        test    [edi + WDATA.fl_wstate], WSTATE_MINIMIZED
647
        jnz     .check_next_window
668
        jnz     .check_next_window
Line 709... Line 730...
709
 
730
 
Line 710... Line 731...
710
  rmpr9:
731
  rmpr9:
711
 
732
 
712
        popa
733
        popa
713
        mov     edi, esi ; do not run this process slot
734
        mov     edi, esi ; do not run this process slot
714
        shl     edi, BSF sizeof.TASKDATA
735
        shl     edi, BSF sizeof.APPDATA
715
        mov     [edi+TASK_TABLE + TASKDATA.state], TSTATE_FREE
736
        mov     [edi + SLOT_BASE + APPDATA.state], TSTATE_FREE
716
; debugger test - terminate all debuggees
737
; debugger test - terminate all debuggees
717
        mov     eax, 2
738
        mov     eax, 2
718
        mov     ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot
739
        mov     ecx, SLOT_BASE+2*sizeof.APPDATA + APPDATA.debugger_slot