Re: cross-bounday memory communication b/w user app and the Kernel.How?
Re: cross-bounday memory communication b/w user app and the Kernel.How?
- Subject: Re: cross-bounday memory communication b/w user app and the Kernel.How?
- From: "rohit dhamija" <email@hidden>
- Date: Fri, 2 Jun 2006 12:58:28 +0530
Hi Michael,
Thanks for your suggestion, but i need to tell you two things :
1. I am sure that you did not get my question right.
2. I am totally new to Mac OS X, never worked on it before (neither on
linux/unix too). It just two months back, I was given a machine
called APPLE :) and had to work on same.
But, I do have extensive experience in device drivers especially file
system filter drivers on NT based systems. So it is taking me some
time to relate things to a tottaly new environment.
On the other hand, You guys have been working on these Mac systems
from years (infact most of you are developing it ) . This is where the
difference lies.
I would certainly buy the books suggested by you. These seems quite
helpful in understanding the core OS.( especially, Mac OS X Internals,
by Mr. Amit singh)
Regarding my query,
You don't. The descriptor refers to the buffer that already exists
in the user-space process' address space. You don't need to copy
anything.
I know that the descriptor refers to the buffer only. But say for
example I wish to set this data to all zero's. So in this case: (a)
will I give address of the structure OR (b) address of
IOMemoryDescriptor,, as the first parameter to memset ?
Similarly what if I want to copy the data AGAIN in my driver side ? Do
I need to
send the address of structure to the memcpy ? Or do i need to pass
address of IOMemoryDescriptor as the first parameter to memcpy.
I hope I am able to clarify my query. Please comment.
Thanks and Regards,
Rohit Dhamija
On 6/2/06, Michael Smith <email@hidden> wrote:
On Jun 1, 2006, at 9:06 PM, rohit dhamija wrote:
> Thanks a lot for your comments !! Your suggestions are very good
> and valuable.
>
> B/w i have one query ,
>
>>> Create the IOMemoryDescriptors directly against the user-space
> addresses and do your I/O with those.
>
> At this point i have memory of type IOMemoryDescriptor*. But Now I
> need to copy some information in this memory. So is it fine to copy
> using memcopy :to copy information in descr (of type
> IOMemoryDescriptor* ) ??
There is nothing to copy.
> like
>
> IOMemoryDescriptor * outDescriptor = NULL;
>
> // Get the data into kernel space
> outDescriptor = IOMemoryDescriptor::withAddress(
> (vm_address_t)pComm->command_payload,
> sizeof(command_structure),
> kIODirectionOut,
> fClientTask);
>
> now I need to copy some data into
>
> so is it fine to do:
>
> memcpy((void*)&outDescriptor, mydataBuffer, sizeof(MYDATABUFFER));
>
> IF not, then how to copy/fill info in the descriptor ?
You don't. The descriptor refers to the buffer that already exists
in the user-space process' address space. You don't need to copy
anything.
I want to ask "don't they teach you anything in school these days?"
but perhaps that's a bit harsh. I would suggest that if you plan on
doing much more work on device drivers that you should spend a little
time reading up on the history and design of operating systems.
There are a lot of fundamental things that it would really help you
to know.
Might I suggest:
http://www.osxbook.com/
http://www.amazon.com/gp/product/0201549794/qid=1149228811/sr=1-7/
ref=sr_1_7/104-5530617-5549562?s=books&v=glance&n=283155
http://www.amazon.com/gp/product/0130313580/sr=8-1/qid=1149228772/
ref=pd_bbs_1/104-5530617-5549562?_encoding=UTF8
http://www.amazon.com/gp/product/0131429388/qid=1149228811/sr=1-6/
ref=sr_1_6/104-5530617-5549562?s=books&v=glance&n=283155
http://www.amazon.com/gp/product/0130981389/qid=1149228870/sr=2-1/
ref=pd_bbs_b_2_1/104-5530617-5549562?s=books&v=glance&n=283155
http://www.amazon.com/gp/product/013021034X/qid=1149228906/sr=1-2/
ref=sr_1_2/104-5530617-5549562?s=books&v=glance&n=283155
I'm sure that you can get these books for considerably less
elsewhere, it was just convenient to use Amazon to look them up. I'm
also sure that other folks on this list will have their own
suggestions; the above clearly shows my *nix background.
= Mike
--
Rohit Dhamija(M) 9818446545
_______________________________________________
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