Subversion Repositories Kolibri OS

Rev

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

Rev 2010 Rev 2106
Line 9... Line 9...
9
;;  Distributed under GPL. See file COPYING for details.        ;;
9
;;  Distributed under GPL. See file COPYING for details.        ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
10
;;  Copyright 2003 Ville Turjanmaa                              ;;
11
;;                                                              ;;
11
;;                                                              ;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 2010 $
14
$Revision: 2106 $
15
 
15
 
16
 
16
 
Line 39... Line 39...
39
        times   12 dd unknown_interrupt ;int_20..int_31
39
        times   12 dd unknown_interrupt ;int_20..int_31
Line 40... Line 40...
40
 
40
 
41
    ;interrupt handlers addresses (for interrupt gate construction)
41
    ;interrupt handlers addresses (for interrupt gate construction)
42
	; 0x20 .. 0x2F - IRQ handlers
42
	; 0x20 .. 0x2F - IRQ handlers
43
        dd      irq0, irq_serv.irq_1, irq_serv.irq_2
-
 
44
    if  USE_COM_IRQ
43
        dd      irq0, irq_serv.irq_1, irq_serv.irq_2
45
        dd      irq_serv.irq_3, irq_serv.irq_4
-
 
46
    else
-
 
47
        dd      p_irq3, p_irq4 ;??? íåñòûêîâêà
-
 
48
    end if
44
        dd      irq_serv.irq_3, irq_serv.irq_4
49
        dd      irq_serv.irq_5,  irq_serv.irq_6,  irq_serv.irq_7
45
        dd      irq_serv.irq_5,  irq_serv.irq_6,  irq_serv.irq_7
50
        dd      irq_serv.irq_8,  irq_serv.irq_9,  irq_serv.irq_10
46
        dd      irq_serv.irq_8,  irq_serv.irq_9,  irq_serv.irq_10
51
        dd      irq_serv.irq_11, irq_serv.irq_12, irqD, irq_serv.irq_14, irq_serv.irq_15
-
 
52
	; I don`t known how to use IRQ_RESERVE
-
 
53
if IRQ_RESERVE > 16
47
        dd      irq_serv.irq_11, irq_serv.irq_12, irqD, irq_serv.irq_14, irq_serv.irq_15
54
	dd irq_serv.irq_16
48
	dd irq_serv.irq_16
55
	dd irq_serv.irq_17
49
	dd irq_serv.irq_17
56
	dd irq_serv.irq_18
50
	dd irq_serv.irq_18
57
	dd irq_serv.irq_19
51
	dd irq_serv.irq_19
58
	dd irq_serv.irq_20
52
	dd irq_serv.irq_20
59
	dd irq_serv.irq_21
53
	dd irq_serv.irq_21
60
	dd irq_serv.irq_22
54
	dd irq_serv.irq_22
61
	dd irq_serv.irq_23
-
 
Line 62... Line 55...
62
end if
55
	dd irq_serv.irq_23
63
 
56
 
64
	times 32 - IRQ_RESERVE dd unknown_interrupt
57
	times 32 - IRQ_RESERVE dd unknown_interrupt
Line 249... Line 242...
249
  restore  reg_esp0
242
  restore  reg_esp0
250
  restore  reg_ebp
243
  restore  reg_ebp
251
  restore  reg_esi
244
  restore  reg_esi
252
  restore  reg_edi
245
  restore  reg_edi
Line 253... Line -...
253
 
-
 
254
; IRQ runtime
-
 
255
 
-
 
256
; irq1  ->  hid/keyboard.inc
-
 
257
macro irqh [num] {
-
 
258
  p_irq#num :
-
 
259
        mov     edi, num
-
 
260
        jmp     irqhandler
-
 
261
}
-
 
262
 
-
 
263
irqh 2,3,4,5,7,8,9,10,11
-
 
264
; I don`t known how to use IRQ_RESERVE
-
 
265
if IRQ_RESERVE > 16
-
 
266
irqh 16, 17, 18, 19, 20, 21, 22, 23
-
 
267
end if
-
 
268
 
-
 
269
p_irq6:	; FDC
-
 
270
        save_ring3_context
-
 
271
        mov     ax, app_data  ;os_data
-
 
272
        mov     ds, ax
-
 
273
        mov     es, ax
-
 
274
        mov     edi, 6
-
 
275
        cmp     [v86_irqhooks+edi*8], 0
-
 
276
        jnz     v86_irq2
-
 
277
        call    fdc_irq
-
 
278
	mov	[check_idle_semaphore], 5
-
 
279
	mov	al, 6
-
 
280
	call	IRQ_EOI
-
 
281
        restore_ring3_context
