The code below is in user-space and that MACRO(__vpa) is in kernel-space. /* MALLOC_REQ Structure used on allocation requests to the driver. Used by KernelMalloc() & KernelFree() */ typedef struct{ unsigned long sz; /*number of bytes to allocate*/ void *ptr; /* pointer to the address that is to ve returned */ char *to; char *from; int pid; /*pid */ }MALLOC_REQ; MALLOC_REQ kmem; Ioctl(fd, IOCTL_MALLOC, &kmem); ..... ..... Ioctl(fd,IOCTL_FREE,*block); Can provide you more details. Thanks -vikas -------------------------------------------------------- This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system. -----Original Message----- From: Thomas Petazzoni [mailto:thomas.petazzoni@xxxxxxxx] Sent: Tuesday, July 26, 2005 10:51 AM To: Aggarwal, Vikas (OFT) Cc: kernelnewbies@xxxxxxxxxxxx Subject: Re: porting a mm specific macro from 2.4 to 2.6 Hello, Aggarwal, Vikas (OFT) wrote: > Here is the context-of-use -- > The driver is for Crypto-Hardware-Accelerator(CHA). The user space > creates the Descriptors(which has data to be encrypted, type of > crypto-algorithm etc) which guides the CHA. > A dummy malloc is implemented in kernel driver which uses kmalloc and > user can request that memory(to create Descriptors) via > IOCTL(CHA_MALLOC). The idea is (most likely) to avoid the "copy from > usersapce". Then the descriptor pointer is filled with the data by > user-space which passes it back to CHA via second > IOCTL(CHA_CRYPT_REQUEST). I am sorry, I don't know how CHA works, so I may ask stupid questions. You say that your IOCTL(CHA_MALLOC) allocates memory in kernel-space using kmalloc() and returns that address to the user-space. Then you say the "user can request that memory". What do you mean by "request" ? How does the user-space accesses this kernel-allocated memory ? Once I'll clearly understand how it works, I'll try to give an answer about the initial problem. Sincerly, Thomas -- Thomas Petazzoni thomas.petazzoni@xxxxxxxx -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/