site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Aug 7, 2006, at 11:56 PM, NAHieu wrote: I am new to kernel programming in Mac Tiger, and have a question: According to chapter 15 of "Kerrnel programming guide", part "Memory mapping and block copying", it says: "... To get data from kernel (to application), application allocates a range of memory and passes the memory address to kernel. Then kernel can copy data to the memory (with copyout function)... " But the documentation doesnt mention few things: - How to notify kernel the address of the shared memory? There are a number of different ways that this is done, depending on what sort of kernel work you are doing. - How should kernel and application notify each other when the copy process is done, and the data is ready? Please anybody points me to a sample code of this process? (it should be used in a lot of code in Mac?) = Mike _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... For example, if you're writing an I/O Kit driver you will typically use a UserClient subclass. If you're writing a plain kernel extension, you may use Mach RPC or sysctl. In most cases, however, code in the kernel receives a combination of a reference on an address space (either explicit, in the form of a task handle, or implicit in the form of the user address space associated with the current thread) and a virtual address within that address space. Again, this varies depending on the type of code. Many operations are performed synchronously on the calling thread. Some such as asynchronous Mach RPC, async UserClient operations and Posix asynchronous I/O have associated notification mechanisms. Your first mistake is, I suspect, in looking for a low-level implementation. Rather, study the mode and style of operation of the sort of code you are interested in; don't think "how does data get in and out of the kernel"? but rather "how does <other code like mine> work"? Like most modern operating systems, Mac OS X is highly structured. Much of the time, code written by a third party such as perhaps yourself will not directly concern itself directly with low-level tasks like moving data across the user/kernel boundary. This email sent to site_archiver@lists.apple.com