-
 
282
        iret
-
 
283
 
-
 
284
irq13:	; Math coprocessor
-
 
285
	save_ring3_context
-
 
286
	mov	ax, app_data  ;os_data
-
 
287
	mov	ds, ax
-
 
288
	mov	es, ax
-
 
289
 
-
 
290
	mov	dx, 0xf0
-
 
291
	mov	al, 0
-
 
292
	out	dx, al
-
 
293
 
-
 
294
	mov	al, 13
-
 
295
	call	IRQ_EOI
-
 
296
	restore_ring3_context
-
 
297
	iret
-
 
298
 
-
 
299
p_irq14: ; HDD
-
 
300
        save_ring3_context
-
 
301
        mov     ax, app_data  ;os_data
-
 
302
        mov     ds, ax
-
 
303
        mov     es, ax
-
 
304
        mov     edi, 14
-
 
305
        cmp     [v86_irqhooks+edi*8], 0
-
 
306
        jnz     v86_irq2
-
 
307
;       mov     byte [BOOT_VAR + 0x48E], 0xFF
-
 
308
        call    [irq14_func]
-
 
309
	mov	[check_idle_semaphore], 5
-
 
310
	mov	al, 14
-
 
311
	call	IRQ_EOI
-
 
312
        restore_ring3_context
-
 
313
        iret
-
 
314
 
-
 
315
p_irq15: ; HDD2
-
 
316
        save_ring3_context
-
 
317
        mov     ax, app_data  ;os_data
-
 
318
        mov     ds, ax
-
 
319
        mov     es, ax
-
 
320
        mov     edi, 15
-
 
321
        cmp     [v86_irqhooks+edi*8], 0
-
 
322
        jnz     v86_irq2
-
 
323
;       mov     byte [BOOT_VAR + 0x48E], 0xFF
-
 
324
        call    [irq15_func]
-
 
325
	mov	[check_idle_semaphore], 5
-
 
326
	mov	al, 15
-
 
327
	call	IRQ_EOI
-
 
328
        restore_ring3_context
-
 
329
        iret
-
 
330
 
-
 
331
ready_for_next_irq:
-
 
332
	mov	eax,5
-
 
333
        mov     [check_idle_semaphore],eax
-
 
334
;        mov     al, 0x20
-
 
335
	add 	eax,(0x20-0x5)
-
 
336
 
-
 
337
        out     0x20, al
-
 
338
        ret
-
 
339
;destroy eax
-
 
340
ready_for_next_irq_1:
-
 
341
	mov	eax,5
-
 
342
        mov     [check_idle_semaphore],eax
-
 
343
;        mov     al, 0x20
-
 
344
	add 	eax,(0x20-0x5)
-
 
345
        out     0xa0,al
-
 
346
        out     0x20, al
-
 
Line -... Line 246...
-
 
246
 
347
        ret
247
 
348
 
248
align 4
349
irqD:
249
irqD:
350
        push  eax
250
        push  eax
351
	xor   eax,eax
251
	xor   eax,eax
Line 356... Line 256...
356
        pop   eax
256
        pop   eax
357
        iret
257
        iret
Line 358... Line 258...
358
 
258
 
359
 
-
 
360
align 4
-
 
361
 
-
 
362
irqhandler:
-
 
363
 
-
 
364
     mov    esi,edi          ; 1
-
 
365
     shl    esi,6            ; 1
-
 
366
     add    esi,irq00read    ; 1
-
 
367
     shl    edi,12           ; 1
-
 
368
     add    edi,IRQ_SAVE
-
 
369
     mov    ecx,16
-
 
370
 
-
 
371
   irqnewread:
-
 
372
     dec    ecx
-
 
373
     js     irqover
-
 
374
 
-
 
375
     movzx  edx, word [esi]        ; 2+
-
 
376
 
-
 
377
     test   edx, edx               ; 1
-
 
378
     jz     irqover
-
 
379
 
-
 
380
 
-
 
381
     mov    ebx, [edi]             ; address of begin of buffer in edi      ; + 0x0 dword - data size
-
 
382
     mov    eax, 4000                                                       ; + 0x4 dword - data begin offset
-
 
383
     cmp    ebx, eax
-
 
384
     je     irqfull
-
 
385
     add    ebx, [edi + 0x4]       ; add data size to data begin offset
-
 
386
     cmp    ebx, eax               ; if end of buffer, begin cycle again
-
 
387
     jb     @f
-
 
388
 
-
 
389
     xor    ebx, ebx
-
 
390
 
-
 
391
  @@:
-
 
392
     add    ebx, edi
-
 
393
     movzx  eax, byte[esi + 3]     ; get type of data being received 1 - byte, 2 - word
