Re: Equivalent of Linux kmap on Mac OS
Re: Equivalent of Linux kmap on Mac OS
- Subject: Re: Equivalent of Linux kmap on Mac OS
- From: Godfrey van der Linden <email@hidden>
- Date: Thu, 8 Mar 2007 10:41:12 +1100
Remember that in MacOSX manipulating the kernel address map is
slooooooowwwww. Are you sure you need to do this at all. The memory
descriptor readBytes/writeBytes routines may be more efficient solution.
I wouldn't recommend map()ing on every I/O, however a couple at
device initialisation time is probably OK, and a good way to share
buffers between user land and the kernel.
Godfrey
On 08/03/2007, at 09:31 , Bhavesh Davda wrote:
Hi Rob,
Sure sounds like I can
1. IOMemoryDescriptor::initWithAddress(userAddr,..., kernel_task) to
map the user address into the kernel map, and
2. prepare() to wire the address down.
Have I got that right? But then, what's the kernel virtual address I
can use from other tasks running in the KEXT to access this kernel
mapped address?
Thanks!
- Bhavesh
On 3/7/07, Rob McKeever <email@hidden> wrote:
This sounds like a perfect use of an I/O Kit IOMemoryDescriptor.
Have you looked at this and would it be an option for you?
-Rob
--
Rob McKeever, email@hidden
Developer Technical Support, CoreOS/Hardware
Apple Computer
On Mar 7, 2007, at 9:54 AM, Bhavesh Davda wrote:
> Sorry for not providing more context.
>
> Yes, what I'm looking for is something that has memory semantics
(i.e.
> I don't need to call map/unmap functions ever time I want to access
> this piece of memory), where the memory is allocated in a user
space
> task, but should be accessible without these map/unmap calls like
> "global" memory within a KEXT, for all tasks running the KEXT
code as
> part of a synchronous system call, and also for all kernel threads
> running the KEXT code as some sort of a "bottom-half".
>
> I understand that in the context of the userspace task that
allocates
> and owns the memory, the kernel (KEXT) doesn't need any special
> mapping code to access the tasks userspace memory.
>
> I'm also not looking for the bounce buffer element of Linux's kmap.
> All I would like is a way to, through non-kernel-private APIs,
be able
> to map the userspace memory into the kernel map, so that all
tasks can
> access it in KEXT code.
>
> Hopefully this makes the intent more clear.
>
> Thank you!
>
> - Bhavesh
>
>
> On 3/7/07, Michael Smith <email@hidden> wrote:
>>
>> On Mar 7, 2007, at 3:45 AM, Anton Altaparmakov wrote:
>>
>> > If you are not working with a file system then I would suggest
>> > checking out what ubc_upl_map() does and following it up that
way
>> > to figure out what to do analogously.
>>
>> That's probably not a good suggestion; the UBC implementation does
>> not use KPI. If the page is sourced from an address space (as I
>> inferred from the Bhavesh's original request) then there's no
need to
>> construct the UPL (it will happen automagically if the page has
to be
>> faulted in).
>>
>> What this boils down to, again, is that without more
information on
>> what Bhavesh actually wants to do (i.e. not "there is this call in
>> Linux"), we're not really able to help him very much. 8)
>>
>> = Mike
>>
>>
>
>
> --
> Bhavesh P. Davda
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> 40apple.com
>
> This email sent to email@hidden
--
Bhavesh P. Davda
_______________________________________________
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
_______________________________________________
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