Subversion Repositories Kolibri OS

Rev

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

Rev 3589 Rev 3626
Line 62... Line 62...
62
        sub     ecx, sizeof.ETH_header
62
        sub     ecx, sizeof.ETH_header
Line 63... Line 63...
63
 
63
 
64
        lea     edx, [eax + sizeof.ETH_header]
64
        lea     edx, [eax + sizeof.ETH_header]
Line 65... Line 65...
65
        mov     ax, [eax + ETH_header.Type]
65
        mov     ax, [eax + ETH_header.Type]
66
 
66
 
Line 67... Line 67...
67
        cmp     ax, ETHER_IPv4
67
        cmp     ax, ETHER_PROTO_IPv4
68
        je      IPv4_input
68
        je      IPv4_input
Line 69... Line 69...
69
 
69
 
70
        cmp     ax, ETHER_ARP
70
        cmp     ax, ETHER_PROTO_ARP
Line 71... Line 71...
71
        je      ARP_input
71
        je      ARP_input
72
 
72
 
Line 73... Line 73...
73
        cmp     ax, ETHER_IPv6
73
        cmp     ax, ETHER_PROTO_IPv6
74
        je      IPv6_input
74
        je      IPv6_input
Line 75... Line 75...
75
 
75
 
Line 76... Line 76...
76
        cmp     ax, ETHER_PPP_DISCOVERY
76
        cmp     ax, ETHER_PROTO_PPP_DISCOVERY
Line 160... Line 160...
160
 
160
 
161
;-----------------------------------------------------------------
161
;-----------------------------------------------------------------
162
;
162
;
163
; ETH_API
163
; ETH_API
164
;
164
;
165
; This function is called by system function 75
165
; This function is called by system function 76
166
;
166
;
167
; IN:  subfunction number in bl
167
; IN:  subfunction number in bl
168
;      device number in bh
168
;      device number in bh
169
;      ecx, edx, .. depends on subfunction
169
;      ecx, edx, .. depends on subfunction
Line 172... Line 172...
172
;
172
;
173
;-----------------------------------------------------------------
173
;-----------------------------------------------------------------
174
align 4
174
align 4
175
ETH_api:
175
ETH_api:
Line 176... Line 176...
176
 
176
 
177
        cmp     bh, MAX_NET_DEVICES
177
        cmp     bh, NET_DEVICES_MAX
178
        ja      .error
178
        ja      .error
179
        movzx   eax, bh
179
        movzx   eax, bh
180
        mov     eax, dword [NET_DRV_LIST + 4*eax]
180
        mov     eax, dword [NET_DRV_LIST + 4*eax]
181
        cmp     [eax + NET_DEVICE.type], NET_TYPE_ETH
181
        cmp     [eax + NET_DEVICE.device_type], NET_DEVICE_ETH
Line 182... Line 182...
182
        jne     .error
182
        jne     .error
183
 
183
 
184
        and     ebx, 0xff
184
        and     ebx, 0xff
185
        cmp     ebx, .number
185
        cmp     ebx, .number
Line 186... Line 186...
186
        ja      .error
186
        ja      .error
187
        jmp     dword [.table + 4*ebx]
-
 
188
 
-
 
189
  .table:
-
 
190
        dd      .packets_tx     ; 0
-
 
191
        dd      .packets_rx     ; 1
187
        jmp     dword [.table + 4*ebx]
192
        dd      .bytes_tx       ; 2
-
 
193
        dd      .bytes_rx       ; 3
188
 
Line 194... Line 189...
194
        dd      .read_mac       ; 4
189
  .table:
195
        dd      .state          ; 5
190
        dd      .read_mac       ; 0
196
  .number = ($ - .table) / 4 - 1
191
  .number = ($ - .table) / 4 - 1
Line 197... Line -...
197
 
-
 
198
  .error:
-
 
199
        or      eax, -1
-
 
200
        ret
-
 
201
 
-
 
202
  .packets_tx:
-
 
203
        mov     eax, [eax + NET_DEVICE.packets_tx]
-
 
204
 
-
 
205
        ret
-
 
206
 
-
 
207
  .packets_rx:
-
 
208
        mov     eax, [eax + NET_DEVICE.packets_rx]
-
 
209
        ret
-
 
210
 
-
 
211
  .bytes_tx:
-
 
212
        mov     ebx, dword [eax + NET_DEVICE.bytes_tx + 4]
-
 
213
        mov     eax, dword [eax + NET_DEVICE.bytes_tx]
-
 
214
        mov     [esp+20+4], ebx                         ; TODO: fix this ugly code
-
 
215
        ret
-
 
216
 
-
 
217
  .bytes_rx:
-
 
Line 218... Line 192...
218
        mov     ebx, dword [eax + NET_DEVICE.bytes_rx + 4]
192
 
219
        mov     eax, dword [eax + NET_DEVICE.bytes_rx]
193
  .error:
220
        mov     [esp+20+4], ebx                         ; TODO: fix this ugly code
194
        or      eax, -1
221
        ret
195
        ret
222
 
196
 
Line 223... Line -...
223
 
-
 
224
  .read_mac:
-
 
225
        movzx   ebx, word [eax + ETH_DEVICE.mac]
-