From owner-freebsd-alpha Sun Aug 13 17:58:12 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from mailserv.waikato.ac.nz (mailserv.waikato.ac.nz [130.217.66.61]) by hub.freebsd.org (Postfix) with ESMTP id AD2A337B830 for ; Sun, 13 Aug 2000 17:58:07 -0700 (PDT) (envelope-from mjl12@waikato.ac.nz) Received: from stu_ex2.waikato.ac.nz (stu-ex2.waikato.ac.nz [130.217.70.20]) by mailserv.waikato.ac.nz (8.9.3/8.9.0) with ESMTP id NAA25260; Mon, 14 Aug 2000 13:02:12 +1200 Received: by stu-ex2.waikato.ac.nz with Internet Mail Service (5.5.2650.21) id <23A4W4NR>; Mon, 14 Aug 2000 12:53:28 +1200 Message-ID: <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz> From: "MATTHEW JOHN,LUCKIE" To: alpha@FreeBSD.ORG Cc: jdp@polstra.com Subject: RE: kernel modules/unaligned access fault Date: Mon, 14 Aug 2000 12:57:54 +1200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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 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