diff options
author | marcel <marcel@FreeBSD.org> | 2005-11-22 01:51:57 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2005-11-22 01:51:57 +0000 |
commit | 795233d73ae4a3e1a38dac764d263477d0b0e2c7 (patch) | |
tree | 4fe7dab3b773c6c6cf41e7f88fdc12fd38caa836 /sys | |
parent | 570800eb929716415e5ae5f27fd7662a11237c1f (diff) | |
download | FreeBSD-src-795233d73ae4a3e1a38dac764d263477d0b0e2c7.zip FreeBSD-src-795233d73ae4a3e1a38dac764d263477d0b0e2c7.tar.gz |
Resolve misalignment traps caused by changes to IF_LLADDR().
Use de16dec() and le16dec() to fetch the link-level address
from struct ifnet.
Tested on: alpha
Reviewed by: jhb
See also: de(4)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/dc/if_dc.c | 12 | ||||
-rw-r--r-- | sys/dev/dc/if_dcreg.h | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 7dbb539..965130a 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1126,9 +1126,9 @@ dc_setfilt_21143(struct dc_softc *sc) } /* Set our MAC address */ - sp[39] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[0]); - sp[40] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[1]); - sp[41] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[2]); + sp[39] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 0); + sp[40] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 1); + sp[41] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 2); sframe->dc_status = htole32(DC_TXSTAT_OWN); CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); @@ -1324,9 +1324,9 @@ dc_setfilt_xircom(struct dc_softc *sc) } /* Set our MAC address */ - sp[0] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[0]); - sp[1] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[1]); - sp[2] = DC_SP_MAC(((u_int16_t *)IF_LLADDR(sc->dc_ifp))[2]); + sp[0] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 0); + sp[1] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 1); + sp[2] = DC_SP_MAC((u_int16_t *)IF_LLADDR(sc->dc_ifp) + 2); DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON); diff --git a/sys/dev/dc/if_dcreg.h b/sys/dev/dc/if_dcreg.h index ecf9962..e5195f5 100644 --- a/sys/dev/dc/if_dcreg.h +++ b/sys/dev/dc/if_dcreg.h @@ -473,9 +473,9 @@ struct dc_desc { (uintptr_t)(sc->dc_ldata->dc_tx_list + i) - (uintptr_t)sc->dc_ldata) #if BYTE_ORDER == BIG_ENDIAN -#define DC_SP_MAC(x) ((x) << 16) +#define DC_SP_MAC(ptr) (be16dec(ptr) << 16) #else -#define DC_SP_MAC(x) (x) +#define DC_SP_MAC(ptr) (le16dec(ptr)) #endif struct dc_list_data { |