GCC constraints error for inline assembler, causing in_cksum to calculate

the checksum wrong in the non-optimized case.  Fix provided in PR#14614
by Rhialto, so this solves this PR.
This commit is contained in:
ragge 2006-12-31 10:52:52 +00:00
parent 1e2869f580
commit 0dc4689916
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: in4_cksum.c,v 1.10 2005/12/24 20:07:41 perry Exp $ */
/* $NetBSD: in4_cksum.c,v 1.11 2006/12/31 10:52:52 ragge Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.10 2005/12/24 20:07:41 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.11 2006/12/31 10:52:52 ragge Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -99,8 +99,8 @@ int in4_cksum_md_debug(struct mbuf *m, u_int8_t nxt, int off, int len);
#define SWAP {sum <<= 8;} /* depends on recent REDUCE */
#define Asm __asm volatile
#define ADDL Asm("addl2 (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
#define ADWC Asm("adwc (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
#define ADDL Asm("addl2 (%0)+,%1": "=r" (w), "=r" (sum): "0" (w), "1" (sum))
#define ADWC Asm("adwc (%0)+,%1": "=r" (w), "=r" (sum): "0" (w), "1" (sum))
#define ADDC Asm("adwc $0,%0" : "=r" (sum) : "0" (sum))
#define UNSWAP Asm("rotl $8,%0,%0" : "=r" (sum) : "0" (sum))
#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_cksum.c,v 1.9 2005/12/24 20:07:41 perry Exp $ */
/* $NetBSD: in_cksum.c,v 1.10 2006/12/31 10:52:52 ragge Exp $ */
/*
* Copyright (c) 1988, 1992, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.9 2005/12/24 20:07:41 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.10 2006/12/31 10:52:52 ragge Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -55,8 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: in_cksum.c,v 1.9 2005/12/24 20:07:41 perry Exp $");
#define SWAP {sum <<= 8;} /* depends on recent REDUCE */
#define Asm __asm volatile
#define ADDL Asm("addl2 (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
#define ADWC Asm("adwc (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
#define ADDL Asm("addl2 (%0)+,%1": "=r" (w), "=r" (sum): "0" (w), "1" (sum))
#define ADWC Asm("adwc (%0)+,%1": "=r" (w), "=r" (sum): "0" (w), "1" (sum))
#define ADDC Asm("adwc $0,%0" : "=r" (sum) : "0" (sum))
#define UNSWAP Asm("rotl $8,%0,%0" : "=r" (sum) : "0" (sum))
#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}