mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-24 03:15:00 +08:00
Moved sparc specific version of in_cksum_hdr to an inline routine like
the reset of the CPU specific implementations after comment from Eric Norum.
This commit is contained in:
@@ -157,6 +157,49 @@ in_cksum_update(struct ip *ip)
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
|
||||
}
|
||||
|
||||
/*
|
||||
* SPARC Version
|
||||
*/
|
||||
|
||||
#elif (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
static __inline u_int
|
||||
in_cksum_hdr(const struct ip *ip)
|
||||
{
|
||||
register u_int sum = 0;
|
||||
register u_int tmp_o2;
|
||||
register u_int tmp_o3;
|
||||
|
||||
__asm__ volatile ("
|
||||
ld [%0], %1 ; \
|
||||
ld [%0+4], %2 ; \
|
||||
addcc %1, %2, %1 ; \
|
||||
ld [%0+8], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+12], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+16], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
set 0x0ffff, %3 ; \
|
||||
srl %1, 16, %2 ; \
|
||||
and %1, %3, %1 ; \
|
||||
addx %1, %2, %1 ; \
|
||||
srl %1, 16, %1 ; \
|
||||
add %1, %%g0, %1 ; \
|
||||
neg %1 ; \
|
||||
and %1, %3, %1 ; \
|
||||
" : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3)
|
||||
: "0" (ip), "1" (sum)
|
||||
);
|
||||
return sum;
|
||||
}
|
||||
|
||||
#define in_cksum_update(ip) \
|
||||
do { \
|
||||
int __tmpsum; \
|
||||
__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
|
||||
} while(0)
|
||||
/*
|
||||
* Here is the generic, portable, inefficient algorithm.
|
||||
*/
|
||||
|
||||
@@ -698,35 +698,6 @@ kmem_malloc (vm_map_t *map, vm_size_t size, boolean_t waitflag)
|
||||
* IP header checksum routine for processors which don't have an inline version
|
||||
*/
|
||||
|
||||
#if (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
asm("
|
||||
.text
|
||||
.global _in_cksum_hdr
|
||||
_in_cksum_hdr:
|
||||
|
||||
ld [%o0], %o1
|
||||
ld [%o0+4], %o2
|
||||
addcc %o1, %o2, %o1
|
||||
ld [%o0+8], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+12], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+16], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
set 0x0ffff, %o3
|
||||
srl %o1, 16, %o2
|
||||
and %o1, %o3, %o1
|
||||
addx %o1, %o2, %o1
|
||||
srl %o1, 16, %o1
|
||||
add %o1, %g0, %o1
|
||||
neg %o1
|
||||
retl
|
||||
and %o1, %o3, %o0
|
||||
|
||||
");
|
||||
#else
|
||||
|
||||
u_int
|
||||
in_cksum_hdr (const void *ip)
|
||||
{
|
||||
@@ -743,8 +714,6 @@ in_cksum_hdr (const void *ip)
|
||||
return ~sum & 0xFFFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Manipulate routing tables
|
||||
*/
|
||||
|
||||
@@ -157,6 +157,49 @@ in_cksum_update(struct ip *ip)
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
|
||||
}
|
||||
|
||||
/*
|
||||
* SPARC Version
|
||||
*/
|
||||
|
||||
#elif (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
static __inline u_int
|
||||
in_cksum_hdr(const struct ip *ip)
|
||||
{
|
||||
register u_int sum = 0;
|
||||
register u_int tmp_o2;
|
||||
register u_int tmp_o3;
|
||||
|
||||
__asm__ volatile ("
|
||||
ld [%0], %1 ; \
|
||||
ld [%0+4], %2 ; \
|
||||
addcc %1, %2, %1 ; \
|
||||
ld [%0+8], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+12], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+16], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
set 0x0ffff, %3 ; \
|
||||
srl %1, 16, %2 ; \
|
||||
and %1, %3, %1 ; \
|
||||
addx %1, %2, %1 ; \
|
||||
srl %1, 16, %1 ; \
|
||||
add %1, %%g0, %1 ; \
|
||||
neg %1 ; \
|
||||
and %1, %3, %1 ; \
|
||||
" : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3)
|
||||
: "0" (ip), "1" (sum)
|
||||
);
|
||||
return sum;
|
||||
}
|
||||
|
||||
#define in_cksum_update(ip) \
|
||||
do { \
|
||||
int __tmpsum; \
|
||||
__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
|
||||
} while(0)
|
||||
/*
|
||||
* Here is the generic, portable, inefficient algorithm.
|
||||
*/
|
||||
|
||||
@@ -698,35 +698,6 @@ kmem_malloc (vm_map_t *map, vm_size_t size, boolean_t waitflag)
|
||||
* IP header checksum routine for processors which don't have an inline version
|
||||
*/
|
||||
|
||||
#if (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
asm("
|
||||
.text
|
||||
.global _in_cksum_hdr
|
||||
_in_cksum_hdr:
|
||||
|
||||
ld [%o0], %o1
|
||||
ld [%o0+4], %o2
|
||||
addcc %o1, %o2, %o1
|
||||
ld [%o0+8], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+12], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+16], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
set 0x0ffff, %o3
|
||||
srl %o1, 16, %o2
|
||||
and %o1, %o3, %o1
|
||||
addx %o1, %o2, %o1
|
||||
srl %o1, 16, %o1
|
||||
add %o1, %g0, %o1
|
||||
neg %o1
|
||||
retl
|
||||
and %o1, %o3, %o0
|
||||
|
||||
");
|
||||
#else
|
||||
|
||||
u_int
|
||||
in_cksum_hdr (const void *ip)
|
||||
{
|
||||
@@ -743,8 +714,6 @@ in_cksum_hdr (const void *ip)
|
||||
return ~sum & 0xFFFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Manipulate routing tables
|
||||
*/
|
||||
|
||||
@@ -157,6 +157,49 @@ in_cksum_update(struct ip *ip)
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
|
||||
}
|
||||
|
||||
/*
|
||||
* SPARC Version
|
||||
*/
|
||||
|
||||
#elif (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
static __inline u_int
|
||||
in_cksum_hdr(const struct ip *ip)
|
||||
{
|
||||
register u_int sum = 0;
|
||||
register u_int tmp_o2;
|
||||
register u_int tmp_o3;
|
||||
|
||||
__asm__ volatile ("
|
||||
ld [%0], %1 ; \
|
||||
ld [%0+4], %2 ; \
|
||||
addcc %1, %2, %1 ; \
|
||||
ld [%0+8], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+12], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+16], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
set 0x0ffff, %3 ; \
|
||||
srl %1, 16, %2 ; \
|
||||
and %1, %3, %1 ; \
|
||||
addx %1, %2, %1 ; \
|
||||
srl %1, 16, %1 ; \
|
||||
add %1, %%g0, %1 ; \
|
||||
neg %1 ; \
|
||||
and %1, %3, %1 ; \
|
||||
" : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3)
|
||||
: "0" (ip), "1" (sum)
|
||||
);
|
||||
return sum;
|
||||
}
|
||||
|
||||
#define in_cksum_update(ip) \
|
||||
do { \
|
||||
int __tmpsum; \
|
||||
__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
|
||||
} while(0)
|
||||
/*
|
||||
* Here is the generic, portable, inefficient algorithm.
|
||||
*/
|
||||
|
||||
@@ -698,35 +698,6 @@ kmem_malloc (vm_map_t *map, vm_size_t size, boolean_t waitflag)
|
||||
* IP header checksum routine for processors which don't have an inline version
|
||||
*/
|
||||
|
||||
#if (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
asm("
|
||||
.text
|
||||
.global _in_cksum_hdr
|
||||
_in_cksum_hdr:
|
||||
|
||||
ld [%o0], %o1
|
||||
ld [%o0+4], %o2
|
||||
addcc %o1, %o2, %o1
|
||||
ld [%o0+8], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+12], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+16], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
set 0x0ffff, %o3
|
||||
srl %o1, 16, %o2
|
||||
and %o1, %o3, %o1
|
||||
addx %o1, %o2, %o1
|
||||
srl %o1, 16, %o1
|
||||
add %o1, %g0, %o1
|
||||
neg %o1
|
||||
retl
|
||||
and %o1, %o3, %o0
|
||||
|
||||
");
|
||||
#else
|
||||
|
||||
u_int
|
||||
in_cksum_hdr (const void *ip)
|
||||
{
|
||||
@@ -743,8 +714,6 @@ in_cksum_hdr (const void *ip)
|
||||
return ~sum & 0xFFFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Manipulate routing tables
|
||||
*/
|
||||
|
||||
@@ -157,6 +157,49 @@ in_cksum_update(struct ip *ip)
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
|
||||
}
|
||||
|
||||
/*
|
||||
* SPARC Version
|
||||
*/
|
||||
|
||||
#elif (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
static __inline u_int
|
||||
in_cksum_hdr(const struct ip *ip)
|
||||
{
|
||||
register u_int sum = 0;
|
||||
register u_int tmp_o2;
|
||||
register u_int tmp_o3;
|
||||
|
||||
__asm__ volatile ("
|
||||
ld [%0], %1 ; \
|
||||
ld [%0+4], %2 ; \
|
||||
addcc %1, %2, %1 ; \
|
||||
ld [%0+8], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+12], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
ld [%0+16], %2 ; \
|
||||
addxcc %1, %2, %1 ; \
|
||||
set 0x0ffff, %3 ; \
|
||||
srl %1, 16, %2 ; \
|
||||
and %1, %3, %1 ; \
|
||||
addx %1, %2, %1 ; \
|
||||
srl %1, 16, %1 ; \
|
||||
add %1, %%g0, %1 ; \
|
||||
neg %1 ; \
|
||||
and %1, %3, %1 ; \
|
||||
" : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3)
|
||||
: "0" (ip), "1" (sum)
|
||||
);
|
||||
return sum;
|
||||
}
|
||||
|
||||
#define in_cksum_update(ip) \
|
||||
do { \
|
||||
int __tmpsum; \
|
||||
__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
|
||||
ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
|
||||
} while(0)
|
||||
/*
|
||||
* Here is the generic, portable, inefficient algorithm.
|
||||
*/
|
||||
|
||||
@@ -698,35 +698,6 @@ kmem_malloc (vm_map_t *map, vm_size_t size, boolean_t waitflag)
|
||||
* IP header checksum routine for processors which don't have an inline version
|
||||
*/
|
||||
|
||||
#if (defined(__GNUC__) && defined(sparc))
|
||||
|
||||
asm("
|
||||
.text
|
||||
.global _in_cksum_hdr
|
||||
_in_cksum_hdr:
|
||||
|
||||
ld [%o0], %o1
|
||||
ld [%o0+4], %o2
|
||||
addcc %o1, %o2, %o1
|
||||
ld [%o0+8], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+12], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
ld [%o0+16], %o2
|
||||
addxcc %o1, %o2, %o1
|
||||
set 0x0ffff, %o3
|
||||
srl %o1, 16, %o2
|
||||
and %o1, %o3, %o1
|
||||
addx %o1, %o2, %o1
|
||||
srl %o1, 16, %o1
|
||||
add %o1, %g0, %o1
|
||||
neg %o1
|
||||
retl
|
||||
and %o1, %o3, %o0
|
||||
|
||||
");
|
||||
#else
|
||||
|
||||
u_int
|
||||
in_cksum_hdr (const void *ip)
|
||||
{
|
||||
@@ -743,8 +714,6 @@ in_cksum_hdr (const void *ip)
|
||||
return ~sum & 0xFFFF;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Manipulate routing tables
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user