Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Transfer data from user space to Kernel space and vice-versa, KEXT.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Transfer data from user space to Kernel space and vice-versa, KEXT.



Dear All,
 
I am developing KEXT using i/o kit for my usb bulk device and currently stuck while passing the data from "User application" to "Kernel application".
 
How do we get and set  data from User space to Kernel Space and vice-versa ??
 
Do we need to use copyout and copyin functions to get and set data  ???
 
 
Below are the steps to send a structure from user level to kernel space.
 
Step1. Sending data from User level to Kernel level:
 
My user application and the user client of the KEXT agree on common index and data-structure.
i.e. enum{
kmyFirstCommand,
kmyCommandCounts
}
typedef structP{
mycommandpkt,
myresponsepkt.
}
 
Step2. I get the data at kernel level using the documented functionality
i.e. through getTargetandMethodForIndex
 
IOReturn  myDriverUserClient::GetDeviceInfo(COMMAND_EXCHANGE* inpkt, COMMAND_EXCHANGE* outpkt, UInt32 inlen, UInt32* outlen) 
{
 
 DBLog(("myDriverUserClient::GetDeviceInfo\n"));
 
}
 
So in above function 
1) Do we need to tranfer  "Input structure" we get from the user using "copyin" ? If not, then plz suggest the alternate method ? B/w can memcpy work in this situation ?
 
2) Do we need to convert the "output structure" using "copyout" ? Again,  If not, then plz suggest the alternate method ? B/w can memcpy work in this situation ?
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.