Subversion Repositories Kolibri OS

Rev

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

Rev 1508 Rev 1551
Line 56... Line 56...
56
;;
56
;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
include 'macros.inc'
59
include 'macros.inc'
Line 60... Line 60...
60
 
60
 
Line 61... Line 61...
61
$Revision: 1508 $
61
$Revision: 1551 $
Line 388... Line 388...
388
 
388
 
389
        and     byte [BOOT_VAR+0x901e],0x0
389
        and     byte [BOOT_VAR+0x901e],0x0
390
        mov     eax,[BOOT_VAR+0x9018]
390
        mov     eax,[BOOT_VAR+0x9018]
Line -... Line 391...
-
 
391
        mov     [LFBAddress],eax
391
        mov     [LFBAddress],eax
392
 
392
 
393
;==        
393
;==        cmp     [SCR_MODE],word 0100000000000000b
-
 
394
;        jge     setvesa20
394
	cmp     [SCR_MODE],word 0100000000000000b
395
;        cmp     [SCR_MODE],word 0x13
-
 
396
;        je      v20ga32
-
 
397
;        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
-
 
398
;        mov     [GETPIXEL],dword Vesa12_getpixel24
395
        jge     setvesa20
399
;        cmp     [ScreenBPP],byte 24
-
 
400
;        jz      ga24
396
	mov	eax, 0xDEADBEEF
401
;        mov     [PUTPIXEL],dword Vesa12_putpixel32
-
 
402
;        mov     [GETPIXEL],dword Vesa12_getpixel32
-
 
403
;      ga24:
397
	hlt
404
;        jmp     v20ga24
398
;        ===  EGA, VGA & Vesa 1.2 modes not supported ===
405
      setvesa20:
399
      setvesa20:
406
;        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0
400
;        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0 24bpp modes
407
;        mov     [GETPIXEL],dword Vesa20_getpixel24
401
;        mov     [GETPIXEL],dword Vesa20_getpixel24
408
;        cmp     [ScreenBPP],byte 24
402
;        cmp     [ScreenBPP],byte 24
409
;        jz      v20ga24
403
;        jz      v20ga24
410
      v20ga32:
404
      v20ga32:
411
        mov     [PUTPIXEL],dword Vesa20_putpixel32
-
 
412
        mov     [GETPIXEL],dword Vesa20_getpixel32
-
 
413
;      v20ga24:
-
 
414
;        cmp     [SCR_MODE],word 0x12                ; 16 C VGA 640x480
-
 
415
;        jne     no_mode_0x12
-
 
416
;        mov     [PUTPIXEL],dword VGA_putpixel
-
 
Line 417... Line 405...
417
;        mov     [GETPIXEL],dword Vesa20_getpixel32
405
        mov     [PUTPIXEL],dword Vesa20_putpixel32
418
      no_mode_0x12:
406
        mov     [GETPIXEL],dword Vesa20_getpixel32
419
 
407
 
420
; -------- Fast System Call init ----------
408
; -------- Fast System Call init ----------
421
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
409
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
422
           bt [cpu_caps], CAPS_SEP
410
;           bt [cpu_caps], CAPS_SEP
423
           jnc .SEnP   ; SysEnter not Present
411
;           jnc .SEnP   ; SysEnter not Present
424
           xor edx, edx
412
;           xor edx, edx
425
           mov ecx, MSR_SYSENTER_CS
413
;           mov ecx, MSR_SYSENTER_CS
426
           mov eax, os_code
414
;           mov eax, os_code
427
           wrmsr
415
;           wrmsr
428
           mov ecx, MSR_SYSENTER_ESP
416
;           mov ecx, MSR_SYSENTER_ESP
429
;           mov eax, sysenter_stack ; Check it
417
;;           mov eax, sysenter_stack ; Check it
430
           xor     eax, eax
418
;           xor     eax, eax
431
           wrmsr
419
;           wrmsr
432
           mov ecx, MSR_SYSENTER_EIP
