Subversion Repositories Kolibri OS

Rev

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

Rev 1989 Rev 2089
Line 66... Line 66...
66
;;
66
;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 68... Line 68...
68
 
68
 
Line 69... Line 69...
69
include 'macros.inc'
69
include 'macros.inc'
Line 70... Line 70...
70
 
70
 
Line 71... Line 71...
71
$Revision: 1989 $
71
$Revision: 2089 $
Line 1019... Line 1019...
1019
        sti
1019
        sti
1020
        call change_task
1020
        call change_task
Line 1021... Line 1021...
1021
 
1021
 
Line 1022... Line -...
1022
        jmp osloop
-
 
Line 1023... Line 1022...
1023
 
1022
        jmp osloop
Line 1024... Line 1023...
1024
;        jmp   $                      ; wait here for timer to take control
1023
 
1025
 
1024
 
Line 1119... Line 1118...
1119
;                                                                      ;
1118
;                                                                      ;
1120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1119
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 1121... Line 1120...
1121
 
1120
 
Line 1122... Line -...
1122
reserve_irqs_ports:
-
 
1123
 
-
 
1124
        push eax
-
 
1125
        xor	eax,eax
-
 
1126
		inc	eax
-
 
1127
        mov  byte [irq_owner+4*0],al		;1    ; timer
-
 
1128
        ;mov  [irq_owner+4*1], 1    ; keyboard
-
 
1129
        mov  byte [irq_owner+4*6],al		;1    ; floppy diskette
-
 
1130
        mov  byte [irq_owner+4*13],al	;1   ; math co-pros
-
 
1131
        mov  byte [irq_owner+4*14],al	;1   ; ide I
-
 
Line 1132... Line 1121...
1132
        mov  byte [irq_owner+4*15],al	;1   ; ide II
1121
reserve_irqs_ports:
1133
        pop  eax
-
 
1134
 
1122
 
-
 
1123
 
Line 1135... Line -...
1135
; RESERVE PORTS
-
 
1136
	push  4
1124
; RESERVE PORTS
1137
        pop   dword [RESERVED_PORTS]	;,edi
-
 
1138
 
-
 
Line 1139... Line -...
1139
	push  1
-
 
1140
        pop   dword [RESERVED_PORTS+16+0]	;,dword 1
-
 
1141
        and   dword [RESERVED_PORTS+16+4],0	;,dword 0x0
1125
        mov eax, RESERVED_PORTS
1142
        mov   dword [RESERVED_PORTS+16+8],0x2d	;,dword 0x2d
1126
        mov ecx, 1
1143
 
-
 
1144
	push  1
1127
 
1145
        pop   dword [RESERVED_PORTS+32+0]	;,dword 1
1128
        mov [eax], dword 4
1146
        push  0x30
-
 
1147
        pop   dword [RESERVED_PORTS+32+4]	;,dword 0x30
1129
 
1148
	push  0x4d
-
 
1149
        pop   dword [RESERVED_PORTS+32+8]	;,dword 0x4d
1130
        mov [eax+16], ecx
1150
 
1131
        mov [eax+16+4], dword 0
1151
	push  1
1132
        mov [eax+16+4], dword 0x2D
1152
        pop   dword [RESERVED_PORTS+48+0]	;,dword 1
1133
 
-
 
1134
        mov [eax+32], ecx
1153
	push  0x50
1135
        mov [eax+32+4], dword 0x30
1154
        pop   dword [RESERVED_PORTS+48+4]	;,dword 0x50
1136
        mov [eax+32+8], dword 0x4D
-
 
1137
 
1155
        mov   dword [RESERVED_PORTS+48+8],0xdf	;,dword 0xdf
1138
        mov [eax+48], ecx
1156
 
1139
        mov [eax+48+4], dword 0x50
Line 1157... Line 1140...
1157
	push  1
1140
        mov [eax+28+8], dword 0xDF
Line 1158... Line -...
1158
        pop   dword [RESERVED_PORTS+64+0]	;,dword 1
-
 
1159
 
-
 
1160
        mov   dword [RESERVED_PORTS+64+4],0xe5	;,dword 0xe5
-
 
1161
        mov   dword [RESERVED_PORTS+64+8],0xff	;,dword 0xff
-
 
1162
 
-
 
1163
        ret
-
 
1164
 
-
 
1165
setirqreadports:
-
 
1166
 
-
 
1167
        mov   [irq12read+0],dword 0x60 + 0x01000000  ; read port 0x60 , byte
-
 
1168
	    and   dword [irq12read+4],0                   ; end of port list
-
 
Line 1169... Line 1141...
1169
;        mov   [irq12read+4],dword 0                  ; end of port list
1141
 
