From owner-freebsd-alpha Sun Aug 13 10:44:45 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 8F73037B7E8 for ; Sun, 13 Aug 2000 10:44:32 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.3) with ESMTP id KAA06677; Sun, 13 Aug 2000 10:44:15 -0700 (PDT) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id KAA01718; Sun, 13 Aug 2000 10:44:07 -0700 (PDT) (envelope-from jdp@polstra.com) Date: Sun, 13 Aug 2000 10:44:07 -0700 (PDT) Message-Id: <200008131744.KAA01718@vashon.polstra.com> To: alpha@freebsd.org Reply-To: alpha@freebsd.org Cc: mjl12@waikato.ac.nz Subject: Re: kernel modules/unaligned access fault In-Reply-To: <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz> References: <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org In article <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz>, MATTHEW JOHN,LUCKIE wrote: > > 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 += 4; /* 44 bytes offset */ > pr = mtod(m, struct pathrecord *pr); > pr->ip = 0; > getnanotime(&ts); > ts.ts_sec = htonl(ts.ts_sec); > ts.ts_nsec = htonl(ts.ts_nsec); > pr->ts = ts; /* crashes in this line, 44 bytes offset from m_data */ Instead of assigning it directly like that, use bcopy() to copy it into place. bcopy(&ts, &pr->ts, sizeof ts); John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message