Subversion Repositories Kolibri OS

Rev

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

Rev 33 Rev 40
Line 162... Line 162...
162
    times 16 dd unknown_interrupt
162
    times 16 dd unknown_interrupt
Line 163... Line 163...
163
 
163
 
164
    dd   i40
164
    dd   i40
Line -... Line 165...
-
 
165
endg
-
 
166
 
-
 
167
macro save_ring3_context
-
 
168
{
-
 
169
	push	ds es
-
 
170
	pushad
-
 
171
}
-
 
172
macro restore_ring3_context
-
 
173
{
-
 
174
	popad
-
 
175
	pop	es ds
165
endg
176
}
166
 
177
 
167
; simply return control to interrupted process
178
; simply return control to interrupted process
Line 168... Line 179...
168
unknown_interrupt:
179
unknown_interrupt:
169
     iret
180
     iret
170
 
181
 
171
macro exc_wo_code [num]
182
macro exc_wo_code [num]
-
 
183
{
172
{
184
  forward
173
  forward
185
  e#num :
174
  e#num :
186
      save_ring3_context
Line 175... Line 187...
175
      mov bl, num
187
      mov bl, num
176
      jmp exc_c
188
      jmp exc_c
177
}
189
}
178
 
190
 
179
macro exc_w_code [num]
191
macro exc_w_code [num]
-
 
