Subversion Repositories Kolibri OS

Rev

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

Rev 9715 Rev 9742
Line 75... Line 75...
75
format binary as "mnt"
75
format binary as "mnt"
Line 76... Line 76...
76
 
76
 
77
include 'macros.inc'
77
include 'macros.inc'
Line 78... Line 78...
78
include 'struct.inc'
78
include 'struct.inc'
Line 79... Line 79...
79
 
79
 
80
$Revision: 9715 $
80
$Revision: 9742 $
Line 3478... Line 3478...
3478
align 4
3478
align 4
3479
.ret:
3479
.ret:
3480
        ret
3480
        ret
3481
;-----------------------------------------------------------------------------
3481
;-----------------------------------------------------------------------------
Line -... Line 3482...
-
 
3482
 
-
 
3483
; in: eax = port
-
 
3484
;     ebp = subfunction
-
 
3485
;          0 - set access
-
 
3486
;          1 - clear access
3482
 
3487
; out: not return value
3483
align 4
3488
align 4
3484
set_io_access_rights:
3489
set_io_access_rights:
3485
        push    edi eax
3490
        push    edi eax
3486
        mov     edi, tss._io_map_0
3491
        mov     edi, tss._io_map_0
3487
;     mov   ecx,eax
3492
;     mov   ecx,eax
3488
;     and   ecx,7    ; offset in byte
3493
;     and   ecx,7    ; offset in byte
3489
;     shr   eax,3    ; number of byte
3494
;     shr   eax,3    ; number of byte
3490
;     add   edi,eax
3495
;     add   edi,eax
3491
;     mov   ebx,1
3496
;     mov   ebx,1
3492
;     shl   ebx,cl
-
 
3493
        test    ebp, ebp
3497
;     shl   ebx,cl
3494
;     cmp   ebp,0                ; enable access - ebp = 0
3498
        test    ebp, ebp         ; enable access - ebp = 0
3495
        jnz     .siar1
3499
        jnz     .siar1
3496
;     not   ebx
3500
;     not   ebx
3497
;     and   [edi],byte bl
3501
;     and   [edi],byte bl
3498
        btr     [edi], eax
3502
        btr     [edi], eax
3499
        pop     eax edi
3503
        pop     eax edi
3500
        ret
3504
        ret
3501
.siar1:
-
 
3502
        bts     [edi], eax
3505
.siar1:
3503
  ;  or    [edi],byte bl        ; disable access - ebp = 1
3506
        bts     [edi], eax      ; disable access - ebp = 1
3504
        pop     eax edi
3507
        pop     eax edi
Line 3505... Line 3508...
3505
        ret
3508
        ret
3506
 
3509
 
Line 3524... Line 3527...
3524
;destroys eax,ebx, ebp
3527
;destroys eax,ebx, ebp
3525
r_f_port_area:
3528
r_f_port_area:
Line 3526... Line 3529...
3526
 
3529
 
3527
        test    ebx, ebx
3530
        test    ebx, ebx
3528
        jnz     free_port_area
-
 
3529
;     je    r_port_area
-
 
3530
;     jmp   free_port_area
-
 
3531
 
-
 
3532
;   r_port_area:
-
 
3533
 
-
 
Line 3534... Line 3531...
3534
;     pushad
3531
        jnz     free_port_area
3535
 
3532
 
3536
        cmp     ecx, edx      ; beginning > end ?
3533
        cmp     ecx, edx      ; beginning > end ?
3537
        ja      rpal1
3534
        ja      rpal1
Line 3548... Line 3545...
3548
        add     ebx, RESERVED_PORTS
3545
        add     ebx, RESERVED_PORTS
3549
        cmp     ecx, [ebx+8]
3546
        cmp     ecx, [ebx+8]
3550
        ja      rpal4
3547
        ja      rpal4
3551
        cmp     edx, [ebx+4]
3548
        cmp     edx, [ebx+4]
3552
        jae     rpal1
3549
        jae     rpal1
3553
;     jb    rpal4
-
 
3554
;     jmp   rpal1
-
 
3555
 rpal4:
3550
 rpal4:
3556
        dec     eax
3551
        dec     eax
3557
        jnz     rpal3
3552
        jnz     rpal3
3558
        jmp     rpal2
3553
        jmp     rpal2
3559
   rpal1:
3554
   rpal1:
3560
;     popad
-
 
3561
;     mov   eax,1
-
 
3562
        xor     eax, eax
3555
        xor     eax, eax
3563
        inc     eax
3556
        inc     eax
3564
        ret
3557
        ret
3565
   rpal2:
3558
   rpal2:
3566
;     popad
-
 
3567
     ; enable port access at port IO map
3559
     ; enable port access at port IO map
3568
        cli
-
 
