[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: qword aligned address
Unless something's changed don't do * and /.
Here's some code I used to use:
void *buf_real, *buf;
buf_real = kmalloc(sizeof(struct ...)+8, GFP_KERNEL);
/*
* Align to 64 bit boundries
*/
buf = (void *) ((long) buf_real+7 & ~7);
You keep buf_real around so when you need to free it you have the original
pointer. For PCI dma memory in 2.4 you should use the appropriate pci
funcitions.
-Andrew
On Wed, 18 Jul 2001, Oliver Ryan wrote:
> Hi,
> I hope this is the right place for this question -- if not sorry, and
> please forget about it.
>
> I'm setting up scatter/gather dma for a PCI device. The device requires to
> be passed a descriptor (which will be of type struct containing 4
> integers), the address of which needs to be q-word aligned. How do I
> declare the descriptor to make sure its address is qword aligned?
>
> Thanks in advance.
>
> Oliver.
>
> Dept. of Physics,
> National University of Ireland, Galway,
> Galway,
> Ireland.
>
> Tel: +353 (0)91 524411 ext. 2716
> Fax: +353 (0)91 750584
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> IRC Channel: irc.openprojects.net / #kernelnewbies
> Web Page: http://www.kernelnewbies.org/
>
---
Andrew Stanley-Jones | "It's kind of fun to do the impossible."
EE, PP-ASEL, LongEz 87KJ | -- Walt Disney
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/