Subversion Repositories Kolibri OS

Rev

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

Rev 379 Rev 380
Line 8... Line 8...
8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 9... Line 9...
9
 
9
 
10
idtreg:
10
idtreg:
11
     dw   8*0x41-1
11
     dw   8*0x41-1
12
     dd   idts+8
-
 
Line 13... Line 12...
13
;label idts at 0xB100-8
12
     dd   idts+8
Line 14... Line 13...
14
 
13
 
15
build_process_gdt_tss_pointer:
14
build_process_gdt_tss_pointer:
Line 120... Line 119...
120
 
119
 
121
; test if debugging
120
; test if debugging
122
        cli
121
        cli
123
        mov   eax, [CURRENT_TASK]
122
        mov   eax, [CURRENT_TASK]
124
        shl   eax, 8
123
        shl   eax, 8
125
        mov   eax, [0x80000+eax+APPDATA.debugger_slot]
124
        mov   eax, [SLOT_BASE+eax+APPDATA.debugger_slot]
126
        test  eax, eax
125
        test  eax, eax
127
        jnz   .debug
126
        jnz   .debug
128
        sti
127
        sti
129
; not debuggee => say error and terminate
128
; not debuggee => say error and terminate
Line 580... Line 579...
580
           .slot equ esp   ;locals
579
           .slot equ esp   ;locals
Line 581... Line 580...
581
 
580
 
Line 582... Line 581...
582
           push   esi      ;save .slot
581
           push   esi      ;save .slot
583
 
582
 
584
           shl esi, 8
583
           shl esi, 8
585
           cmp [PROC_BASE+esi+APPDATA.dir_table], 0
584
           cmp [SLOT_BASE+esi+APPDATA.dir_table], 0
586
           jne @F
585
           jne @F
587
           add esp, 4
586
           add esp, 4
588
           ret
587
           ret
Line 599... Line 598...
599
term9:
598
term9:
600
           call  set_application_table_status
599
           call  set_application_table_status
Line 601... Line 600...
601
 
600
 
602
           mov esi, [.slot]
601
           mov esi, [.slot]
603
           shl esi,8
602
           shl esi,8
604
           add esi, PROC_BASE+APP_OBJ_OFFSET
603
           add esi, SLOT_BASE+APP_OBJ_OFFSET
605
@@:
604
@@:
606
           mov eax, [esi+APPOBJ.fd]
605
           mov eax, [esi+APPOBJ.fd]
607
           test eax, eax
606
           test eax, eax
Line 617... Line 616...
617
           pop esi
616
           pop esi
618
           jmp @B
617
           jmp @B
619
@@:
618
@@:
620
           mov eax, [.slot]
619
           mov eax, [.slot]
621
           shl eax, 8
620
           shl eax, 8
622
           mov eax,[PROC_BASE+eax+APPDATA.dir_table]
621
           mov eax,[SLOT_BASE+eax+APPDATA.dir_table]
623
           stdcall destroy_app_space, eax
622
           stdcall destroy_app_space, eax
Line 624... Line 623...
624
 
623
 
625
           mov esi, [.slot]
624
           mov esi, [.slot]
626
           cmp [fpu_owner],esi   ; if user fpu last -> fpu user = 1
625
           cmp [fpu_owner],esi   ; if user fpu last -> fpu user = 1
Line 627... Line 626...
627
           jne @F
626
           jne @F
628
 
627
 
629
           mov [fpu_owner],1
628
           mov [fpu_owner],1
630
           mov eax, [256+PROC_BASE+APPDATA.fpu_state]
629
           mov eax, [256+SLOT_BASE+APPDATA.fpu_state]
631
           clts
630
           clts
632
           bt [cpu_caps], CAPS_SSE
631
           bt [cpu_caps], CAPS_SSE
633
           jnc .no_SSE
632
           jnc .no_SSE
Line 730... Line 729...
730
 
729
 
731
; debuggee test
730
; debuggee test
732
    pushad
731
    pushad
733
    mov  edi, esi
732
    mov  edi, esi
734
    shl  edi, 5
733
    shl  edi, 5
735
    mov  eax, [0x80000+edi*8+APPDATA.debugger_slot]
734
    mov  eax, [SLOT_BASE+edi*8+APPDATA.debugger_slot]
736
    test eax, eax
735
    test eax, eax
737
    jz   .nodebug
736
    jz   .nodebug
738
    push 8
737
    push 8
739
    pop  ecx
738
    pop  ecx
Line 745... Line 744...
745
.nodebug:
744
.nodebug:
746
    popad
745
    popad
Line 747... Line 746...
747
 
746
 
748
           mov ebx, [.slot]
747
           mov ebx, [.slot]
749
           shl ebx, 8
748
           shl ebx, 8
Line 750... Line 749...
750
           mov ebx,[PROC_BASE+ebx+APPDATA.pl0_stack]
749
           mov ebx,[SLOT_BASE+ebx+APPDATA.pl0_stack]
Line 751... Line 750...
751
 
750
 
752
           stdcall kernel_free, ebx
751
           stdcall kernel_free, ebx
753
 
752
 
754
           mov edi, [.slot]
753
           mov edi, [.slot]
755
           shl edi,8
754
           shl edi,8
756
           add edi,0x80000
755
           add edi,SLOT_BASE
757
           mov eax, 0x20202020
756
           mov eax, 0x20202020
758
           stosd
757
           stosd
759
           stosd
758
           stosd
760
           stosd
759
           stosd
Line 761... Line 760...
761
           mov ecx,244/4
760
           mov ecx,244/4
762
           xor eax, eax
761
           xor eax, eax
763
           rep stosd
762
           rep stosd
764
 
763
 
765
  ; activate window
764
  ; activate window
766
        movzx  eax, word [0xC000 + esi*2]
765
        movzx  eax, word [WIN_STACK + esi*2]
767
        cmp    eax, [TASK_COUNT]
766
        cmp    eax, [TASK_COUNT]
768
        jne    .dont_activate
767
        jne    .dont_activate
769
        pushad
768
        pushad
770
 .check_next_window:
769
 .check_next_window:
771
        dec    eax
770
        dec    eax
772
        cmp    eax, 1
771
        cmp    eax, 1
773
        jbe    .nothing_to_activate
772
        jbe    .nothing_to_activate
774
        lea    esi, [0xc400+eax*2]
773
        lea    esi, [WIN_POS+eax*2]
775
        movzx  edi, word [esi]               ; edi = process
774
        movzx  edi, word [esi]               ; edi = process
Line 868... Line 867...
868
    mov  edi,esi         ; do not run this process slot
867
    mov  edi,esi         ; do not run this process slot
869
    shl  edi, 5
868
    shl  edi, 5
870
    mov  [edi+CURRENT_TASK + TASKDATA.state],byte 9
869
    mov  [edi+CURRENT_TASK + TASKDATA.state],byte 9
871
; debugger test - terminate all debuggees
870
; debugger test - terminate all debuggees
872
    mov  eax, 2
871
    mov  eax, 2
873
    mov  ecx, 0x80000+2*0x100+APPDATA.debugger_slot
872
    mov  ecx, SLOT_BASE+2*0x100+APPDATA.debugger_slot
874
.xd0:
873
.xd0:
875
    cmp  eax, [TASK_COUNT]
874
    cmp  eax, [TASK_COUNT]
876
    ja   .xd1
875
    ja   .xd1
877
    cmp  dword [ecx], esi
876
    cmp  dword [ecx], esi
878
    jnz  @f
877
    jnz  @f