3569
        pushad                        ; start enable io map
3560
        pushad                        ; start enable io map
3570
 
-
 
3571
        cmp     edx, 65536;16384
-
 
3572
        jae     no_unmask_io; jge
-
 
3573
        mov     eax, ecx
3561
        mov     eax, ecx
3574
;       push    ebp
-
 
3575
        xor     ebp, ebp               ; enable - eax = port
3562
        xor     ebp, ebp               ; enable - eax = port
-
 
3563
        cli
3576
new_port_access:
3564
new_port_access:
3577
;     pushad
-
 
3578
        call    set_io_access_rights
3565
        call    set_io_access_rights
3579
;     popad
3566
 
3580
        inc     eax
3567
        inc     eax
3581
        cmp     eax, edx
3568
        cmp     eax, edx
3582
        jbe     new_port_access
3569
        jbe     new_port_access
3583
;       pop     ebp
-
 
3584
no_unmask_io:
3570
no_unmask_io:
3585
        popad                         ; end enable io map
-
 
3586
        sti
3571
        sti
-
 
3572
        popad                         ; end enable io map
Line 3587... Line 3573...
3587
 
3573
 
3588
        mov     eax, [RESERVED_PORTS]
3574
        mov     eax, [RESERVED_PORTS]
3589
        add     eax, 1
3575
        inc     eax
3590
        mov     [RESERVED_PORTS], eax
3576
        mov     [RESERVED_PORTS], eax
3591
        shl     eax, 4
3577
        shl     eax, 4
3592
        add     eax, RESERVED_PORTS
3578
        add     eax, RESERVED_PORTS
3593
        mov     ebx, [current_slot]
3579
        mov     ebx, [current_slot]
Line 3599... Line 3585...
3599
        xor     eax, eax
3585
        xor     eax, eax
3600
        ret
3586
        ret
Line 3601... Line 3587...
3601
 
3587
 
Line 3602... Line -...
3602
free_port_area:
-
 
3603
 
3588
free_port_area:
3604
;     pushad
3589
 
3605
        mov     eax, [RESERVED_PORTS]; no reserved areas ?
3590
        mov     eax, [RESERVED_PORTS]; no reserved areas ?
3606
        test    eax, eax
3591
        test    eax, eax
3607
        jz      frpal2
3592
        jz      frpal2
Line 3620... Line 3605...
3620
        jmp     frpal1
3605
        jmp     frpal1
3621
   frpal4:
3606
   frpal4:
3622
        dec     eax
3607
        dec     eax
3623
        jnz     frpal3
3608
        jnz     frpal3
3624
   frpal2:
3609
   frpal2:
3625
;     popad
-
 
3626
        inc     eax
3610
        inc     eax
3627
        ret
3611
        ret
3628
   frpal1:
3612
   frpal1:
3629
        push    ecx
3613
        push    ecx
3630
        mov     ecx, 256
3614
        mov     ecx, 256
Line 3634... Line 3618...
3634
        add     esi, 16
3618
        add     esi, 16
3635
        cld
3619
        cld
3636
        rep movsb
3620
        rep movsb
Line 3637... Line 3621...
3637
 
3621
 
3638
        dec     dword [RESERVED_PORTS]
-
 
3639
;popad
3622
        dec     dword [RESERVED_PORTS]
3640
;disable port access at port IO map
-
 
3641
 
3623
;disable port access at port IO map
3642
;     pushad                        ; start disable io map
3624
                        ; start disable io map
3643
        pop     eax     ;start port
3625
        pop     eax     ;start port
3644
        cmp     edx, 65536;16384
3626
        ;cmp     edx, 65536
Line 3645... Line -...
3645
        jge     no_mask_io
-
 
3646
 
3627
        ;jge     no_mask_io
3647
;     mov   eax,ecx
3628
 
3648
        xor     ebp, ebp
-
 
3649
        inc     ebp
-
 
3650
new_port_access_disable:
3629
        xor     ebp, ebp
3651
;     pushad
3630
        inc     ebp
3652
;     mov   ebp,1                  ; disable - eax = port
3631
new_port_access_disable:           ; disable - eax = port
3653
        call    set_io_access_rights
3632
        call    set_io_access_rights
3654
;     popad
3633
 
3655
        inc     eax
3634
        inc     eax
3656
        cmp     eax, edx
-
 
3657
        jbe     new_port_access_disable
3635
        cmp     eax, edx
3658
no_mask_io:
3636
        jbe     new_port_access_disable
3659
;     popad                         ; end disable io map
3637
no_mask_io:                         ; end disable io map
3660
        xor     eax, eax
3638
        xor     eax, eax
3661
        ret
3639
        ret
3662
;-----------------------------------------------------------------------------
3640
;-----------------------------------------------------------------------------