Subversion Repositories Kolibri OS

Rev

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

Rev 3601 Rev 3610
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;  loopback.inc                                                   ;;
6
;;  loopback.inc                                                   ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;  LoopBack device for KolibriOS                                  ;;
8
;;  LoopBack device for KolibriOS                                  ;;
Line 78... Line 78...
78
 
78
 
79
        push    ebx
79
        push    ebx
80
        push    ecx
80
        push    ecx
Line -... Line 81...
-
 
81
        push    eax
-
 
82
 
-
 
83
        inc     [LOOPBACK_DEVICE.packets_rx]
-
 
84
        add     dword[LOOPBACK_DEVICE.bytes_rx], ecx
81
        push    eax
85
        adc     dword[LOOPBACK_DEVICE.bytes_rx + 4], 0
82
 
86
 
83
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: size=%u\n", ecx
87
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_input: size=%u\n", ecx
84
        lea     edx, [eax + 4]
88
        lea     edx, [eax + 4]
Line 100... Line 104...
100
;
104
;
101
; LOOP_output
105
; LOOP_output
102
;
106
;
103
; IN:
107
; IN:
104
;     ecx = packet size
108
;       ecx = packet size
105
;      di = protocol
109
;       edi = address family
106
;
110
;
107
; OUT: edi = 0 on error, pointer to buffer otherwise
111
; OUT:  edi = 0 on error, pointer to buffer otherwise
108
;      eax = buffer start
112
;       eax = buffer start
109
;      ebx = to device structure
113
;       ebx = to device structure
110
;      ecx = unchanged (packet size of embedded data)
114
;       ecx = unchanged (packet size of embedded data)
Line 132... Line 136...
132
        lea     eax, [edi - 4]  ; Set eax to buffer start
136
        lea     eax, [edi - 4]  ; Set eax to buffer start
133
        pop     ecx
137
        pop     ecx
134
        lea     edx, [ecx + 4]  ; Set edx to complete buffer size
138
        lea     edx, [ecx + 4]  ; Set edx to complete buffer size
135
        mov     ebx, LOOPBACK_DEVICE
139
        mov     ebx, LOOPBACK_DEVICE
Line -... Line 140...
-
 
140
 
-
 
141
        inc     [LOOPBACK_DEVICE.packets_tx]
-
 
142
        add     dword[LOOPBACK_DEVICE.bytes_tx], ecx
136
 
143
        adc     dword[LOOPBACK_DEVICE.bytes_tx + 4], 0
137
  .done:
144
 
138
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_output: ptr=%x size=%u\n", eax, edx
145
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_output: ptr=%x size=%u\n", eax, edx
Line 139... Line 146...
139
        ret
146
        ret
140
 
147
 
141
  .out_of_ram:
148
  .out_of_ram:
142
        DEBUGF  DEBUG_NETWORK_VERBOSE, "LOOP_output: failed\n"
149
        DEBUGF  DEBUG_NETWORK_ERROR, "LOOP_output: out of memory\n"
143
        add     esp, 4+4
150
        add     esp, 4+4