420
;           mov ecx, MSR_SYSENTER_EIP
433
           mov eax, sysenter_entry
421
;           mov eax, sysenter_entry
434
           wrmsr
422
;           wrmsr
435
.SEnP:
423
.SEnP:
436
; AMD SYSCALL/SYSRET
424
; AMD SYSCALL/SYSRET
437
           cmp byte[cpu_vendor], 'A'
425
;           cmp byte[cpu_vendor], 'A'
438
           jne .noSYSCALL
426
;          jne .noSYSCALL
439
           mov eax, 0x80000001
427
;           mov eax, 0x80000001
440
           cpuid
428
;           cpuid
441
           test edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
429
;           test edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
442
           jz .noSYSCALL
430
;           jz .noSYSCALL
443
           mov ecx, MSR_AMD_EFER
431
           mov ecx, MSR_AMD_EFER
Line 444... Line -...
444
           rdmsr
-
 
445
           or eax, 1   ; bit_0 - System Call Extension (SCE)
432
           rdmsr
446
           wrmsr
433
           or eax, 1   ; bit_0 - System Call Extension (SCE)
447
 
434
           wrmsr
448
        ; !!!! It`s dirty hack, fix it !!!
435
 
449
        ; Bits of EDX :
436
        ; Bits of EDX :
Line 450... Line 437...
450
        ; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
437
        ; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
451
        ;  and the contents of this field, plus 8, are copied into the SS register.
-
 
Line 452... Line 438...
452
        ; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
438
        ;  and the contents of this field, plus 8, are copied into the SS register.
453
        ;  and the contents of this field, plus 8, are copied into the SS register.
439
        ; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
454
 
440
        ;  and the contents of this field, plus 8, are copied into the SS register.
455
        ; mov   edx, (os_code + 16) * 65536 + os_code
441
 
456
           mov edx, 0x1B0008
442
           mov edx, 0x1B000B	; RING3 task stack will be used for fast syscalls!
457
 
443
 
458
           mov eax, syscall_entry
444
           mov eax, syscall_entry
459
           mov ecx, MSR_AMD_STAR
445
           mov ecx, MSR_AMD_STAR
460
           wrmsr
446
           wrmsr
461
.noSYSCALL:
447
.noSYSCALL:
462
; -----------------------------------------
448
; -----------------------------------------
463
        stdcall alloc_page
449
        stdcall alloc_page
Line 493... Line 479...
493
           mov [tss._gs],app_data
479
           mov [tss._gs],app_data
494
           mov [tss._io],128
480
           mov [tss._io],128
495
;Add IO access table - bit array of permitted ports
481
;Add IO access table - bit array of permitted ports
496
           mov edi, tss._io_map_0
482
           mov edi, tss._io_map_0
497
           xor eax, eax
483
           xor eax, eax
498
           not eax
484
	   mov ecx, 2047
499
           mov ecx, 8192/4
485
	   rep stosd		     ; access to 65504 ports granted
500
           rep stosd                 ; access to 4096*8=65536 ports
486
	   not eax		     ; the last 32 ports blocked
-
 
487
	   stosd
Line 501... Line 488...
501
 
488
 
502
           mov  ax,tss0
489
           mov  ax,tss0
Line 503... Line 490...
503
           ltr  ax
490
           ltr  ax
Line 692... Line 679...
692
 
679
 
693
        mov   esi,boot_resirqports
680
        mov   esi,boot_resirqports
694
        call  boot_log
681
        call  boot_log
Line 695... Line -...
695
        call  reserve_irqs_ports
-
 
696
 
-
 
697
; SET PORTS FOR IRQ HANDLERS
-
 
698
 
-
 
699
        ;mov  esi,boot_setrports
-
 
Line 700... Line 682...
700
        ;call boot_log
682
        call  reserve_irqs_ports
Line 701... Line 683...
701
        ;call setirqreadports
683
 
702
 
684
 
Line 843... Line 825...
843
  cmp ax,'r1'           ; if not rused ram disk - load network configuration from files {SPraid.simba}
825
  cmp ax,'r1'           ; if not rused ram disk - load network configuration from files {SPraid.simba}
844
  je  no_st_network
826
  je  no_st_network
845
        call set_network_conf
827
        call set_network_conf
846
  no_st_network:
828
  no_st_network:
Line 847... Line 829...
847
 
829
 
848
        call init_userDMA	; <<<<<<<<< ================ core/memory.inc ========================================
830
        call init_userDMA	; <<<<<<<<< ============== core/memory.inc =================
-
 
831
;	call pci_ext_config	; <<<<<<<<< bus/pci/pcie.inc
-
 
832
;-------------------------------------------------------------------------------
Line 849... Line 833...
849
	  call pci_ext_config	; <<<<<<<<< bus/pci/pcie.inc
833
        call rs7xx_pcie_init    ; <<<<<<<<< bus/ht.inc
850
 
834
 
Line 851... Line 835...
851
; LOAD FIRST APPLICATION
835
; LOAD FIRST APPLICATION
Line 1095... Line 1079...
1095
;                       KERNEL FUNCTIONS                               ;
1079
;                       KERNEL FUNCTIONS                               ;
1096
;                                                                      ;
1080
;                                                                      ;
1097
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1081
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 1098... Line 1082...
1098
 
1082
 
1099
reserve_irqs_ports:
-
 
1100
 
-
 
1101
        push eax
-
 
1102
        xor	eax,eax
-
 
1103
		inc	eax
-
 
1104
        mov  byte [irq_owner+4*0],al		;1    ; timer
-
 
1105
        ;mov  [irq_owner+4*1], 1    ; keyboard
-
 
1106
        mov  byte [irq_owner+4*6],al		;1    ; floppy diskette
-
 
1107
        mov  byte [irq_owner+4*13],al	;1   ; math co-pros
-
 
1108
        mov  byte [irq_owner+4*14],al	;1   ; ide I
-
 
1109
        mov  byte [irq_owner+4*15],al	;1   ; ide II
-
 
1110
        pop  eax
-
 
1111
 
-
 
1112
; RESERVE PORTS
-
 
1113
	push  4
-
 
1114
        pop   dword [RESERVED_PORTS]	;,edi
-
 
1115
 
-
 
1116
	push  1
-
 
1117
        pop   dword [RESERVED_PORTS+16+0]	;,dword 1
-
 
1118
        and   dword [RESERVED_PORTS+16+4],0	;,dword 0x0
-
 
1119
        mov   dword [RESERVED_PORTS+16+8],0x2d	;,dword 0x2d
-
 
1120
 
-
 
1121
	push  1
-
 
1122
        pop   dword [RESERVED_PORTS+32+0]	;,dword 1
-
 
1123
        push  0x30
-
 
1124
        pop   dword [RESERVED_PORTS+32+4]	;,dword 0x30
1083
reserve_irqs_ports:
1125
	push  0x4d
-
 
1126
        pop   dword [RESERVED_PORTS+32+8]	;,dword 0x4d
-
 
1127
 
-
 
1128
	push  1
-
 
1129
        pop   dword [RESERVED_PORTS+48+0]	;,dword 1
-
 
1130
	push  0x50
-
 
1131
        pop   dword [RESERVED_PORTS+48+4]	;,dword 0x50
-
 
1132
        mov   dword [RESERVED_PORTS+48+8],0xdf	;,dword 0xdf
-
 
1133
 
-
 
1134
	push  1
-
 
1135
        pop   dword [RESERVED_PORTS+64+0]	;,dword 1
-
 
1136
 
-
 
1137
        mov   dword [RESERVED_PORTS+64+4],0xe5	;,dword 0xe5
-
 
1138
        mov   dword [RESERVED_PORTS+64+8],0xff	;,dword 0xff
-
 
1139
 
1084
	; removed 
Line 1140... Line 1085...
1140
        ret
1085
        ret
1141
 
-
 
1142
setirqreadports:
-
 
1143
 
-
 
1144
        mov   [irq12read+0],dword 0x60 + 0x01000000  ; read port 0x60 , byte
-
 
1145
	    and   dword [irq12read+4],0                   ; end of port list
-
 
1146
;        mov   [irq12read+4],dword 0                  ; end of port list
-
 
1147
        ;mov   [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
-
 
1148
        ;mov   [irq04read+4],dword 0                  ; end of port list
-
 
1149
        ;mov   [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
1086
 
1150
        ;mov   [irq03read+4],dword 0                  ; end of port list
1087
setirqreadports:
Line 1151... Line 1088...
1151
 
1088
	; removed
1152
        ret
1089
	ret
1153
 
1090
 
Line 1183... Line 1120...
1183
        ret
1120
        ret
Line 1184... Line 1121...
1184
 
1121
 
1185
align 4
1122
align 4
1186
;input  eax=43,bl-byte of output, ecx - number of port
1123
;input  eax=43,bl-byte of output, ecx - number of port
1187
sys_outport:
-
 
1188
 
1124
sys_outport:
1189
    mov   edi,ecx          ; separate flag for read / write
-
 
1190
    and   ecx,65535
-
 
1191
 
-
 
1192
    mov   eax,[RESERVED_PORTS]
-
 
1193
    test  eax,eax
-
 
1194
    jnz   .sopl8
-
 
1195
    inc	  eax
-
 
1196
	mov   [esp+32],eax
-
 
1197
    ret
-
 
1198
 
-
 
1199
  .sopl8:
-
 
1200
    mov   edx,[TASK_BASE]
-
 
1201
    mov   edx,[edx+0x4]
-
 
1202
    ;and   ecx,65535
-
 
1203
    ;cld - set on interrupt 0x40
-
 
1204
  .sopl1:
-
 
1205
 
-
 
1206
    mov   esi,eax
-
 
1207
    shl   esi,4
-
 
1208
    add   esi,RESERVED_PORTS
-
 
1209
    cmp   edx,[esi+0]
-
 
1210
    jne   .sopl2
-
 
1211
    cmp   ecx,[esi+4]
-
 
1212
    jb    .sopl2
-
 
1213
    cmp   ecx,[esi+8]
-
 
1214
    jg    .sopl2
-
 
1215
.sopl3:
-
 
1216
 
-
 
1217
    test  edi,0x80000000 ; read ?
-
 
1218
    jnz   .sopl4
-
 
1219
 
-
 
1220
	mov	  eax,ebx
-
 
1221
    mov   dx,cx          ; write
-
 
1222
    out   dx,al
-
 
1223
    and   [esp+32],dword 0
-
 
1224
    ret
-
 
1225
 
-
 
1226
	.sopl2:
-
 
1227
 
-
 
1228
    dec   eax
-
 
1229
    jnz   .sopl1
-
 
1230
	inc	  eax
-
 
1231
    mov   [esp+32],eax
-
 
1232
    ret
-
 
1233
 
-
 
1234
  
-
 
1235
  .sopl4:
-
 
1236
 
-
 
1237
    mov   dx,cx          ; read
-
 
1238
    in    al,dx
-
 
1239
    and   eax,0xff
-
 
1240
    and   [esp+32],dword 0
-
 
1241
    mov   [esp+20],eax
1125
     and   [esp+32],dword 1	; for backward compatibility: operation failed
Line 1242... Line 1126...
1242
    ret
1126
    ret
1243
 
1127
 
1244
display_number:
1128
display_number:
Line 3460... Line 3344...
3460
 
3344
 
Line 3461... Line 3345...
3461
 
3345
 
3462
align 4
-
 
3463
 
-
 
3464
sys_programirq:
-
 
3465
 
-
 
3466
    mov   eax, [TASK_BASE]
-
 
3467
    add   ebx, [eax + TASKDATA.mem_start]
-
 
3468
 
-
 
3469
    cmp   ecx, 16
-
 
3470
    jae   .not_owner
-
 
3471
    mov   edi, [eax + TASKDATA.pid]
-
 
3472
    cmp   edi, [irq_owner + 4 * ecx]
-
 
3473
    je    .spril1
-
 
3474
.not_owner:
-
 
3475
    xor   ecx, ecx
-
 
3476
    inc   ecx
-
 
3477
    jmp   .end
-
 
3478
  .spril1:
-
 
3479
 
-
 
3480
    shl   ecx, 6
-
 
3481
    mov   esi, ebx
-
 
3482
    lea   edi, [irq00read + ecx]
-
 
3483
    push  16
-
 
3484
    pop   ecx
3346
align 4
3485
 
-
 
3486
    cld
3347
 
3487
    rep   movsd
3348
sys_programirq:
Line 3488... Line 3349...
3488
  .end:
3349
	; removed 
Line 3489... Line 3350...
3489
    mov   [esp+32], ecx
3350
    mov   dword [esp+32], 1	; operation failed
3490
    ret
-
 
3491
 
-
 
3492
 
-
 
3493
align 4
-
 
3494
 
-
 
3495
get_irq_data:
-
 
3496
     movzx esi, bh                       ; save number of subfunction, if bh = 1, return data size, otherwise, read data
-
 
3497
     xor   bh, bh
-
 
3498
     cmp   ebx, 16
-
 
3499
     jae   .not_owner
-
 
3500
     mov   edx, [4 * ebx + irq_owner]    ; check for irq owner
-
 
3501
 
-
 
3502
     mov   eax,[TASK_BASE]
-
 
3503
 
-
 
3504
     cmp   edx,[eax+TASKDATA.pid]
-
 
3505
     je    gidril1
-
 
3506
.not_owner:
-
 
3507
     xor   edx, edx
-
 
3508
     dec   edx
-
 
3509
     jmp   gid1
-
 
3510
 
-
 
3511
  gidril1:
-
 
3512
 
-
 
3513
     shl   ebx, 12
-
 
3514
     lea   eax, [ebx + IRQ_SAVE]         ; calculate address of the beginning of buffer + 0x0 - data size
-
 
3515
     mov   edx, [eax]                    ;                                              + 0x4 - data offset
-
 
3516
     dec   esi
-
 
3517
     jz    gid1
-
 
3518
     test  edx, edx                      ; check if buffer is empty
-
 
3519
     jz    gid1
-
 
3520
 
-
 
3521
     mov   ebx, [eax + 0x4]
-
 
3522
     mov   edi, ecx
-
 
3523
 
-
 
3524
     mov   ecx, 4000                     ; buffer size, used frequently
-
 
3525
 
-
 
3526
     cmp   ebx, ecx                      ; check for the end of buffer, if end of buffer, begin cycle again
-
 
3527
     jb    @f
-
 
3528
 
-
 
3529
     xor   ebx, ebx
-
 
3530
 
-
 
3531
   @@:
-
 
3532
 
-
 
3533
     lea   esi, [ebx + edx]              ; calculate data size and offset
-
 
3534
     cld
-
 
3535
     cmp   esi, ecx                      ; if greater than the buffer size, begin cycle again
-
 
3536
     jbe   @f
-
 
3537
 
-
 
3538
     sub   ecx, ebx
-
 
3539
     sub   edx, ecx
-
 
3540
 
-
 
3541
     lea   esi, [eax + ebx + 0x10]
-
 
3542
     rep   movsb
-
 
3543
 
-
 
3544
     xor   ebx, ebx
3351
    ret
3545
   @@:
3352
 
3546
     lea   esi, [eax + ebx + 0x10]
-
 
3547
     mov   ecx, edx
-
 
3548
     add   ebx, edx
-
 
3549
 
-
 
3550
     rep   movsb
-
 
3551
     mov   edx, [eax]
3353
 
Line 3552... Line 3354...
3552
     mov   [eax], ecx                    ; set data size to zero
3354
align 4
3553
     mov   [eax + 0x4], ebx              ; set data offset
-
 
3554
 
-
 
3555
   gid1:
-
 
3556
     mov   [esp+32], edx                 ; eax
-
 
3557
     ret
-
 
3558
 
-
 
3559
 
-
 
3560
set_io_access_rights:
-
 
3561
      push edi eax
-
 
3562
      mov edi, tss._io_map_0
-
 
3563
;     mov   ecx,eax
-
 
3564
;     and   ecx,7    ; offset in byte
-
 
3565
;     shr   eax,3    ; number of byte
-
 
3566
;     add   edi,eax
-
 
3567
;     mov   ebx,1
-
 
3568
;     shl   ebx,cl
-
 
3569
     test  ebp,ebp
-
 
3570
;     cmp   ebp,0                ; enable access - ebp = 0
-
 
3571
     jnz   siar1
-
 
3572
;     not   ebx
-
 
3573
;     and   [edi],byte bl
-
 
3574
     btr [edi], eax
-
 
3575
     pop eax edi
-
 
3576
     ret
-
 
3577
siar1:
-
 
3578
     bts [edi], eax
-
 
3579
  ;  or    [edi],byte bl        ; disable access - ebp = 1
-
 
3580
     pop eax edi
-
 
3581
     ret
-
 
3582
;reserve/free group of ports
-
 
3583
;  * eax = 46 - number function
-
 
3584
;  * ebx = 0 - reserve, 1 - free
-
 
3585
;  * ecx = number start arrea of ports
-
 
3586
;  * edx = number end arrea of ports (include last number of port)
-
 
3587
;Return value:
-
 
3588
;  * eax = 0 - succesful 
-
 
3589
;  * eax = 1 - error
-
 
3590
;  * The system has reserve this ports:
-
 
3591
;    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (include last number of port).
-
 
3592
;destroys eax,ebx, ebp
-
 
3593
r_f_port_area:
-
 
3594
 
-
 
3595
     test  ebx, ebx
-
 
3596
     jnz   free_port_area
-
 
3597
;     je    r_port_area
-
 
3598
;     jmp   free_port_area
-
 
3599
 
-
 
3600
;   r_port_area:
-
 
3601
 
-
 
3602
;     pushad
-
 
3603
 
-
 
3604
     cmp   ecx,edx            ; beginning > end ?
-
 
3605
     ja    rpal1
-
 
3606
     cmp   edx,65536
-
 
3607
     jae   rpal1
-
 
3608
     mov   eax,[RESERVED_PORTS]
-
 
3609
     test  eax,eax            ; no reserved areas ?
-
 
3610
     je    rpal2
-
 
3611
     cmp   eax,255            ; max reserved
-
 
3612
     jae   rpal1
-
 
3613
 rpal3:
-
 
3614
     mov   ebx,eax
-
 
3615
     shl   ebx,4
-
 
3616
     add   ebx,RESERVED_PORTS
-
 
3617
     cmp   ecx,[ebx+8]
-
 
3618
     ja    rpal4
-
 
3619
     cmp   edx,[ebx+4]
-
 
3620
     jae   rpal1
-
 
3621
;     jb    rpal4
-
 
3622
;     jmp   rpal1
-
 
3623
 rpal4:
-
 
3624
     dec   eax
-
 
3625
     jnz   rpal3
-
 
3626
     jmp   rpal2
-
 
3627
   rpal1:
-
 
3628
;     popad
-
 
3629
;     mov   eax,1
-
 
3630
     xor    eax,eax
-
 
3631
     inc    eax
-
 
3632
     ret
-
 
3633
   rpal2:
-
 
3634
;     popad
-
 
3635
     ; enable port access at port IO map
-
 
3636
	cli
-
 
3637
	pushad                        ; start enable io map
-
 
3638
 
-
 
3639
	cmp   edx,65536 ;16384
-
 
3640
	jae   no_unmask_io ; jge
-
 
3641
	mov   eax,ecx
-
 
3642
;	push	ebp
-
 
3643
	xor	ebp,ebp                ; enable - eax = port
3355
 
3644
new_port_access:
-
 
3645
;     pushad
-
 
3646
	call	set_io_access_rights
-
 
3647
;     popad
-
 
3648
     inc   eax
-
 
3649
     cmp   eax,edx
-
 
3650
     jbe   new_port_access
-
 
3651
;	pop	ebp
-
 
3652
no_unmask_io:
-
 
3653
	popad                         ; end enable io map
-
 
3654
     sti
-
 
3655
 
-
 
3656
     mov   eax,[RESERVED_PORTS]
-
 
3657
     add   eax,1
-
 
3658
     mov   [RESERVED_PORTS],eax
-
 
3659
     shl   eax,4
-
 
3660
     add   eax,RESERVED_PORTS
-
 
3661
     mov   ebx,[TASK_BASE]
-
 
3662
     mov   ebx,[ebx+TASKDATA.pid]
-
 
3663
     mov   [eax],ebx
-
 
3664
     mov   [eax+4],ecx
-
 
3665
     mov   [eax+8],edx
-
 
3666
 
-
 
3667
     xor   eax, eax
-
 
3668
     ret
-
 
3669
 
-
 
3670
free_port_area:
-
 
3671
 
-
 
3672
;     pushad
-
 
3673
     mov   eax,[RESERVED_PORTS]     ; no reserved areas ?
-
 
3674
     test  eax,eax
-
 
3675
     jz    frpal2
-
 
3676
     mov   ebx,[TASK_BASE]
-
 
3677
     mov   ebx,[ebx+TASKDATA.pid]
-
 
3678
   frpal3:
-
 
3679
     mov   edi,eax
-
 
3680
     shl   edi,4
-
 
3681
     add   edi,RESERVED_PORTS
-
 
3682
     cmp   ebx,[edi]
-
 
3683
     jne   frpal4
-
 
3684
     cmp   ecx,[edi+4]
-
 
3685
     jne   frpal4
-
 
3686
     cmp   edx,[edi+8]
-
 
3687
     jne   frpal4
3356
get_irq_data:
3688
     jmp   frpal1
-
 
3689
   frpal4:
-
 
3690
     dec   eax
-
 
3691
     jnz   frpal3
-
 
3692
   frpal2:
-
 
3693
;     popad
-
 
3694
     inc   eax
-
 
3695
     ret
-
 
3696
   frpal1:
-
 
3697
	push	ecx
-
 
3698
	mov   ecx,256
-
 
3699
	sub   ecx,eax
-
 
3700
	shl   ecx,4
-
 
Line 3701... Line -...
3701
	mov   esi,edi
-
 
3702
	add   esi,16
-
 
3703
	cld
-
 
3704
	rep   movsb
-
 
3705
 
-
 
3706
	dec   dword [RESERVED_PORTS]
-
 
3707
;popad
-
 
3708
;disable port access at port IO map
-
 
3709
 
3357
	; removed
3710
;     pushad                        ; start disable io map
-
 
3711
     pop	eax	;start port
-
 
3712
     cmp   edx,65536 ;16384
-
 
3713
     jge   no_mask_io
-
 
3714
 
-
 
3715
;     mov   eax,ecx
-
 
3716
	xor	ebp,ebp
3358
     mov   dword [esp+32], -1                 
3717
	inc	ebp
-
 
3718
new_port_access_disable:
-
 
3719
;     pushad
3359
     ret
3720
;     mov   ebp,1                  ; disable - eax = port
3360
 
Line 3721... Line 3361...
3721
     call  set_io_access_rights
3361