• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: cross-bounday memory communication b/w user app and the Kernel.How?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Michael Smith <email@hidden>
  • Date: Thu, 1 Jun 2006 23:15:59 -0700


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


  • Follow-Ups:
    • RE: cross-bounday memory communication b/w user app and theKernel.How?
      • From: "Bruce Fancher" <email@hidden>
    • Re: cross-bounday memory communication b/w user app and the Kernel.How?
      • From: "rohit dhamija" <email@hidden>
References: 
 >cross-bounday memory communication b/w user app and the Kernel.How? (From: "rohit dhamija" <email@hidden>)
 >Re: cross-bounday memory communication b/w user app and the Kernel.How? (From: Michael Smith <email@hidden>)
 >Re: cross-bounday memory communication b/w user app and the Kernel.How? (From: "rohit dhamija" <email@hidden>)

  • Prev by Date: Re: cross-bounday memory communication b/w user app and the Kernel.How?
  • Next by Date: Re: cross-bounday memory communication b/w user app and the Kernel.How?
  • Previous by thread: Re: cross-bounday memory communication b/w user app and the Kernel.How?
  • Next by thread: Re: cross-bounday memory communication b/w user app and the Kernel.How?
  • Index(es):
    • Date
    • Thread