All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about Using Grant Table
@ 2008-07-11  0:02 吴佳民
  2008-07-11  0:16 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: 吴佳民 @ 2008-07-11  0:02 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com


[-- Attachment #1.1: Type: text/plain, Size: 1246 bytes --]

Hi:
    There is a code sample in <The Definite Guide to the Xen Hypervisor>, chapter 4, "Using Grant Tables".
    The code sample is as following:
  #include <public/xen.h>
  extern void * shared_page;
  extern grant_entry_t  * grant_table;
  
  void offer_page()
   {
        uint16_t flags;
       /* create the grant table*/
      gnttab_setup_table_t setup_op;
     
     setup_op.dom =DOMID_SELF;
     setup_op.nr_frames = 1;
     setup_op.frame_list = grant_table;
    
     HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup_op, 1);

    /*offer the grant */
    grant_table[0].domid=DOMID_FRIEND;
    grant_table[0].frame = shared_page >>12;
    flgas = GTF_permit_access & GTF_reading & GTF_writing;
    grant_table[0].flags= flags;
  
    }
   
    and it also assume that the grant table entry have already been communicated via Xenstore.
  
   My question is :
   If I modify this code sample and use it in my own program, How can I handle "extern void * shared_page; extern grant_entry_t * grant_table"?? Where Can I get the pointer to them?

Thanks a lot.
                                                          Danius Wu
========================================================= 
 
 

[-- Attachment #1.2: Type: text/html, Size: 2269 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about Using Grant Table
  2008-07-11  0:02 Question about Using Grant Table 吴佳民
@ 2008-07-11  0:16 ` Samuel Thibault
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Thibault @ 2008-07-11  0:16 UTC (permalink / raw)
  To: 吴佳民; +Cc: xen-devel@lists.xensource.com

吴佳民, le Fri 11 Jul 2008 08:02:28 +0800, a écrit :
>     There is a code sample in <The Definite Guide to the Xen Hypervisor>,

That code is not meant to be used in userlevel, but in a PV kernel.
If you want to manipulate grant tables from userland, use libxc's
xc_gnttab_* functions.

Samuel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-11  0:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11  0:02 Question about Using Grant Table 吴佳民
2008-07-11  0:16 ` Samuel Thibault

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.