Re: IOUserClient and IOExternalMethodArguments
Re: IOUserClient and IOExternalMethodArguments
- Subject: Re: IOUserClient and IOExternalMethodArguments
- From: Terry Lambert <email@hidden>
- Date: Wed, 17 Jun 2009 02:36:08 -0700
On Jun 16, 2009, at 3:33 PM, Duane Murphy wrote:
I would like to take advantage of the structureInputDescriptor and
structureOutputDescriptor fields of IOExternalMethodArguments to
memory map the data passed from user space to the kernel.
I have done this by hand myself and it works just fine. However, I
can't seem to get this to work with these fields. It makes the code
much simpler if I can take advantage of these fields.
I make sure that the source memory in user space uses an anonymous
mmap() to make sure the memory is aligned and available for mapping.
When I detect that one of the descriptor fields is being used in my
kext, I prepare(), then map() the memory. Then I call
getVirtualAddress() using the resulting IOMemoryMap. No errors are
returned by any of the calls. But the resulting address can not be
accessed by the kernel. I get a kernel panic if I let my code run or
in gdb I simply get a "cannot access memory at address 0x34346000"
error.
Is it possible to use these descriptors for memory mapping? My
examination of the code seems to indicate that it should work.
What is it that I am doing wrong? What am I missing?
You are probably porting code from an older 32 bit system?
The virtual address is the virtual address from the user space
process, and the user space process is not mapped into the kernel
address space. Some older UNIX systems used to split user and kernel
virtual address space, and mapped the process making a call into the
kernel address space, so you would have been able to reference it
directly on these older systems, but most more recent 32 bit systems
want to use more than a 1G/3G or 2G/2G split address space, now that
systems tend to have enough physical memory to fill up a 4G address
space with actual pages.
In general, you should probably not be expecting to share a huge
amount of memory between kernel and user space. You should probably
be using an IOMemoryDescriptor instead (see <http://
developer.apple.com>).
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden