diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-23 23:06:42 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-03-23 23:06:42 +0000 |
commit | e828c2dd40c661fc6c96db4e84faacf2764efcce (patch) | |
tree | 41920a3dc80b190d0709fa90f594dca8bf46ddde /cpukit/libnetworking/rtems | |
parent | Enable building the network stack. (diff) | |
download | rtems-e828c2dd40c661fc6c96db4e84faacf2764efcce.tar.bz2 |
SPARC optimized version of IP checksum header routine. Submitted
by Jiri Gaisler <jgais@ws.estec.esa.nl>.
Diffstat (limited to 'cpukit/libnetworking/rtems')
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_glue.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c index ab734c1aca..dae362f735 100644 --- a/cpukit/libnetworking/rtems/rtems_glue.c +++ b/cpukit/libnetworking/rtems/rtems_glue.c @@ -697,6 +697,36 @@ 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 */ + +#ifdef (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) { @@ -713,6 +743,8 @@ in_cksum_hdr (const void *ip) return ~sum & 0xFFFF; } +#endif + /* * Manipulate routing tables */ |