2002-02-14 19:11:21

by David Ford

[permalink] [raw]
Subject: [PATCH] include/asm/checksum.h trigraph cleanups

Subject says all, this is against 2.4.18-rc1. Assembler blocks aligned
with style used for first assembler block.

-d

--- include/asm/checksum.h.orig Thu Feb 14 14:06:31 2002
+++ include/asm/checksum.h Thu Feb 14 14:05:16 2002
@@ -69,30 +69,31 @@
unsigned int ihl) {
unsigned int sum;

- __asm__ __volatile__("
- movl (%1), %0
- subl $4, %2
- jbe 2f
- addl 4(%1), %0
- adcl 8(%1), %0
- adcl 12(%1), %0
-1: adcl 16(%1), %0
- lea 4(%1), %1
- decl %2
- jne 1b
- adcl $0, %0
- movl %0, %2
- shrl $16, %0
- addw %w2, %w0
- adcl $0, %0
- notl %0
-2:
- "
+ __asm__ __volatile__(
+" movl (%1), %0 \n"
+" subl $4, %2 \n"
+" jbe 2f \n"
+" addl 4(%1), %0 \n"
+" adcl 8(%1), %0 \n"
+" adcl 12(%1), %0 \n"
+"1: adcl 16(%1), %0 \n"
+" lea 4(%1), %1 \n"
+" decl %2 \n"
+" jne 1b \n"
+" adcl $0, %0 \n"
+" movl %0, %2 \n"
+" shrl $16, %0 \n"
+" addw %w2, %w0 \n"
+" adcl $0, %0 \n"
+" notl %0 \n"
+"2: \n"
+
/* Since the input registers which are loaded with iph and ipl
are modified, we must also specify them as outputs, or gcc
will assume they contain their original values. */
: "=r" (sum), "=r" (iph), "=r" (ihl)
: "1" (iph), "2" (ihl));
+
return(sum);
}

@@ -102,13 +103,13 @@

static inline unsigned int csum_fold(unsigned int sum)
{
- __asm__("
- addl %1, %0
- adcl $0xffff, %0
- "
- : "=r" (sum)
- : "r" (sum << 16), "0" (sum & 0xffff0000)
- );
+ __asm__(
+" addl %1, %0 \n"
+" adcl $0xffff, %0 \n"
+
+ : "=r" (sum)
+ : "r" (sum << 16), "0" (sum & 0xffff0000));
+
return (~sum) >> 16;
}

@@ -118,15 +119,16 @@
unsigned short proto,
unsigned int sum)
{
- __asm__("
- addl %1, %0
- adcl %2, %0
- adcl %3, %0
- adcl $0, %0
- "
+ __asm__(
+" addl %1, %0 \n"
+" adcl %2, %0 \n"
+" adcl %3, %0 \n"
+" adcl $0, %0 \n"
+
: "=r" (sum)
: "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256),
"0"(sum));
- return sum;
+
+ return sum;
}

/*
@@ -158,22 +160,22 @@
unsigned short proto,
unsigned int sum)
{
- __asm__("
- addl 0(%1), %0
- adcl 4(%1), %0
- adcl 8(%1), %0
- adcl 12(%1), %0
- adcl 0(%2), %0
- adcl 4(%2), %0
- adcl 8(%2), %0
- adcl 12(%2), %0
- adcl %3, %0
- adcl %4, %0
- adcl $0, %0
- "
- : "=&r" (sum)
- : "r" (saddr), "r" (daddr),
- "r"(htonl(len)), "r"(htonl(proto)), "0"(sum));
+ __asm__(
+" addl 0(%1), %0 \n"
+" adcl 4(%1), %0 \n"
+" adcl 8(%1), %0 \n"
+" adcl 12(%1), %0 \n"
+" adcl 0(%2), %0 \n"
+" adcl 4(%2), %0 \n"
+" adcl 8(%2), %0 \n"
+" adcl 12(%2), %0 \n"
+" adcl %3, %0 \n"
+" adcl %4, %0 \n"
+" adcl $0, %0 \n"
+
+ : "=&r" (sum)
+ : "r" (saddr), "r" (daddr),
+ "r"(htonl(len)), "r"(htonl(proto)), "0"(sum));

return csum_fold(sum);
}


Attachments:
smime.p7s (3.18 kB)
S/MIME Cryptographic Signature