RE: cross-bounday memory communication b/w user app and theKernel.How?
RE: cross-bounday memory communication b/w user app and theKernel.How?
- Subject: RE: cross-bounday memory communication b/w user app and theKernel.How?
- From: "Bruce Fancher" <email@hidden>
- Date: Fri, 2 Jun 2006 08:28:35 -0400
So that you don't have to cut n' paste the broken lines from you're email
client, here the only parts of the URLs you actually need to locate the
books:
http://www.amazon.com/gp/product/0201549794
http://www.amazon.com/gp/product/0130313580
http://www.amazon.com/gp/product/0131429388
http://www.amazon.com/gp/product/0130981389
http://www.amazon.com/gp/product/013021034X
-----Original Message-----
From: darwin-kernel-bounces+bruce=email@hidden
[mailto:darwin-kernel-bounces+bruce=email@hidden] On Behalf
Of Michael Smith
Sent: Friday, June 02, 2006 2:16 AM
To: rohit dhamija
Cc: email@hidden
Subject: Re: cross-bounday memory communication b/w user app and
theKernel.How?
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
_______________________________________________
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