Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 2000 10:44:07 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        alpha@freebsd.org
Cc:        mjl12@waikato.ac.nz
Subject:   Re: kernel modules/unaligned access fault
Message-ID:  <200008131744.KAA01718@vashon.polstra.com>
In-Reply-To: <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz>
References:  <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <45E87454FFC2D211AD9800508B650094BA4E3E@stu-ex1.waikato.ac.nz>,
MATTHEW JOHN,LUCKIE <mjl12@waikato.ac.nz> 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




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