re(4) unaligned panic on -current
Bernd Walter
ticso at cicely12.cicely.de
Sat Dec 31 03:55:31 PST 2005
On Fri, Dec 30, 2005 at 08:36:24AM -0500, John Baldwin wrote:
> On Friday 30 December 2005 05:00 am, Ruslan Ermilov wrote:
> > On Thu, Dec 29, 2005 at 11:40:17AM -0500, John Baldwin wrote:
> > > On Wednesday 28 December 2005 11:49 pm, Bernd Walter wrote:
> > > > On Wed, Dec 28, 2005 at 11:01:47PM -0500, John Baldwin wrote:
> > > > > On Dec 28, 2005, at 11:35 AM, Bernd Walter wrote:
> > > > Your guess looks right - will try your bcopy suggestion.
[52]cicely4# cvs diff
cvs diff: Diffing .
Index: if_re.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/re/if_re.c,v
retrieving revision 1.62
diff -u -r1.62 if_re.c
--- if_re.c 18 Dec 2005 18:24:26 -0000 1.62
+++ if_re.c 31 Dec 2005 11:36:13 -0000
@@ -2097,6 +2097,10 @@
struct ifnet *ifp = sc->rl_ifp;
struct mii_data *mii;
u_int32_t rxcfg = 0;
+ union {
+ uint32_t align_dummy;
+ u_char eaddr[ETHER_ADDR_LEN];
+ } eaddr;
RL_LOCK_ASSERT(sc);
@@ -2123,11 +2127,13 @@
* documentation doesn't mention it, we need to enter "Config
* register write enable" mode to modify the ID registers.
*/
+ /* Copy MAC address on stack to align. */
+ bcopy(IF_LLADDR(ifp), eaddr.eaddr, ETHER_ADDR_LEN);
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_WRITECFG);
CSR_WRITE_STREAM_4(sc, RL_IDR0,
- *(u_int32_t *)(&IF_LLADDR(sc->rl_ifp)[0]));
+ *(u_int32_t *)(&eaddr.eaddr[0]));
CSR_WRITE_STREAM_4(sc, RL_IDR4,
- *(u_int32_t *)(&IF_LLADDR(sc->rl_ifp)[4]));
+ *(u_int32_t *)(&eaddr.eaddr[4]));
CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF);
/*
It works:
[54]cicely4# ifconfig re0
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=18<VLAN_MTU,VLAN_HWTAGGING>
inet 10.1.1.6 netmask 0xffffff00 broadcast 10.1.1.255
ether 00:40:f4:d0:8d:eb
media: Ethernet autoselect (1000baseTX <full-duplex>)
status: active
--
B.Walter BWCT http://www.bwct.de
bernd at bwct.de info at bwct.de
More information about the freebsd-alpha
mailing list