Re: Mapping user buffers to kernel space
Re: Mapping user buffers to kernel space
- Subject: Re: Mapping user buffers to kernel space
- From: Ken Hornstein <email@hidden>
- Date: Fri, 23 Apr 2010 22:02:33 -0400
>Your user space code can tell your kext about a user space block of memory
>(make your own user space memory descriptor type) and the kext can map it
>into kernel address space.
Well, remember that it's not "my" userspace code, per se ... it's really
anything that happens to be making filesystem calls into my filesystem.
>IOMemoryDescriptor* memDesc = IOMemoryDescriptor::withAddress(
>(vm_address_t)userAddress, bufferSize, kIODirectionOutIn, userTask );
Hm, I guess maybe I was reading the header file wrong ... the exact
wording was that the "task" argument is "the task the virtual ranges are
mapped into", which I read as the task you WANTED to map the ranges into ...
but I guess that's the map the current addresses are in.
>You can also make memory descriptor using a uio:
>md = IOMemoryDescriptor::withOptions(iov, io_cnt, 0, task, ...
Ah-HA! Even easier! Thanks! And it looks like ... I just access the
address via the getAddress() method of the IOMemoryMap class?
--Ken
_______________________________________________
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