Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jan 2006 13:29:40 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        ticso@cicely.de
Cc:        Bernd Walter <ticso@cicely12.cicely.de>, freebsd-alpha@freebsd.org
Subject:   Re: re(4) unaligned panic on -current
Message-ID:  <200601031329.41635.jhb@freebsd.org>
In-Reply-To: <20051231115518.GA15282@cicely12.cicely.de>
References:  <20051228163557.GE563@cicely12.cicely.de> <200512300836.25701.jhb@freebsd.org> <20051231115518.GA15282@cicely12.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday 31 December 2005 06:55 am, Bernd Walter wrote:
> 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

Commit! :)

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601031329.41635.jhb>