Fix alignment crashes on Alphas...

This commit is contained in:
matt 1998-05-14 18:24:00 +00:00
parent 2e9a412d43
commit 1442b419df
2 changed files with 17 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lemac.c,v 1.7 1998/03/30 10:35:03 hannken Exp $ */
/* $NetBSD: lemac.c,v 1.8 1998/05/14 18:24:00 matt Exp $ */
/*-
* Copyright (c) 1994, 1995, 1997 Matt Thomas <matt@3am-software.com>
@ -290,7 +290,7 @@ lemac_input(
#if NBPFILTER > 0
&& (sc->sc_if.if_flags & IFF_PROMISC) == 0
#endif
&& !LEMAC_ADDREQUAL(eh.ether_dhost, LLADDR(sc->sc_if.if_sadl)))
&& !LEMAC_ADDREQUAL(eh.ether_dhost, sc->sc_enaddr))
return;
MGETHDR(m, M_DONTWAIT, MT_DATA);
@ -327,7 +327,7 @@ lemac_input(
* drop it!
*/
if ((eh.ether_dhost[0] & 1) == 0
&& !LEMAC_ADDREQUAL(eh.ether_dhost, LLADDR(sc->sc_if.if_sadl))) {
&& !LEMAC_ADDREQUAL(eh.ether_dhost, sc->sc_enaddr)) {
m_freem(m);
return;
}
@ -600,12 +600,12 @@ lemac_init(
if (sc->sc_if.if_flags & IFF_UP) {
int saved_cs = LEMAC_INB(sc, LEMAC_REG_CS);
LEMAC_OUTB(sc, LEMAC_REG_CS, saved_cs | (LEMAC_CS_TXD | LEMAC_CS_RXD));
LEMAC_OUTB(sc, LEMAC_REG_PA0, LLADDR(sc->sc_if.if_sadl)[0]);
LEMAC_OUTB(sc, LEMAC_REG_PA1, LLADDR(sc->sc_if.if_sadl)[1]);
LEMAC_OUTB(sc, LEMAC_REG_PA2, LLADDR(sc->sc_if.if_sadl)[2]);
LEMAC_OUTB(sc, LEMAC_REG_PA3, LLADDR(sc->sc_if.if_sadl)[3]);
LEMAC_OUTB(sc, LEMAC_REG_PA4, LLADDR(sc->sc_if.if_sadl)[4]);
LEMAC_OUTB(sc, LEMAC_REG_PA5, LLADDR(sc->sc_if.if_sadl)[5]);
LEMAC_OUTB(sc, LEMAC_REG_PA0, sc->sc_enaddr[0]);
LEMAC_OUTB(sc, LEMAC_REG_PA1, sc->sc_enaddr[1]);
LEMAC_OUTB(sc, LEMAC_REG_PA2, sc->sc_enaddr[2]);
LEMAC_OUTB(sc, LEMAC_REG_PA3, sc->sc_enaddr[3]);
LEMAC_OUTB(sc, LEMAC_REG_PA4, sc->sc_enaddr[4]);
LEMAC_OUTB(sc, LEMAC_REG_PA5, sc->sc_enaddr[5]);
LEMAC_OUTB(sc, LEMAC_REG_IC, LEMAC_INB(sc, LEMAC_REG_IC) | LEMAC_IC_IE);
@ -791,10 +791,10 @@ lemac_ifioctl(
case AF_NS: {
struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina)) {
ina->x_host = *(union ns_host *)LLADDR(ifp->if_sadl);
ina->x_host = *(union ns_host *)sc->sc_enaddr;
} else {
bcopy((caddr_t)ina->x_host.c_host,
LLADDR(ifp->if_sadl), ifp->if_addrlen);
bcopy((caddr_t)ina->x_host.c_host, sc->sc_enaddr,
ifp->if_addrlen);
}
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lemacvar.h,v 1.2 1997/10/15 05:55:55 explorer Exp $ */
/* $NetBSD: lemacvar.h,v 1.3 1998/05/14 18:24:00 matt Exp $ */
/*
* Copyright (c) 1997 Matt Thomas <matt@3am-software.com>
@ -73,6 +73,9 @@ typedef struct {
unsigned cntr_txd_intrs; /* total # of tranmit error intrs */
unsigned cntr_rxd_intrs; /* total # of receive error intrs */
} sc_cntrs;
/*
* We rely on sc_enaddr being aligned on (at least) a 16 bit boundary
*/
unsigned char sc_enaddr[6]; /* current Ethernet address */
char sc_prodname[LEMAC_EEP_PRDNMSZ+1]; /* product name DE20x-xx */
u_int8_t sc_eeprom[LEMAC_EEP_SIZE]; /* local copy eeprom */
@ -124,6 +127,7 @@ typedef struct {
(((u_int16_t *)a1)[0] == ((u_int16_t *)a2)[0] \
&& ((u_int16_t *)a1)[1] == ((u_int16_t *)a2)[1] \
&& ((u_int16_t *)a1)[2] == ((u_int16_t *)a2)[2])
#define LEMAC_ADDRBRDCST(a1) \
(((u_int16_t *)a1)[0] == 0xFFFFU \
&& ((u_int16_t *)a1)[1] == 0xFFFFU \