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
This commit is contained in:
parent
c9b9c54d1f
commit
01a95d942e
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user