cyliu
论坛版主
论坛版主
  • 注册日期2003-06-13
  • 最后登录2014-04-11
  • 粉丝5
  • 关注0
  • 积分1238分
  • 威望2531点
  • 贡献值0点
  • 好评度577点
  • 原创分14分
  • 专家分10分
阅读:813回复:0

高手救急,AT&T转为Intel方式?

楼主#
更多 发布于:2005-07-07 16:02
/**
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格式的!谢谢!
走走看看开源好 Solaris vs Linux
游客

返回顶部