-
 
394
     dec    eax
-
 
395
     jz     irqbyte
-
 
396
     dec    eax
-
 
397
     jnz    noirqword
-
 
398
 
-
 
399
     in     ax,dx
-
 
400
     cmp    ebx, 3999              ; check for address odd in the end of buffer
-
 
401
     jne    .odd
-
 
402
     mov    [ebx + 0x10], ax
-
 
403
     jmp    .add_size
-
 
404
  .odd:
-
 
405
     mov    [ebx + 0x10], al       ; I could make mistake here :)
-
 
406
     mov    [edi + 0x10], ah
-
 
407
  .add_size:
-
 
408
     add    dword [edi], 2
-
 
409
     jmp    nextport
-
 
410
 
-
 
411
 
-
 
412
  irqbyte:
-
 
413
     in     al,dx
-
 
414
     mov    [ebx + 0x10],al
-
 
415
     inc    dword [edi]
-
 
416
  nextport:
-
 
417
     add    esi,4
-
 
418
     jmp    irqnewread
-
 
419
 
-
 
420
 
-
 
421
   noirqword:
-
 
422
   irqfull:
-
 
423
   irqover:
-
 
424
 
-
 
425
     ret
-
 
426
 
-
 
427
 
259
 
428
 
260
align 4
Line 429... Line 261...
429
set_application_table_status:
261
set_application_table_status:
430
        push eax
262
        push eax
Line 438... Line 270...
438
 
270
 
Line 439... Line 271...
439
        pop  eax
271
        pop  eax
Line 440... Line 272...
440
 
272
 
441
        ret
273
        ret
442
 
274
 
Line 443... Line 275...
443
 
275
align 4
444
clear_application_table_status:
276
clear_application_table_status:
Line 464... Line 296...
464
;  * ecx = íîâûé ðàçìåð ïàìÿòè
296
;  * ecx = íîâûé ðàçìåð ïàìÿòè
465
;Âîçâðàùàåìîå çíà÷åíèå:
297
;Âîçâðàùàåìîå çíà÷åíèå:
466
;  * eax = 0 - óñïåøíî
298
;  * eax = 0 - óñïåøíî
467
;  * eax = 1 - íåäîñòàòî÷íî ïàìÿòè
299
;  * eax = 1 - íåäîñòàòî÷íî ïàìÿòè
Line -... Line 300...
-
 
300
 
468
 
301
align 4
469
sys_resize_app_memory:
302
sys_resize_app_memory:
470
        ; ebx = 1 - resize
303
        ; ebx = 1 - resize
Line 471... Line 304...
471
        ; ecx = new amount of memory
304
        ; ecx = new amount of memory
Line 485... Line 318...
485
endg
318
endg
Line 486... Line 319...
486
 
319
 
487
; param
320
; param
Line -... Line 321...
-
 
321
;  esi= slot
488
;  esi= slot
322
 
Line 489... Line 323...
489
 
323
align 4
Line 490... Line 324...
490
terminate: ; terminate application
324
terminate: ; terminate application
Line 756... Line 590...
756
        jnz     @f
590
        jnz     @f
757
        and     [bgrlockpid], 0
591
        and     [bgrlockpid], 0
758
        and     [bgrlock], 0
592
        and     [bgrlock], 0
759
@@:
593
@@:
Line 760... Line -...
760
 
-
 
761
    pusha ; remove all irq reservations
-
 
762
    mov   eax,esi
-
 
763
    shl   eax, 5
-
 
764
    mov   eax,[eax+CURRENT_TASK+TASKDATA.pid]
-
 
765
    mov   edi,irq_owner
-
 
766
    xor   ebx, ebx
-
 
767
    xor   edx, edx
-
 
768
  newirqfree:
-
 
769
    cmp   [edi + 4 * ebx], eax
-
 
770
    jne   nofreeirq
-
 
771
    mov   [edi + 4 * ebx], edx                          ; remove irq reservation
-
 
772
    mov   [irq_tab + 4 * ebx], edx                      ; remove irq handler
-
 
773
    mov   [irq_rights + 4 * ebx], edx                   ; set access rights to full access
-
 
774
  nofreeirq:
-
 
775
    inc   ebx
-
 
776
    cmp   ebx, 16
-
 
777
    jb    newirqfree
-
 
778
    popa
-
 
779
 
594
 
780
    pusha                     ; remove all port reservations
595
    pusha                     ; remove all port reservations
781
    mov   edx,esi
596
    mov   edx,esi
782
    shl   edx, 5
597
    shl   edx, 5
783
    add   edx,CURRENT_TASK
598
    add   edx,CURRENT_TASK