From owner-freebsd-alpha Mon Aug 14 3:10:36 2000 Delivered-To: freebsd-alpha@freebsd.org Received: from facteur.in.grolier.fr (facteur.in.grolier.fr [194.117.196.5]) by hub.freebsd.org (Postfix) with ESMTP id 1DA0B37B8A8 for ; Mon, 14 Aug 2000 03:10:34 -0700 (PDT) (envelope-from pb@grolier.fr) Received: from kalou.in.grolier.fr (kalou.in.grolier.fr [194.117.197.111]) by facteur.in.grolier.fr (Postfix) with ESMTP id D876A9D600; Mon, 14 Aug 2000 12:10:31 +0200 (MET DST) Received: (from pb@localhost) by kalou.in.grolier.fr (8.9.1b+Sun/8.9.1) id MAA21570; Mon, 14 Aug 2000 12:09:35 +0200 (MET DST) Date: Mon, 14 Aug 2000 12:09:35 +0200 From: Pascal Bouchareine To: "MATTHEW JOHN,LUCKIE" Cc: alpha@FreeBSD.ORG, jdp@polstra.com Subject: Re: kernel modules/unaligned access fault Message-ID: <20000814120935.A21561@kalou.in.grolier.fr> References: <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <45E87454FFC2D211AD9800508B65009420F8E4@stu-ex1.waikato.ac.nz>; from mjl12@waikato.ac.nz on Mon, Aug 14, 2000 at 12:57:54PM +1200 Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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