summaryrefslogtreecommitdiffstats
path: root/sys/netipx
diff options
context:
space:
mode:
authorjhay <jhay@FreeBSD.org>1996-04-13 14:37:22 +0000
committerjhay <jhay@FreeBSD.org>1996-04-13 14:37:22 +0000
commit240bb0139db559061d6a14655a59b63433b44054 (patch)
treefdcba9a1989a280b3960e00f8108a5662230d8dd /sys/netipx
parent14b22b0b800f4812241efeee17f380f9e2245625 (diff)
downloadFreeBSD-src-240bb0139db559061d6a14655a59b63433b44054.zip
FreeBSD-src-240bb0139db559061d6a14655a59b63433b44054.tar.gz
Don't use a newfangled auto initializer. Initialize everything by
assignment to avoid one bug and several pessimizations. In the old version, gcc-2.6.3 (i386 version) generates 16 bytes of static data and copies it using 4 4-byte load-stores. gcc-2.7.2 generates 2 1-byte stores and calls memset() to zero 14 bytes. Linking fails because memset() doesn't exist in the kernel. In both versions, the 2 bytes stored directly are all that is actually used unless the null padding at the end is used, since the 3 4-byte words in the middle are initialized again by struct assignment. These words are misaligned. gcc generates misaligned load-stores for (small) misaligned struct copies. Submitted by: Bruce Evans
Diffstat (limited to 'sys/netipx')
-rw-r--r--sys/netipx/ipx_usrreq.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c
index 5fe86aa..6a0fc4a 100644
--- a/sys/netipx/ipx_usrreq.c
+++ b/sys/netipx/ipx_usrreq.c
@@ -33,7 +33,7 @@
*
* @(#)ipx_usrreq.c
*
- * $Id: ipx_usrreq.c,v 1.4 1995/11/04 09:03:24 julian Exp $
+ * $Id: ipx_usrreq.c,v 1.5 1996/03/11 15:13:57 davidg Exp $
*/
#include <sys/param.h>
@@ -75,7 +75,7 @@ ipx_input(m, ipxp)
{
register struct ipx *ipx = mtod(m, struct ipx *);
struct ifnet *ifp = m->m_pkthdr.rcvif;
- struct sockaddr_ipx ipx_ipx = { sizeof(ipx_ipx), AF_IPX };
+ struct sockaddr_ipx ipx_ipx;
if (ipxp==0)
panic("No ipxpcb");
@@ -83,7 +83,11 @@ ipx_input(m, ipxp)
* Construct sockaddr format source address.
* Stuff source address and datagram in user buffer.
*/
+ ipx_ipx.sipx_len = sizeof(ipx_ipx);
+ ipx_ipx.sipx_family = AF_IPX;
ipx_ipx.sipx_addr = ipx->ipx_sna;
+ ipx_ipx.sipx_zero[0] = '\0';
+ ipx_ipx.sipx_zero[1] = '\0';
if (ipx_neteqnn(ipx->ipx_sna.x_net, ipx_zeronet) && ifp) {
register struct ifaddr *ifa;
OpenPOWER on IntegriCloud