Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2000 12:57:54 +1200
From:      "MATTHEW JOHN,LUCKIE" <mjl12@waikato.ac.nz>
To:        alpha@FreeBSD.ORG
Cc:        jdp@polstra.com
Subject:   RE: kernel modules/unaligned access fault
Message-ID:  <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz>

next in thread | raw e-mail | index | archive | help
thanks for this
everything seems to go ok now with the bcopy

would you mind explaining to me the rules of programming for the alpha =
in
terms of unaligned accesses.
the original version of the code went
getnanotime(&pr->ts);
and then i byte ordered the members of the struct at a later date - all
inside the mbuf->m_data
but i got the uac fault at the call to the getnanotime.

I would just be interested to know a bit more so i can optimise my code =
a
bit more rather than copy data where i perhaps might not need to.

thanks again

Matthew

> -----Original Message-----
> From:	John Polstra [SMTP:jdp@polstra.com]
> Sent:	Monday, August 14, 2000 5:44 AM
> To:	alpha@freebsd.org
> Cc:	mjl12@waikato.ac.nz
> Subject:	Re: kernel modules/unaligned access fault
>=20
> In article =
<45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz>,
> MATTHEW JOHN,LUCKIE <mjl12@waikato.ac.nz> wrote:
> >=20
> > I am running into problems with the timestamping, whereby i am =
getting
> an
> > unaligned access fault panic.
> > I am making a call to getnanotime, with the results getting copied =
into
> a
> > bit of data in the mbuf that is offset 48 bytes in the packet
> [...]
> > m->m_data +=3D 4; /* 44 bytes offset */
> > pr =3D mtod(m, struct pathrecord *pr);
> > pr->ip =3D 0;
> > getnanotime(&ts);
> > ts.ts_sec =3D htonl(ts.ts_sec);
> > ts.ts_nsec =3D htonl(ts.ts_nsec);
> > pr->ts =3D ts; /* crashes in this line, 44 bytes offset from m_data =
*/
>=20
> Instead of assigning it directly like that, use bcopy() to copy it
> into place.
>=20
>     bcopy(&ts, &pr->ts, sizeof ts);
>=20
> John
> --=20
>   John Polstra
> jdp@polstra.com
>   John D. Polstra & Co., Inc.                        Seattle, =
Washington
> USA
>   "Disappointment is a good sign of basic intelligence."  -- =
Ch=F6gyam
> Trungpa


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




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