in_cksum.c (620) | in_cksum.c (798) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from tahoe: in_cksum.c 1.2 86/01/05 34 * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * from tahoe: in_cksum.c 1.2 86/01/05 34 * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 |
35 * $Id$ | 35 * $Id: in_cksum.c,v 1.2 1993/10/16 14:15:00 rgrimes Exp $ |
36 */ 37 38#include "param.h" 39#include "sys/mbuf.h" 40 41/* 42 * Checksum routine for Internet Protocol family headers. 43 * --- 10 unchanged lines hidden (view full) --- 54/* 55 * Thanks to gcc we don't have to guess 56 * which registers contain sum & w. 57 */ 58#define CLC asm("clc") 59#define ADD(n) asm("adcl " #n "(%2), %0": "=r"(sum): "0"(sum), "r"(w)) 60#define MOP asm("adcl $0, %0": "=r"(sum): "0"(sum)) 61 | 36 */ 37 38#include "param.h" 39#include "sys/mbuf.h" 40 41/* 42 * Checksum routine for Internet Protocol family headers. 43 * --- 10 unchanged lines hidden (view full) --- 54/* 55 * Thanks to gcc we don't have to guess 56 * which registers contain sum & w. 57 */ 58#define CLC asm("clc") 59#define ADD(n) asm("adcl " #n "(%2), %0": "=r"(sum): "0"(sum), "r"(w)) 60#define MOP asm("adcl $0, %0": "=r"(sum): "0"(sum)) 61 |
62int |
|
62in_cksum(m, len) 63 register struct mbuf *m; 64 register int len; 65{ 66 register u_short *w; 67 register unsigned sum = 0; 68 register int mlen = 0; 69 int byte_swapped = 0; --- 104 unchanged lines hidden --- | 63in_cksum(m, len) 64 register struct mbuf *m; 65 register int len; 66{ 67 register u_short *w; 68 register unsigned sum = 0; 69 register int mlen = 0; 70 int byte_swapped = 0; --- 104 unchanged lines hidden --- |