1170
        ;mov   [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
1142
        mov [eax+64], ecx
1171
        ;mov   [irq04read+4],dword 0                  ; end of port list
1143
        mov [eax+64+4], dword 0xE5
Line 3478... Line 3450...
3478
;     ret
3450
;     ret
Line 3479... Line 3451...
3479
 
3451
 
3480
 
-
 
3481
 
-
 
3482
align 4
-
 
3483
 
-
 
3484
sys_programirq:
-
 
3485
 
-
 
3486
    mov   eax, [TASK_BASE]
-
 
3487
    add   ebx, [eax + TASKDATA.mem_start]
-
 
3488
 
-
 
3489
    cmp   ecx, 16
-
 
3490
    jae   .not_owner
-
 
3491
    mov   edi, [eax + TASKDATA.pid]
-
 
3492
    cmp   edi, [irq_owner + 4 * ecx]
-
 
3493
    je    .spril1
-
 
3494
.not_owner:
-
 
3495
    xor   ecx, ecx
-
 
3496
    inc   ecx
-
 
3497
    jmp   .end
-
 
3498
  .spril1:
-
 
3499
 
-
 
3500
    shl   ecx, 6
-
 
3501
    mov   esi, ebx
-
 
3502
    lea   edi, [irq00read + ecx]
-
 
3503
    push  16
-
 
3504
    pop   ecx
-
 
3505
 
-
 
3506
    cld
-
 
3507
    rep   movsd
-
 
3508
  .end:
-
 
3509
    mov   [esp+32], ecx
-
 
3510
    ret
-
 
3511
 
-
 
3512
 
-
 
3513
align 4
-
 
3514
 
-
 
3515
get_irq_data:
-
 
3516
     movzx esi, bh                       ; save number of subfunction, if bh = 1, return data size, otherwise, read data
-
 
3517
     xor   bh, bh
-
 
3518
     cmp   ebx, 16
-
 
3519
     jae   .not_owner
-
 
3520
     mov   edx, [4 * ebx + irq_owner]    ; check for irq owner
-
 
3521
 
-
 
3522
     mov   eax,[TASK_BASE]
-
 
3523
 
-
 
3524
     cmp   edx,[eax+TASKDATA.pid]
-
 
3525
     je    gidril1
-
 
3526
.not_owner:
-
 
3527
     xor   edx, edx
-
 
3528
     dec   edx
-
 
3529
     jmp   gid1
-
 
3530
 
-
 
3531
  gidril1:
-
 
3532
 
-
 
3533
     shl   ebx, 12
-
 
3534
     lea   eax, [ebx + IRQ_SAVE]         ; calculate address of the beginning of buffer + 0x0 - data size
-
 
3535
     mov   edx, [eax]                    ;                                              + 0x4 - data offset
-
 
3536
     dec   esi
-
 
3537
     jz    gid1
-
 
3538
     test  edx, edx                      ; check if buffer is empty
-
 
3539
     jz    gid1
-
 
3540
 
-
 
3541
     mov   ebx, [eax + 0x4]
-
 
3542
     mov   edi, ecx
-
 
3543
 
-
 
3544
     mov   ecx, 4000                     ; buffer size, used frequently
-
 
3545
 
-
 
3546
     cmp   ebx, ecx                      ; check for the end of buffer, if end of buffer, begin cycle again
-
 
3547
     jb    @f
-
 
3548
 
-
 
3549
     xor   ebx, ebx
-
 
3550
 
-
 
3551
   @@:
-
 
3552
 
-
 
3553
     lea   esi, [ebx + edx]              ; calculate data size and offset
-
 
3554
     cld
-
 
3555
     cmp   esi, ecx                      ; if greater than the buffer size, begin cycle again
-
 
3556
     jbe   @f
-
 
3557
 
-
 
3558
     sub   ecx, ebx
-
 
3559
     sub   edx, ecx
-
 
3560
 
-
 
3561
     lea   esi, [eax + ebx + 0x10]
-
 
3562
     rep   movsb
-
 
3563
 
-
 
3564
     xor   ebx, ebx
-
 
3565
   @@:
-
 
3566
     lea   esi, [eax + ebx + 0x10]
-
 
3567
     mov   ecx, edx
-
 
3568
     add   ebx, edx
-
 
3569
 
-
 
3570
     rep   movsb
-
 
3571
     mov   edx, [eax]
-
 
3572
     mov   [eax], ecx                    ; set data size to zero
-
 
3573
     mov   [eax + 0x4], ebx              ; set data offset
-
 
3574
 
-
 
3575
   gid1:
-
 
3576
     mov   [esp+32], edx                 ; eax
-
 
3577
     ret
3452
 
3578
 
3453
 
3579
 
3454
align 4
3580
set_io_access_rights:
3455
set_io_access_rights:
3581
      push edi eax
3456
      push edi eax
Line 3586... Line 3461...
3586
;     add   edi,eax
3461
;     add   edi,eax
3587
;     mov   ebx,1
3462
;     mov   ebx,1
3588
;     shl   ebx,cl
3463
;     shl   ebx,cl
3589
     test  ebp,ebp
3464
     test  ebp,ebp
3590
;     cmp   ebp,0                ; enable access - ebp = 0
3465
;     cmp   ebp,0                ; enable access - ebp = 0
3591
     jnz   siar1
3466
     jnz   .siar1
3592
;     not   ebx
3467
;     not   ebx
3593
;     and   [edi],byte bl
3468
;     and   [edi],byte bl
3594
     btr [edi], eax
3469
     btr [edi], eax
3595
     pop eax edi
3470
     pop eax edi
3596
     ret
3471
     ret
3597
siar1:
3472
.siar1:
3598
     bts [edi], eax
3473
     bts [edi], eax
3599
  ;  or    [edi],byte bl        ; disable access - ebp = 1
3474
  ;  or    [edi],byte bl        ; disable access - ebp = 1
3600
     pop eax edi
3475
     pop eax edi
3601
     ret
3476
     ret
3602
;reserve/free group of ports
3477
;reserve/free group of ports
Line 3747... Line 3622...
3747
;     popad                         ; end disable io map
3622
;     popad                         ; end disable io map
3748
     xor   eax, eax
3623
     xor   eax, eax
3749
     ret
3624
     ret
Line 3750... Line -...
3750
 
-
 
3751
 
-
 
3752
reserve_free_irq:
-
 
3753
 
-
 
3754
     xor   esi, esi
-
 
3755
     inc   esi
-
 
3756
     cmp   ecx, 16
-
 
3757
     jae   ril1
-
 
3758
 
-
 
3759
     push  ecx
-
 
3760
     lea   ecx, [irq_owner + 4 * ecx]
-
 
3761
     mov   edx, [ecx]
-
 
3762
     mov   eax, [TASK_BASE]
-
 
3763
     mov   edi, [eax + TASKDATA.pid]
-
 
3764
     pop   eax
-
 
3765
     dec   ebx
-
 
3766
     jnz   reserve_irq
-
 
3767
 
-
 
3768
     cmp   edx, edi
-
 
3769
     jne   ril1
-
 
3770
     dec   esi
-
 
3771
     mov   [ecx], esi
-
 
3772
 
-
 
3773
     jmp   ril1
-
 
3774
 
-
 
3775
  reserve_irq:
-
 
3776
 
-
 
3777
     cmp   dword [ecx], 0
-
 
3778
     jne   ril1
-
 
3779
 
-
 
3780
     mov   ebx, [f_irqs + 4 * eax]
-
 
3781
 
-
 
3782
     stdcall attach_int_handler, eax, ebx, dword 0
-
 
3783
 
-
 
3784
     mov   [ecx], edi
-
 
3785
 
-
 
3786
     dec   esi
-
 
3787
   ril1:
-
 
3788
     mov   [esp+32], esi ; return in eax
-
 
3789
     ret
-
 
3790
 
3625
 
3791
iglobal
-
 
3792
f_irqs:
-
 
3793
     dd 0x0
-
 
3794
     dd 0x0
-
 
3795
     dd p_irq2
-
 
3796
     dd p_irq3
-
 
3797
     dd p_irq4
-
 
3798
     dd p_irq5
-
 
3799
     dd p_irq6
-
 
3800
     dd p_irq7
-
 
3801
     dd p_irq8
-
 
3802
     dd p_irq9
-
 
3803
     dd p_irq10
-
 
3804
     dd p_irq11
-
 
3805
     dd 0x0
-
 
3806
     dd 0x0
-
 
3807
     dd 0x0
-
 
3808
     dd 0x0
-
 
3809
 
-
 
3810
endg
3626
 
3811
 
3627
align 4
3812
drawbackground:
3628
drawbackground:
3813
       inc   [mouse_pause]
3629
       inc   [mouse_pause]
3814
       cmp   [SCR_MODE],word 0x12
3630
       cmp   [SCR_MODE],word 0x12
Line 4892... Line 4708...
4892
        xor     edi, edi
4708
        xor     edi, edi
4893
        add     ebx, ebp
4709
        add     ebx, ebp
4894
        mov     ecx, edx
4710
        mov     ecx, edx
4895
        jmp     [draw_line]
4711
        jmp     [draw_line]
Line 4896... Line -...
4896
 
-
 
4897
align 4
-
 
4898
 
-
 
4899
syscall_getirqowner:                    ; GetIrqOwner
-
 
4900
 
-
 
4901
     cmp   ebx,16
-
 
4902
     jae   .err
-
 
4903
 
-
 
4904
     cmp   [irq_rights + 4 * ebx], dword 2
-
 
4905
     je    .err
-
 
4906
 
-
 
4907
     mov   eax,[4 * ebx + irq_owner]
-
 
Line 4908... Line -...
4908
     mov   [esp+32],eax
-
 
4909
 
-
 
4910
     ret
-
 
4911
.err:
-
 
Line 4912... Line 4712...
4912
     or    dword [esp+32], -1
4712
 
4913
     ret
-
 
4914
 
4713
 
Line 4915... Line 4714...
4915
align 4
4714
 
4916
 
4715
align 4
4917
syscall_reserveportarea:                ; ReservePortArea and FreePortArea
4716
syscall_reserveportarea:                ; ReservePortArea and FreePortArea
Line 4918... Line 4717...
4918
 
4717
 
4919
     call  r_f_port_area
-
 
4920
     mov   [esp+32],eax
4718
     call  r_f_port_area
4921
     ret
4719
     mov   [esp+32],eax
4922
 
4720
     ret
4923
align 4
4721
 
4924
 
4722
align 4