* question about mapping memory from Dom0 to domU
@ 2008-07-10 2:30 吴佳民
2008-07-10 2:34 ` weiming
2008-07-10 6:20 ` Derek Murray
0 siblings, 2 replies; 3+ messages in thread
From: 吴佳民 @ 2008-07-10 2:30 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1.1: Type: text/plain, Size: 552 bytes --]
Hi:
I wanna write code about sharing memory between dom0 and domU, and I decide to use void *xc_map_foreign_range(int xc_handle, unint32_t dom, int size, int port, unsigned long mfn) (this is a function in xenctl.h).
My question is :
If I wanna map a range of memory in dom0 to domU, how can I get the value of mfn? and I do not know the port here.
Can anybody help me ?
Thanks .
Danius Wu
=========================================================
[-- Attachment #1.2: Type: text/html, Size: 1248 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] 3+ messages in thread* Re: question about mapping memory from Dom0 to domU
2008-07-10 2:30 question about mapping memory from Dom0 to domU 吴佳民
@ 2008-07-10 2:34 ` weiming
2008-07-10 6:20 ` Derek Murray
1 sibling, 0 replies; 3+ messages in thread
From: weiming @ 2008-07-10 2:34 UTC (permalink / raw)
To: 吴佳民; +Cc: xen-devel@lists.xensource.com
[-- Attachment #1.1: Type: text/plain, Size: 947 bytes --]
you can use xc_translate_foreign_address to get a the mfn of a give virtual
address
2008/7/9 吴佳民 <wujiamin_tyut@163.com>:
> Hi:
> I wanna write code about sharing memory between dom0 and domU, and I
> decide to use void *xc_map_foreign_range(int xc_handle, unint32_t dom, int
> size, int port, unsigned long mfn) (this is a function in xenctl.h).
> My question is :
> If I wanna map a range of memory in dom0 to domU, how can I get the
> value of mfn? and I do not know the port here.
>
> Can anybody help me ?
> Thanks .
>
>
> Danius Wu
> =========================================================
>
>
>
>
>
> ------------------------------
> 渊波阔宅 湖景人生 <http://popme.163.com/link/003984_0707_2982.html>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>
[-- Attachment #1.2: Type: text/html, Size: 1901 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] 3+ messages in thread
* Re: question about mapping memory from Dom0 to domU
2008-07-10 2:30 question about mapping memory from Dom0 to domU 吴佳民
2008-07-10 2:34 ` weiming
@ 2008-07-10 6:20 ` Derek Murray
1 sibling, 0 replies; 3+ messages in thread
From: Derek Murray @ 2008-07-10 6:20 UTC (permalink / raw)
To: 吴佳民; +Cc: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]
Hi,
This won't work: xc_map_foreign_range can only be used in privileged
domains (i.e. Dom0) to map memory from DomUs. This is because allowing
a DomU to map arbitrary memory from another domain would undermine the
security and isolation of the system.
You could use xc_map_foreign_range in Dom0 to map memory from the
DomU. However, it would be better still to use grant references, as
this would observe the principle of least privilege.
Note also that the parameter "port" is actually "prot", which
corresponds to the page-protection on the mapped pages (e.g.
PROT_READ, or PROT_READ | PROT_WRITE).
Regards,
Derek Murray.
2008/7/10 吴佳民 <wujiamin_tyut@163.com>:
> Hi:
> I wanna write code about sharing memory between dom0 and domU, and I
> decide to use void *xc_map_foreign_range(int xc_handle, unint32_t dom, int
> size, int port, unsigned long mfn) (this is a function in xenctl.h).
> My question is :
> If I wanna map a range of memory in dom0 to domU, how can I get the value
> of mfn? and I do not know the port here.
>
> Can anybody help me ?
> Thanks .
>
>
> Danius Wu
> =========================================================
>
>
>
>
> ________________________________
> 渊波阔宅 湖景人生
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>
>
[-- 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] 3+ messages in thread
end of thread, other threads:[~2008-07-10 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 2:30 question about mapping memory from Dom0 to domU 吴佳民
2008-07-10 2:34 ` weiming
2008-07-10 6:20 ` Derek Murray
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.