Date: Mon, 14 Aug 2000 12:09:35 +0200 From: Pascal Bouchareine <pb@grolier.fr> To: "MATTHEW JOHN,LUCKIE" <mjl12@waikato.ac.nz> Cc: alpha@FreeBSD.ORG, jdp@polstra.com Subject: Re: kernel modules/unaligned access fault Message-ID: <20000814120935.A21561@kalou.in.grolier.fr> In-Reply-To: <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz>; from mjl12@waikato.ac.nz on Mon, Aug 14, 2000 at 12:57:54PM %2B1200 References: <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 14, 2000 at 12:57:54PM +1200, MATTHEW JOHN,LUCKIE wrote: > would you mind explaining to me the rules of programming for the alpha in > terms of unaligned accesses. Well i'm not sure i'm aware enough to explain. Let's try it. IMHO, aligned access means, you may write memory using a (type) pointer, but you need to write at an address that is on a (type-size) boundary. Ie, if ((ptr % sizeof(ptr) != 0)), (miss casts), you're wrong. If you have a struct : s { short int a; long b; } Then a is aligned on a 2 bytes boundary, but (if compiler doesn't help), b may not be. With struct issues, usually when accessing userspace from kernel space, i guess the best way is to prepare locally your structure, and then bcopy() it to user space. I have the same problem with the vfs_aio code, where suword() is used to access int in user space structures. I was wondering how to fix it when you wrote your mail.. Hope this helps, kalou -- Kalou. ldiq t0, 0xbeeffedadeadbabe 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?20000814120935.A21561>