Date: Sat, 14 Dec 2002 03:33:40 -0800 From: Wes Peters <wes@softweyr.com> To: "M. Warner Losh" <imp@bsdimp.com> Cc: langd-freebsd-hackers@leo.org, freebsd-hackers@FreeBSD.ORG Subject: Re: more kernel programming style questions Message-ID: <3DFB1714.C98D3F75@softweyr.com> References: <20021213115507.GE84493@atrbg11.informatik.tu-muenchen.de> <20021213.182741.39658511.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"M. Warner Losh" wrote: > > You are better off defining a series of macros that do proper > bus_space_readN/bus_space_writeN for each of the fields in the > register set. This will ensure that your driver works unaltered on > other architectures. > > Directly accessing memory mapped devices is a bad idea. While it > works on i386, there are some platforms that have special alignment > constraints that the underlying hardware doesn't always follow. As an example, I/O devices on the SPARC architecture are almost always placed in an "alternate address space" which means they have to be accessed using different instructions (LDA/STA) than those that access memory (LD/ST). Attempting memory I/O to devices on SPARC is doomed to failure. It's a whole new (portable) world, folks... -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DFB1714.C98D3F75>