阅读:813回复:0
高手救急,AT&T转为Intel方式?
/**
42 | * ip_fast_csum - Compute the IPv4 header checksum efficiently. 43 | * iph: ipv4 header 44 | * ihl: length of header / 4 45 | */ 46 | static inline unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl) 47 | { 48 | unsigned int sum; 49 | 50 | asm( " movl (%1), %0\n" 51 | " subl $4, %2\n" 52 | " jbe 2f\n" 53 | " addl 4(%1), %0\n" 54 | " adcl 8(%1), %0\n" 55 | " adcl 12(%1), %0\n" 56 | "1: adcl 16(%1), %0\n" 57 | " lea 4(%1), %1\n" 58 | " decl %2\n" 59 | " jne 1b\n" 60 | " adcl $0, %0\n" 61 | " movl %0, %2\n" 62 | " shrl $16, %0\n" 63 | " addw %w2, %w0\n" 64 | " adcl $0, %0\n" 65 | " notl %0\n" 66 | "2:" 67 | /* Since the input registers which are loaded with iph and ipl 68 | are modified, we must also specify them as outputs, or gcc 69 | will assume they contain their original values. */ 70 | : "=r" (sum), "=r" (iph), "=r" (ihl) 71 | : "1" (iph), "2" (ihl) 72 | : "memory"); 73 | return(sum); 74 | } 我不懂At&t格式的汇编,高手帮我把他转为Intel格式的!谢谢! |
|
|