⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uip.lst

📁 一个AVR 上的UIP移植程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 412:uip.c         ****   }
 413:uip.c         **** #endif /* UIP_BUFSIZE > 255 */  
 414:uip.c         **** 
 415:uip.c         ****   if(BUF->ipoffset[0] & 0x3f) { /* We don't allow IP fragments. */
 391               		.stabn 68,0,415,.LM51-uip_process
 392               	.LM51:
 393 01ca 8091 0000 		lds r24,uip_buf+20
 394 01ce 9927      		clr r25
 395 01d0 8F73      		andi r24,lo8(63)
 396 01d2 9070      		andi r25,hi8(63)
 397 01d4 892B      		or r24,r25
 398 01d6 09F0      		breq .+2
 399 01d8 4CC4      		rjmp .L58
 416:uip.c         ****     UIP_STAT(++uip_stat.ip.drop);
 417:uip.c         ****     UIP_STAT(++uip_stat.ip.fragerr);
 418:uip.c         ****     UIP_LOG("ip:frag");    
 419:uip.c         ****     goto drop;
 420:uip.c         ****   }
 421:uip.c         **** 
 422:uip.c         ****   /* Check if the packet is destined for our IP address. */
 423:uip.c         ****   if(BUF->destipaddr[0] != htons(((u16_t)UIP_IPADDR0 << 8) | UIP_IPADDR1)) {
 400               		.stabn 68,0,423,.LM52-uip_process
 401               	.LM52:
 402 01da 8091 0000 		lds r24,uip_buf+30
 403 01de 9091 0000 		lds r25,(uip_buf+30)+1
 404 01e2 805C      		subi r24,lo8(-22336)
 405 01e4 984A      		sbci r25,hi8(-22336)
 406 01e6 09F0      		breq .+2
 407 01e8 44C4      		rjmp .L58
 424:uip.c         ****     UIP_STAT(++uip_stat.ip.drop);
 425:uip.c         ****     UIP_LOG("ip:wrnip");        
 426:uip.c         ****     goto drop;
 427:uip.c         ****   }
 428:uip.c         ****   if(BUF->destipaddr[1] != htons(((u16_t)UIP_IPADDR2 << 8) | UIP_IPADDR3)) {
 408               		.stabn 68,0,428,.LM53-uip_process
 409               	.LM53:
 410 01ea 8091 0000 		lds r24,uip_buf+32
 411 01ee 9091 0000 		lds r25,(uip_buf+32)+1
 412 01f2 8150      		subi r24,lo8(3073)
 413 01f4 9C40      		sbci r25,hi8(3073)
 414 01f6 09F0      		breq .+2
 415 01f8 3CC4      		rjmp .L58
 429:uip.c         ****     UIP_STAT(++uip_stat.ip.drop);
 430:uip.c         ****     UIP_LOG("ip:wrnip");        
 431:uip.c         ****     goto drop;
 432:uip.c         ****   }
 433:uip.c         **** 
 434:uip.c         ****   if(uip_ipchksum() != 0xffff) { /* Compute and check the IP header
 416               		.stabn 68,0,434,.LM54-uip_process
 417               	.LM54:
 418 01fa 0E94 0000 		call uip_ipchksum
 419 01fe 8F5F      		subi r24,lo8(-1)
 420 0200 9F4F      		sbci r25,hi8(-1)
 421 0202 09F0      		breq .+2
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/ccSyaaaa.s 			page 16


 422 0204 36C4      		rjmp .L58
 435:uip.c         **** 				    checksum. */
 436:uip.c         ****     UIP_STAT(++uip_stat.ip.drop);
 437:uip.c         ****     UIP_STAT(++uip_stat.ip.chkerr);
 438:uip.c         ****     UIP_LOG("ip:ck");    
 439:uip.c         ****     goto drop;
 440:uip.c         ****   }
 441:uip.c         **** 
 442:uip.c         ****   if(BUF->proto == IP_PROTO_TCP)  /* Check for TCP packet. If so, jump
 423               		.stabn 68,0,442,.LM55-uip_process
 424               	.LM55:
 425 0206 8091 0000 		lds r24,uip_buf+23
 426 020a 8630      		cpi r24,lo8(6)
 427 020c F1F1      		breq .L67
 443:uip.c         ****                                      to the tcp_input label. */
 444:uip.c         ****     goto tcp_input;
 445:uip.c         **** 
 446:uip.c         ****   if(BUF->proto != IP_PROTO_ICMP) { /* We only allow ICMP packets from
 428               		.stabn 68,0,446,.LM56-uip_process
 429               	.LM56:
 430 020e 8130      		cpi r24,lo8(1)
 431 0210 09F0      		breq .+2
 432 0212 2FC4      		rjmp .L58
 447:uip.c         **** 				       here. */
 448:uip.c         ****     UIP_STAT(++uip_stat.ip.drop);
 449:uip.c         ****     UIP_STAT(++uip_stat.ip.protoerr);
 450:uip.c         ****     UIP_LOG("ip:prot");        
 451:uip.c         ****     goto drop;
 452:uip.c         ****   }
 453:uip.c         **** 
 454:uip.c         ****   UIP_STAT(++uip_stat.icmp.recv);
 455:uip.c         ****   
 456:uip.c         ****   /* ICMP echo (i.e., ping) processing. This is simple, we only change
 457:uip.c         ****      the ICMP type from ECHO to ECHO_REPLY and adjust the ICMP
 458:uip.c         ****      checksum before we return the packet. */
 459:uip.c         ****   if(ICMPBUF->type != ICMP_ECHO) {
 433               		.stabn 68,0,459,.LM57-uip_process
 434               	.LM57:
 435 0214 8091 0000 		lds r24,uip_buf+34
 436 0218 8830      		cpi r24,lo8(8)
 437 021a 09F0      		breq .+2
 438 021c 2AC4      		rjmp .L58
 460:uip.c         ****     UIP_STAT(++uip_stat.icmp.drop);
 461:uip.c         ****     UIP_STAT(++uip_stat.icmp.typeerr);
 462:uip.c         ****     UIP_LOG("icmp:");
 463:uip.c         ****     goto drop;
 464:uip.c         ****   }
 465:uip.c         **** 
 466:uip.c         ****   ICMPBUF->type = ICMP_ECHO_REPLY;
 439               		.stabn 68,0,466,.LM58-uip_process
 440               	.LM58:
 441 021e C093 0000 		sts uip_buf+34,r28
 467:uip.c         ****   
 468:uip.c         ****   if(ICMPBUF->icmpchksum >= htons(0xffff - (ICMP_ECHO << 8))) {
 442               		.stabn 68,0,468,.LM59-uip_process
 443               	.LM59:
 444 0222 8091 0000 		lds r24,uip_buf+36
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/ccSyaaaa.s 			page 17


 445 0226 9091 0000 		lds r25,(uip_buf+36)+1
 446 022a 2FEF      		ldi r18,hi8(-9)
 447 022c 873F      		cpi r24,lo8(-9)
 448 022e 9207      		cpc r25,r18
 449 0230 10F0      		brlo .L70
 469:uip.c         ****     ICMPBUF->icmpchksum += htons(ICMP_ECHO << 8) + 1;
 450               		.stabn 68,0,469,.LM60-uip_process
 451               	.LM60:
 452 0232 0996      		adiw r24,9
 453 0234 01C0      		rjmp .L174
 454               	.L70:
 470:uip.c         ****   } else {
 471:uip.c         ****     ICMPBUF->icmpchksum += htons(ICMP_ECHO << 8);
 455               		.stabn 68,0,471,.LM61-uip_process
 456               	.LM61:
 457 0236 0896      		adiw r24,8
 458               	.L174:
 459 0238 9093 0000 		sts (uip_buf+36)+1,r25
 460 023c 8093 0000 		sts uip_buf+36,r24
 472:uip.c         ****   }
 473:uip.c         ****   
 474:uip.c         ****   /* Swap IP addresses. */
 475:uip.c         ****   tmpport = BUF->destipaddr[0];
 461               		.stabn 68,0,475,.LM62-uip_process
 462               	.LM62:
 463 0240 2091 0000 		lds r18,uip_buf+30
 464 0244 3091 0000 		lds r19,(uip_buf+30)+1
 476:uip.c         ****   BUF->destipaddr[0] = BUF->srcipaddr[0];
 465               		.stabn 68,0,476,.LM63-uip_process
 466               	.LM63:
 467 0248 8091 0000 		lds r24,uip_buf+26
 468 024c 9091 0000 		lds r25,(uip_buf+26)+1
 469 0250 9093 0000 		sts (uip_buf+30)+1,r25
 470 0254 8093 0000 		sts uip_buf+30,r24
 477:uip.c         ****   BUF->srcipaddr[0] = tmpport;
 471               		.stabn 68,0,477,.LM64-uip_process
 472               	.LM64:
 473 0258 3093 0000 		sts (uip_buf+26)+1,r19
 474 025c 2093 0000 		sts uip_buf+26,r18
 478:uip.c         ****   tmpport = BUF->destipaddr[1];
 475               		.stabn 68,0,478,.LM65-uip_process
 476               	.LM65:
 477 0260 2091 0000 		lds r18,uip_buf+32
 478 0264 3091 0000 		lds r19,(uip_buf+32)+1
 479 0268 3093 0000 		sts (tmpport)+1,r19
 480 026c 2093 0000 		sts tmpport,r18
 479:uip.c         ****   BUF->destipaddr[1] = BUF->srcipaddr[1];
 481               		.stabn 68,0,479,.LM66-uip_process
 482               	.LM66:
 483 0270 8091 0000 		lds r24,uip_buf+28
 484 0274 9091 0000 		lds r25,(uip_buf+28)+1
 485 0278 9093 0000 		sts (uip_buf+32)+1,r25
 486 027c 8093 0000 		sts uip_buf+32,r24
 480:uip.c         ****   BUF->srcipaddr[1] = tmpport;
 487               		.stabn 68,0,480,.LM67-uip_process
 488               	.LM67:
 489 0280 3093 0000 		sts (uip_buf+28)+1,r19
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/ccSyaaaa.s 			page 18


 490 0284 2093 0000 		sts uip_buf+28,r18
 481:uip.c         **** 
 482:uip.c         ****   UIP_STAT(++uip_stat.icmp.sent);
 483:uip.c         ****   goto send;
 491               		.stabn 68,0,483,.LM68-uip_process
 492               	.LM68:
 493 0288 F6C3      		rjmp .L27
 494               	.L67:
 484:uip.c         **** 
 485:uip.c         ****   /* TCP input processing. */  
 486:uip.c         ****  tcp_input:
 487:uip.c         ****   UIP_STAT(++uip_stat.tcp.recv);
 488:uip.c         ****     
 489:uip.c         ****   if(uip_tcpchksum() != 0xffff) {   /* Compute and check the TCP
 495               		.stabn 68,0,489,.LM69-uip_process
 496               	.LM69:
 497 028a 0E94 0000 		call uip_tcpchksum
 498 028e 8F5F      		subi r24,lo8(-1)
 499 0290 9F4F      		sbci r25,hi8(-1)
 500 0292 09F0      		breq .+2
 501 0294 EEC3      		rjmp .L58
 490:uip.c         **** 				       checksum. */
 491:uip.c         ****     UIP_STAT(++uip_stat.tcp.drop);
 492:uip.c         ****     UIP_STAT(++uip_stat.tcp.chkerr);
 493:uip.c         ****     UIP_LOG("tcp:csum");    
 494:uip.c         ****     goto drop;
 495:uip.c         ****   }
 496:uip.c         ****   
 497:uip.c         ****   /* Demultiplex this segment. */
 498:uip.c         ****   /* First check any active connections. */
 499:uip.c         ****   for(uip_conn = &uip_conns[0]; uip_conn < &uip_conns[UIP_CONNS]; ++uip_conn) {
 502               		.stabn 68,0,499,.LM70-uip_process
 503               	.LM70:
 504 0296 80E0      		ldi r24,lo8(uip_conns)
 505 0298 90E0      		ldi r25,hi8(uip_conns)
 506 029a 9093 0000 		sts (uip_conn)+1,r25
 507 029e 8093 0000 		sts uip_conn,r24
 508 02a2 8050      		subi r24,lo8(uip_conns+25)
 509 02a4 9040      		sbci r25,hi8(uip_conns+25)
 510 02a6 A8F5      		brsh .L167
 511               	.L80:
 500:uip.c         ****     if(uip_conn->tcpstateflags != CLOSED &&
 512               		.stabn 68,0,500,.LM71-uip_process
 513               	.LM71:
 514 02a8 E091 0000 		lds r30,uip_conn
 515 02ac F091 0000 		lds r31,(uip_conn)+1
 516 02b0 8081      		ld r24,Z
 517 02b2 8823      		tst r24
 518 02b4 29F1      		breq .L76
 519 02b6 2091 0000 		lds r18,uip_buf+26
 520 02ba 3091 0000 		lds r19,(uip_buf+26)+1
 521 02be 8581      		ldd r24,Z+5
 522 02c0 9681      		ldd r25,Z+6
 523 02c2 2817      		cp r18,r24
 524 02c4 3907      		cpc r19,r25
 525 02c6 E1F4      		brne .L76
 526 02c8 2091 0000 		lds r18,uip_buf+28
GAS LISTING C:\DOCUME~1\pstang\LOCALS~1\Temp/ccSyaaaa.s 			page 19


 527 02cc 3091 0000 		lds r19,(uip_buf+28)+1
 528 02d0 8781      		ldd r24,Z+7
 529 02d2 9085      		ldd r25,Z+8
 530 02d4 2817      		cp r18,r24
 531 02d6 3907      		cpc r19,r25
 532 02d8 99F4      		brne .L76
 533 02da 2091 0000 		lds r18,uip_buf+36
 534 02de 3091 0000 		lds r19,(uip_buf+36)+1
 535 02e2 8181      		ldd r24,Z+1
 536 02e4 9281      		ldd r25,Z+2
 537 02e6 2817      		cp r18,r24
 538 02e8 3907      		cpc r19,r25
 539 02ea 51F4      		brne .L76
 540 02ec 2091 0000 		lds r18,uip_buf+34
 541 02f0 3091 0000 		lds r19,(uip_buf+34)+1
 542 02f4 8381      		ldd r24,Z+3
 543 02f6 9481      		ldd r25,Z+4
 544 02f8 2817      		cp r18,r24
 545 02fa 3907      		cpc r19,r25
 546 02fc 09F4      		brne .+2
 547 02fe A9C1      		rjmp .L79
 548               		.stabn 68,0,499,.LM72-uip_process
 549               	.LM72:
 550               	.L76:
 551 0300 CF01      		movw r24,r30
 552 0302 4996      		adiw r24,25
 553 0304 9093 0000 		sts (uip_conn)+1,r25
 554 0308 8093 0000 		sts uip_conn,r24
 555 030c 8050      		subi r24,lo8(uip_conns+25)
 556 030e 9040      		sbci r25,hi8(uip_conns+25)
 557 0310 58F2      		brlo .L80
 558               	.L167:
 501:uip.c         ****        BUF->srcipaddr[0] == uip_conn->ripaddr[0] &&
 502:uip.c         ****        BUF->srcipaddr[1] == uip_conn->ripaddr[1] &&
 503:uip.c         ****        BUF->destport == uip_conn->lport &&
 504:uip.c         ****        BUF->srcport == uip_conn->rport)
 505:uip.c         ****       goto found;    
 506:uip.c         ****   }
 507:uip.c         **** 
 508:uip.c         ****   /* If we didn't find and active connection that expected the packet,
 509:uip.c         ****      either this packet is an old duplicate, or this is a SYN packet
 510:uip.c         ****      destined for a connection in LISTEN. If the SYN flag isn't set,
 511:uip.c         ****      it is an old packet and we send a RST. */
 512:uip.c         ****   if(BUF->flags != TCP_SYN)
 559               		.stabn 68,0,512,.LM73-uip_process

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -