Subversion Repositories Kolibri OS

Rev

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

Rev 3601 Rev 3643
Line 448... Line 448...
448
; OUT: edi = -1 on error, device number otherwise
448
; OUT: edi = -1 on error, device number otherwise
449
;
449
;
450
;-----------------------------------------------------------------
450
;-----------------------------------------------------------------
451
align 4
451
align 4
452
NET_ptr_to_num:
452
NET_ptr_to_num:
-
 
453
 
-
 
454
        call    NET_ptr_to_num4
-
 
455
        ror     edi, 2          ; If -1, stay -1
-
 
456
                                ; valid device numbers have last two bits 0, so do just shr
-
 
457
 
-
 
458
        ret
-
 
459
 
-
 
460
align 4
-
 
461
NET_ptr_to_num4:                ; Todo, place number in device structure so we only need to verify?
-
 
462
 
453
        push    ecx
463
        push    ecx
Line 454... Line 464...
454
 
464
 
455
        mov     ecx, NET_DEVICES_MAX
465
        mov     ecx, NET_DEVICES_MAX
456
        mov     edi, NET_DRV_LIST
-
 
457
 
466
        mov     edi, NET_DRV_LIST
458
  .loop:
467
  .loop:
459
        cmp     ebx, [edi]
468
        cmp     ebx, [edi]
460
        jz      .found
469
        je      .found
461
        add     edi, 4
470
        add     edi, 4
462
        dec     ecx
471
        dec     ecx
Line 463... Line -...
463
        jnz     .loop
-
 
464
 
-
 
465
        ; repnz  scasd could work too if eax is used instead of ebx!
472
        jnz     .loop
466
 
-
 
467
        or      edi, -1
473
 
468
 
474
        or      edi, -1
Line 469... Line 475...
469
        pop     ecx
475
        pop     ecx
470
        ret
476
        ret
471
 
-
 
472
  .found:
-
 
473
        sub     edi, NET_DRV_LIST
477
 
474
        shr     edi, 2
478
  .found:
Line 475... Line 479...
475
 
479
        sub     edi, NET_DRV_LIST
476
        pop     ecx
480
        pop     ecx