192
{
180
{
193
  forward
181
  forward
194
  e#num :
182
  e#num :
195
      add esp, 4
Line 183... Line 196...
183
      add esp, 4
196
      save_ring3_context
Line 191... Line 204...
191
exc_c:
204
exc_c:
192
        mov   ax, os_data
205
        mov   ax, os_data
193
        mov   ds, ax
206
        mov   ds, ax
194
        mov   es, ax
207
        mov   es, ax
Line -... Line 208...
-
 
208
 
-
 
209
; test if debugging
-
 
210
        cli
-
 
211
        mov   eax, [0x3000]
-
 
212
        shl   eax, 8
-
 
213
        mov   eax, [0x80000+eax+0xAC]
-
 
214
        test  eax, eax
-
 
215
        jnz   .debug
-
 
216
        sti
-
 
217
; not debuggee => say error and terminate
195
 
218
        add   esp, 28h
196
        movzx eax, bl        
219
        movzx eax, bl        
197
        mov   [error_interrupt], eax
220
        mov   [error_interrupt], eax
Line 198... Line 221...
198
        call  show_error_parameters
221
        call  show_error_parameters
199
        
222
        
Line 200... Line 223...
200
        mov   edx, [0x3010]
223
        mov   edx, [0x3010]
Line -... Line 224...
-
 
224
        mov   [edx + 0xA], byte 4
-
 
225
        
-
 
226
        jmp   change_task
-
 
227
 
-
 
228
.debug:
-
 
229
; we are debugged process, notify debugger and suspend ourself
-
 
230
; eax=debugger PID
-
 
231
        movzx ecx, bl
-
 
232
        push  ecx
-
 
233
        mov   ecx, [0x3010]
-
 
234
        push  dword [ecx+4]	; PID of current process
-
 
235
        push  12
-
 
236
        pop   ecx
-
 
237
        push  1		; 1=exception
-
 
238
        call  debugger_notify
-
 
239
        pop   ecx
-
 
240
        pop   ecx
-
 
241
        pop   ecx
-
 
242
        mov   edx, [0x3010]
Line 201... Line 243...
201
        mov   [edx + 0xA], byte 4
243
        mov   byte [edx+0xA], 1		; suspended
202
        
244
        call  change_task
203
        jmp   change_task
245
        restore_ring3_context
Line 204... Line 246...
204
 
246
        iretd
205
 
247
 
-
 
248
;;;;;;;;;;;;;;;;;;;;;;;
206
;;;;;;;;;;;;;;;;;;;;;;;
249
;; FPU ERROR HANDLER ;;
207
;; FPU ERROR HANDLER ;;
-
 
208
;;;;;;;;;;;;;;;;;;;;;;;
-
 
209
 
-
 
210
align 4
-
 
211
e7:
250
;;;;;;;;;;;;;;;;;;;;;;;
212
        clts
251
 
213
          
252
align 4
Line 214... Line 253...
214
        push  eax
253
e7:
Line 230... Line 269...
230
        cmp   [eax + 0x7f], byte 0
269
        cmp   [eax + 0x7f], byte 0
231
        je    @f
270
        je    @f
232
        frstor [eax+0x10]
271
        frstor [eax+0x10]
233
     @@:
272
     @@:
234
        mov   [eax + 0x7f], byte 1
273
        mov   [eax + 0x7f], byte 1
235
        
-
 
236
        pop   es ds
-
 
237
        pop   eax
274
        restore_ring3_context
238
        
-
 
239
        iret
275
        iret
Line 240... Line 276...
240
        
276
        
241
iglobal
277
iglobal
242
  prev_user_of_fpu dd 1
278
  prev_user_of_fpu dd 1
Line 318... Line 354...
318
 
354
 
319
macro irqh [num]
355
macro irqh [num]
320
{
356
{
321
  forward
357
  forward
322
  p_irq#num :
358
  p_irq#num :
323
     pushad
359
     save_ring3_context
324
     mov   edi, num
360
     mov   edi, num
325
     jmp   irq_c
361
     jmp   irq_c
Line 326... Line 362...
326
}
362
}
Line 327... Line 363...
327
 
363
 
328
irqh 2,5,7,8,9,10,11,14,15
-
 
329
 
364
irqh 2,5,7,8,9,10,11,14,15
330
 irq_c:
365
 
331
     push  ds es
366
 irq_c:
332
     mov   ax, os_data
367
     mov   ax, os_data
333
     mov   ds, ax
368
     mov   ds, ax
334
     mov   es, ax
-
 
335
     call  irqhandler
369
     mov   es, ax
Line 336... Line 370...
336
     pop   es ds
370
     call  irqhandler
337
     popad
-
 
338
     iret
371
     restore_ring3_context
339
 
372
     iret
340
p_irq6:
373
 
341
     pushad
374
p_irq6:
342
     push  ds es
375
     save_ring3_context
343
     mov   ax, os_data
376
     mov   ax, os_data
344
     mov   ds, ax
377
     mov   ds, ax
345
     mov   es, ax
-
 
346
     call  fdc_irq
378
     mov   es, ax
Line 347... Line 379...
347
     call  ready_for_next_irq
379
     call  fdc_irq
348
     pop   es ds
-
 
349
     popad
380
     call  ready_for_next_irq
350
     iret
381
     restore_ring3_context
351
 
382
     iret
352
p_irq3:
383
 
353
     pushad
384
p_irq3:
354
     push  ds es
385
     save_ring3_context
355
     mov   ax, os_data
-
 
356
     mov   ds, ax
386
     mov   ax, os_data
Line 357... Line 387...
357
     mov   es, ax
387
     mov   ds, ax
358
     call  check_mouse_data_com2
-
 
359
     pop   es ds
388
     mov   es, ax
360
     popad
389
     call  check_mouse_data_com2
361
     iret
390
     restore_ring3_context
362
 
391
     iret
363
p_irq4:
392
 
364
     pushad
393
p_irq4:
365
     push  ds es
-
 
366
     mov   ax, os_data
394
     save_ring3_context
Line 367... Line 395...
367
     mov   ds, ax
395
     mov   ax, os_data
368
     mov   es, ax
-
 
369
     call  check_mouse_data_com1
396
     mov   ds, ax
370
     pop   es ds
397
     mov   es, ax
371
     popad
398
     call  check_mouse_data_com1
372
     iret
399
     restore_ring3_context
373
 
400
     iret
374
p_irq12:
401
 
375
     pushad
-
 
376
     push  ds es
402
p_irq12:
Line 377... Line 403...
377
     mov   ax, os_data
403
     save_ring3_context
378
     mov   ds, ax
404
     mov   ax, os_data
379
     mov   es, ax
405
     mov   ds, ax
Line 394... Line 420...
394
     out    0xa0,al
420
     out    0xa0,al
395
     out   0x20, al
421
     out   0x20, al
396
     ret
422
     ret
Line 397... Line 423...
397
 
423
 
398
irqD:
-
 
399
     pushad
424
irqD:
400
     push  ds es
425
     save_ring3_context
401
     mov   ax, os_data
426
     mov   ax, os_data
402
     mov   ds, ax
427
     mov   ds, ax
Line 403... Line 428...
403
     mov   es, ax
428
     mov   es, ax
Line 410... Line 435...
410
     mov   al,0x20
435
     mov   al,0x20
411
     out   dx,al
436
     out   dx,al
412
     mov   dx,0x20
437
     mov   dx,0x20
413
     out   dx,al     
438
     out   dx,al
Line 414... Line 439...
414
     
439
 
415
     pop   es ds
440
     restore_ring3_context
416
     popad
441
     
Line 417... Line 442...
417
     iret
442
     iret
Line 648... Line 673...
648
    push   esi
673
    push   esi
649
    mov    esi,process_terminating
674
    mov    esi,process_terminating
650
    call   sys_msg_board_str
675
    call   sys_msg_board_str
651
    pop    esi
676
    pop    esi
Line -... Line 677...
-
 
677
 
652
 
678
@@:
653
    cli
679
    cli
654
    cmp   [application_table_status],0
680
    cmp   [application_table_status],0
655
    je    term9
681
    je    term9
656
    sti
682
    sti
657
    call  change_task
683
    call  change_task
658
    jmp   terminate
684
    jmp   @b
Line 659... Line 685...
659
  term9:
685
  term9:
Line 660... Line 686...
660
 
686
 
Line 750... Line 776...
750
    xor   eax, eax
776
    xor   eax, eax
751
  ;  cld
777
  ;  cld
752
    rep   stosd
778
    rep   stosd
753
    popa
779
    popa
Line -... Line 780...
-
 
780
 
-
 
781
; debuggee test
-
 
782
    pushad
-
 
783
    mov  edi, esi
-
 
784
    shl  edi, 5
-
 
785
    mov  eax, [0x80000+edi*8+0xAC]
-
 
786
    test eax, eax
-
 
787
    jz   .nodebug
-
 
788
    push 8
-
 
789
    pop  ecx
-
 
790
    push dword [0x3000+edi+0x4]   ; PID
-
 
791
    push 2
-
 
792
    call debugger_notify
-
 
793
    pop  ecx
-
 
794
    pop  ecx
-
 
795
.nodebug:
-
 
796
    popad
754
 
797
 
755
    pusha         ; at 0x80000+
798
    pusha         ; at 0x80000+
756
    mov   edi,esi
799
    mov   edi,esi
757
    shl   edi,8
800
    shl   edi,8
758
    add   edi,0x80000
801
    add   edi,0x80000
Line 861... Line 904...
861
 
904
 
862
    popa
905
    popa
863
    mov  edi,esi         ; do not run this process slot
906
    mov  edi,esi         ; do not run this process slot
864
    shl  edi, 5
907
    shl  edi, 5
-
 
908
    mov  [edi+0x300A],byte 9
-
 
909
; debugger test - terminate all debuggees
-
 
910
    mov  eax, 2
-
 
911
    mov  ecx, 0x80000+2*0x100+0xAC
-
 
912
.xd0:
-
 
913
    cmp  eax, [0x3004]
-
 
914
    ja   .xd1
-
 
915
    cmp  dword [ecx], esi
-
 
916
    jnz  @f
-
 
917
    and  dword [ecx], 0
-
 
918
    pushad
-
 
919
    xchg eax, ebx
-
 
920
    mov  eax, 2
-
 
921
    call sys_system
-
 
922
    popad
-
 
923
@@:
-
 
924
    inc  eax
-
 
925
    add  ecx, 0x100
-
 
926
    jmp  .xd0
865
    mov  [edi+0x300A],byte 9
927
.xd1:
866
;    call  systest
928
;    call  systest
Line 867... Line 929...
867
    sti  ; .. and life goes on
929
    sti  ; .. and life goes on
868
 
930