Rev 1274 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1274 | Rev 1473 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
12 | ;; GNU GENERAL PUBLIC LICENSE ;; |
13 | ;; Version 2, June 1991 ;; |
13 | ;; Version 2, June 1991 ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
Line 17... | Line 17... | ||
17 | $Revision: 1274 $ |
17 | $Revision: 1473 $ |
18 | 18 | ||
Line 19... | Line 19... | ||
19 | MAX_ETH_DEVICES equ MAX_NET_DEVICES |
19 | MAX_ETH_DEVICES equ MAX_NET_DEVICES |
Line 151... | Line 151... | ||
151 | DEBUGF 1,"- succes: %u\n",eax |
151 | DEBUGF 1,"- succes: %u\n",eax |
152 | ret |
152 | ret |
Line 153... | Line 153... | ||
153 | 153 | ||
154 | .error: |
154 | .error: |
155 | or eax, -1 |
155 | or eax, -1 |
156 | DEBUGF 1,"- fail\n" |
156 | DEBUGF 2,"Adding ETH device failed\n" |
Line 217... | Line 217... | ||
217 | ; |
217 | ; |
218 | ;----------------------------------------------------------------- |
218 | ;----------------------------------------------------------------- |
219 | align 4 |
219 | align 4 |
220 | ETH_receiver: |
220 | ETH_receiver: |
Line 221... | Line 221... | ||
221 | 221 | ||
222 | DEBUGF 1,"ETH_Receiver: " |
222 | ; DEBUGF 1,"ETH_Receiver: " |
223 | push ebx |
223 | ; push ebx |
224 | mov esi, esp |
224 | ; mov esi, esp |
225 | add_to_queue ETH_IN_QUEUE, ETH_QUEUE_SIZE, eth_queue_entry.size, .fail |
225 | ; add_to_queue ETH_IN_QUEUE, ETH_QUEUE_SIZE, eth_queue_entry.size, .fail |
226 | DEBUGF 1,"Queued packet successfully\n" |
226 | ; DEBUGF 1,"Queued packet successfully\n" |
227 | add esp, 4*3 |
227 | ; add esp, 4*3 |
228 | 228 | ; |
|
229 | ret |
229 | ; ret |
230 | 230 | ; |
|
231 | .fail: |
231 | ; .fail: |
232 | DEBUGF 1,"ETH_IN_QUEUE is full!\n" |
232 | ; DEBUGF 1,"ETH_IN_QUEUE is full!\n" |
233 | add esp, 4 |
233 | ; add esp, 4 |
234 | call kernel_free |
234 | ; call kernel_free |
235 | add esp, 4 |
235 | ; add esp, 4 |
236 | 236 | ; |
|
237 | ret |
- | |
238 | - | ||
239 | - | ||
240 | - | ||
241 | ;----------------------------------------------------------------- |
237 | ; ret |
242 | ; |
- | |
243 | ; ETH_Handler: |
238 | ; |
244 | ; |
- | |
245 | ; Handles all queued eth packets (called from kernel's main_loop) |
239 | ; |
- | 240 | ; |
|
- | 241 | ;;----------------------------------------------------------------- |
|
- | 242 | ;; |
|
- | 243 | ;; ETH_Handler: |
|
- | 244 | ;; |
|
- | 245 | ;; Handles all queued eth packets (called from kernel's main_loop) |
|
246 | ; |
246 | ;; |
247 | ; IN: / |
247 | ;; IN: / |
248 | ; OUT: / |
248 | ;; OUT: / |
249 | ; |
249 | ;; |
250 | ;----------------------------------------------------------------- |
250 | ;;----------------------------------------------------------------- |
251 | align 4 |
251 | ;align 4 |
252 | ETH_handler: |
252 | ;ETH_handler: |
253 | 253 | ; |
|
254 | get_from_queue ETH_IN_QUEUE, ETH_QUEUE_SIZE, eth_queue_entry.size, .gohome |
254 | ; get_from_queue ETH_IN_QUEUE, ETH_QUEUE_SIZE, eth_queue_entry.size, .gohome |
255 | 255 | ; |
|
256 | push ETH_handler |
256 | ; push ETH_handler |
257 | 257 | ; |
|
258 | lodsd |
258 | ; lodsd |
259 | mov ebx, eax |
259 | ; mov ebx, eax |
260 | lodsd |
260 | ; lodsd |
261 | mov ecx, eax |
261 | ; mov ecx, eax |
262 | lodsd |
262 | ; lodsd |
263 | xchg eax, ecx |
263 | ; xchg eax, ecx |
- | 264 | ; push ecx |
|
- | 265 | ; push eax |
|
- | 266 | ||
- | 267 | ||
264 | push ecx |
268 | ;----------------------------- |
- | 269 | mov eax, [esp] |
|
- | 270 | mov ecx, [esp+4] |
|
Line 265... | Line 271... | ||
265 | push eax |
271 | ;----------------------------- |
266 | 272 | ||
267 | DEBUGF 1,"ETH_Handler - size: %u\n", ecx |
273 | DEBUGF 1,"ETH_Handler - size: %u\n", ecx |
268 | cmp ecx, 60 ; check packet length |
274 | cmp ecx, 60 ; check packet length |
Line 276... | Line 282... | ||
276 | je IPv4_handler |
282 | je IPv4_handler |
Line 277... | Line 283... | ||
277 | 283 | ||
278 | cmp ax, ETHER_ARP |
284 | cmp ax, ETHER_ARP |
Line 279... | Line 285... | ||
279 | je ARP_handler |
285 | je ARP_handler |
Line 280... | Line 286... | ||
280 | 286 | ||
281 | DEBUGF 1,"Unknown ethernet packet type %x\n", ax |
287 | DEBUGF 2,"Unknown ethernet packet type %x\n", ax |
282 | 288 | ||
283 | .dump: |
289 | .dump: |
Line 284... | Line 290... | ||
284 | DEBUGF 1,"Dumping packet\n" |
290 | DEBUGF 2,"ETH_Handler - dumping\n" |
285 | call kernel_free |
291 | call kernel_free |
Line -... | Line 292... | ||
- | 292 | add esp, 4 |
|
- | 293 | ||
- | 294 | .gohome: |
|
- | 295 | ret ; return to get more from queue / to caller |
|
- | 296 | ||
- | 297 | ||
286 | add esp, 4 |
298 | |
287 | 299 | ||
288 | .gohome: |
300 | align 4 |
289 | ret ; return to get more from queue / to caller |
301 | ETH_handler: |
290 | 302 | ret |
|
Line 364... | Line 376... | ||
364 | ; OUT: edi is -1 on error, device number otherwise |
376 | ; OUT: edi is -1 on error, device number otherwise |
365 | ; |
377 | ; |
366 | ;----------------------------------------------------------------- |
378 | ;----------------------------------------------------------------- |
367 | align 4 |
379 | align 4 |
368 | ETH_struc2dev: |
380 | ETH_struc2dev: |
369 | push eax ecx |
381 | push ecx |
Line 370... | Line -... | ||
370 | - | ||
371 | mov eax, ebx |
382 | |
372 | mov ecx, MAX_ETH_DEVICES |
383 | mov ecx, MAX_ETH_DEVICES |
Line 373... | Line -... | ||
373 | mov edi, ETH_DRV_LIST |
- | |
374 | - | ||
Line -... | Line 384... | ||
- | 384 | mov edi, ETH_DRV_LIST |
|
375 | repne scasd |
385 | |
- | 386 | ||
376 | jnz .error |
387 | .loop: |
- | 388 | cmp ebx, [edi] |
|
- | 389 | jz .found |
|
Line 377... | Line -... | ||
377 | - | ||
378 | sub edi, ETH_DRV_LIST+4 |
- | |
379 | shr edi, 2 |
- | |
380 | 390 | add edi, 4 |
|
381 | pop ecx eax |
- | |
Line -... | Line 391... | ||
- | 391 | dec ecx |
|
- | 392 | jnz .loop |
|
- | 393 | ||
- | 394 | or edi, -1 |
|
- | 395 | ||
- | 396 | pop ecx |
|
- | 397 | ret |
|
- | 398 | ||
382 | ret |
399 | .found: |
Line 383... | Line 400... | ||
383 | .error: |
400 | sub edi, ETH_DRV_LIST |
384 | or edi, -1 |
401 | shr edi, 2 |
Line 450... | Line 467... | ||
450 | 467 | ||
451 | DEBUGF 1,"done: %x size:%u device:%x\n", eax, edx, ebx |
468 | DEBUGF 1,"done: %x size:%u device:%x\n", eax, edx, ebx |
Line 452... | Line 469... | ||
452 | ret |
469 | ret |
453 | 470 | ||
454 | .pop_exit: |
471 | .pop_exit: |
455 | DEBUGF 1,"Out of ram space!!\n" |
472 | DEBUGF 2,"Out of ram space!!\n" |
456 | add esp, 18 |
473 | add esp, 18 |
Line 457... | Line 474... | ||
457 | or edi,-1 |
474 | or edi,-1 |
458 | ret |
475 | ret |
459 | 476 | ||
460 | .exit: |
477 | .exit: |