# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 4a1f58739bc25b80eae92af80b9ef309cb25468c
# Parent  7de0dc82cc65d7a0e047e3826395edd15f31a339
[LINUX][POWERPC] Add missing xencomm file.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/xen/xencomm.c |   54 +++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+)

diff -r 7de0dc82cc65 -r 4a1f58739bc2 arch/powerpc/platforms/xen/xencomm.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/arch/powerpc/platforms/xen/xencomm.c      Tue Sep 12 15:53:01 2006 -0500
@@ -0,0 +1,54 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ */
+
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <asm/page.h>
+#include <asm/current.h>
+#include <xen/interface/arch-powerpc.h>
+#include <xen/xencomm.h>
+
+/* translate virtual address to physical address */
+unsigned long xencomm_vtop(unsigned long vaddr)
+{
+       struct page *page;
+       struct vm_area_struct *vma;
+
+       /* NULL is NULL */
+       if (vaddr == 0)
+               return 0;
+
+       if (is_kernel_addr(vaddr))
+               return __pa(vaddr);
+
+       /* XXX double-check (lack of) locking */
+       vma = find_extend_vma(current->mm, vaddr);
+       BUG_ON(!vma);
+       if (!vma)
+               return ~0UL;
+
+       page = follow_page(vma, vaddr, 0);
+       BUG_ON(!page);
+       if (!page)
+               return ~0UL;
+
+       return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK);
+}

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

Reply via email to