Does the method IOConnectCallMethod(), -> creates a tmp buffer in driver, or uses the same userspace buffer and map with physical address

Hi,

Consider the following method, to send /receive the data using IOUserClient from driver<->user app

IOConnectCallMethod(conn, 0, 0, 0, *inStruct, instructCnt, 0, 0, *outStruct, outStructCnt),


1) In case of input data, does the same memory [atlest by physical/ kernel virtual mapping] is used in kernel space, or a tmp buffer is created and that will be used in driver?

- I tried to modify the input struct data [in driver] but didn't see any change in the userspace, my main concern is whether any tmp buffer is getting created or not


2) Similar to input data, does any tmp buffer is being used in driver and then copied to userspace output buffer


If any such copy operations are happening, does it effects the performance ?, can I use the shared memory instead?


Thanks

Venkat

Replies

IOConnectCallMethod
will either use inline memory or out-of-line memory (which can be memory mapped) depending on the size of the buffer. I don’t remember the exact details but you can find the source for that function in
IOKitUser/IOKitLib.c
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
@eskimo is there any example code or so for bidirectional userspace to IOKit driver communication?
Would you recommend IOUserClient or NKE?
Thanks in advance!
Well, NKEs are officially deprecated as of 10.15, so I wouldn’t recommend that.

Generally I recommend that you avoid running in the kernel at all. The whole notion of kernel extensions is on the way out. See Deprecated Kernel Extensions and System Extension Alternatives.

What does your I/O Kit driver drive?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"