Subversion Repositories Kolibri OS

Rev

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

Rev 7679 Rev 7680
Line 13... Line 13...
13
;;         GNU GENERAL PUBLIC LICENSE                              ;;
13
;;         GNU GENERAL PUBLIC LICENSE                              ;;
14
;;          Version 2, June 1991                                   ;;
14
;;          Version 2, June 1991                                   ;;
15
;;                                                                 ;;
15
;;                                                                 ;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 17... Line 17...
17
 
17
 
Line 18... Line 18...
18
$Revision: 7679 $
18
$Revision: 7680 $
Line 19... Line 19...
19
 
19
 
20
struct  SOCKET
20
struct  SOCKET
Line 918... Line 918...
918
align 4
918
align 4
919
socket_receive_stream:
919
socket_receive_stream:
Line 920... Line 920...
920
 
920
 
Line 921... Line 921...
921
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n"
921
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_receive: STREAM\n"
922
 
922
 
Line 923... Line 923...
923
        cmp     [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
923
        cmp     [eax + STREAM_SOCKET.rcv.size], 0
924
        je      .wouldblock
924
        je      .wouldblock
Line 934... Line 934...
934
        add     eax, STREAM_SOCKET.rcv
934
        add     eax, STREAM_SOCKET.rcv
935
        call    socket_ring_read                                ; copy data from kernel buffer to application buffer
935
        call    socket_ring_read                                ; copy data from kernel buffer to application buffer
936
        call    socket_ring_free                                ; free read memory
936
        call    socket_ring_free                                ; free read memory
937
        pop     eax
937
        pop     eax
Line 938... Line 938...
938
 
938
 
939
        cmp     [eax + STREAM_SOCKET.rcv + RING_BUFFER.size], 0
939
        cmp     [eax + STREAM_SOCKET.rcv.size], 0
940
        jne     .more_data
940
        jne     .more_data
941
        xor     ebx, ebx                                        ; errorcode = 0 (no error)
941
        xor     ebx, ebx                                        ; errorcode = 0 (no error)
Line 942... Line 942...
942
        ret
942
        ret
Line 951... Line 951...
951
        pop     ebx
951
        pop     ebx
952
        xor     ecx, ecx
952
        xor     ecx, ecx
953
        ret
953
        ret
Line 954... Line 954...
954
 
954
 
955
  .peek:
955
  .peek:
956
        mov     ecx, [eax + STREAM_SOCKET.rcv + RING_BUFFER.size]
956
        mov     ecx, [eax + STREAM_SOCKET.rcv.size]
957
        xor     ebx, ebx
957
        xor     ebx, ebx
Line 958... Line 958...
958
        ret
958
        ret
Line 1559... Line 1559...
1559
        popa
1559
        popa
Line 1560... Line 1560...
1560
 
1560
 
Line 1561... Line 1561...
1561
        jmp     socket_notify
1561
        jmp     socket_notify
1562
 
1562
 
Line 1563... Line 1563...
1563
  .full:
1563
  .full:
1564
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_input: socket %x is full!\n", eax
1564
        DEBUGF  DEBUG_NETWORK_ERROR, "SOCKET_input: socket %x is full!\n", eax
1565
 
1565
 
1566
        pusha
1566
        pusha
Line 1655... Line 1655...
1655
        add     edi, ecx
1655
        add     edi, ecx
1656
        cmp     edi, [eax + RING_BUFFER.end_ptr]
1656
        cmp     edi, [eax + RING_BUFFER.end_ptr]
1657
        jb      @f
1657
        jb      @f
1658
        sub     edi, SOCKET_BUFFER_SIZE                         ; WRAP
1658
        sub     edi, SOCKET_BUFFER_SIZE                         ; WRAP
1659
  @@:
1659
  @@:
1660
 
-
 
1661
        mov     [eax + RING_BUFFER.write_ptr], edi
1660
        mov     [eax + RING_BUFFER.write_ptr], edi
1662
        pop     edi
1661
        pop     edi
Line 1663... Line 1662...
1663
 
1662
 
1664
; update size
1663
; update size
Line 1751... Line 1750...
1751
        pusha
1750
        pusha
1752
        lea     ecx, [eax + RING_BUFFER.mutex]
1751
        lea     ecx, [eax + RING_BUFFER.mutex]
1753
        call    mutex_unlock                                    ; TODO: check what registers this function actually destroys
1752
        call    mutex_unlock                                    ; TODO: check what registers this function actually destroys
1754
        popa
1753
        popa
Line 1755... Line 1754...
1755
 
1754
 
1756
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_ring_read: no data at all!\n"
1755
        DEBUGF  DEBUG_NETWORK_ERROR, "SOCKET_ring_read: no data at all!\n"
1757
        xor     ecx, ecx
1756
        xor     ecx, ecx
Line 1758... Line 1757...
1758
        ret
1757
        ret
1759
 
1758
 
Line 1798... Line 1797...
1798
        pop     ecx eax
1797
        pop     ecx eax
Line 1799... Line 1798...
1799
 
1798
 
Line 1800... Line 1799...
1800
        ret
1799
        ret
1801
 
1800
 
1802
  .error:       ; we could free all available bytes, but that would be stupid, i guess..
1801
  .error:       ; we could free all available bytes, but that would be stupid, i guess..
Line 1803... Line 1802...
1803
        DEBUGF  DEBUG_NETWORK_VERBOSE, "SOCKET_ring_free: buffer=%x error!\n", eax
1802
        DEBUGF  DEBUG_NETWORK_ERROR, "SOCKET_ring_free: buffer=%x error!\n", eax
1804
        add     [eax + RING_BUFFER.size], ecx
1803
        add     [eax + RING_BUFFER.size], ecx
1805
 
1804