# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 0b9462fe3fdf3cfe5caf51bb9cc2e549793d1828
# Parent  d87d602408d5a25715fc9bd19ec3fd02395a1c8f
[XEN][POWERPC] Implement H_READ from the PAPR

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/papr/xlate.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff -r d87d602408d5 -r 0b9462fe3fdf xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c     Thu Aug 24 21:07:46 2006 -0400
+++ b/xen/arch/powerpc/papr/xlate.c     Fri Aug 25 14:34:51 2006 -0400
@@ -30,12 +30,6 @@
 #include <asm/papr.h>
 #include <asm/hcalls.h>
 
-static void not_yet(struct cpu_user_regs *regs)
-{
-    printk("not implemented yet: 0x%lx\n", regs->gprs[3]);
-    for (;;);
-}
-
 #ifdef USE_PTE_INSERT
 static inline void pte_insert(union pte volatile *pte,
         ulong vsid, ulong rpn, ulong lrpn)
@@ -493,8 +487,42 @@ static void h_remove(struct cpu_user_reg
     pte_tlbie(&lpte, ptex);
 }
 
+static void h_read(struct cpu_user_regs *regs)
+{
+    ulong flags = regs->gprs[4];
+    ulong ptex = regs->gprs[5];
+    struct vcpu *v = get_current();
+    struct domain *d = v->domain;
+    struct domain_htab *htab = &d->arch.htab;
+    union pte volatile *pte;
+
+       if (flags & H_READ_4)
+        ptex &= ~0x3UL;
+
+    if (ptex > (1UL << htab->log_num_ptes)) {
+        regs->gprs[3] = H_Parameter;
+        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        return;
+    }
+    pte = &htab->map[ptex];
+    regs->gprs[4] = pte[0].words.vsid;
+    regs->gprs[5] = pte[0].words.rpn;
+
+    if (!(flags & H_READ_4)) {
+        /* dump another 3 PTEs */
+        regs->gprs[6] = pte[1].words.vsid;
+        regs->gprs[7] = pte[1].words.rpn;
+        regs->gprs[8] = pte[2].words.vsid;
+        regs->gprs[9] = pte[2].words.rpn;
+        regs->gprs[10] = pte[3].words.vsid;
+        regs->gprs[11] = pte[3].words.rpn;
+    }
+
+    regs->gprs[3] = H_Success;
+}
+
 __init_papr_hcall(H_ENTER, h_enter);
-__init_papr_hcall(H_READ, not_yet);
+__init_papr_hcall(H_READ, h_read);
 __init_papr_hcall(H_REMOVE, h_remove);
 __init_papr_hcall(H_CLEAR_MOD, h_clear_mod);
 __init_papr_hcall(H_CLEAR_REF, h_clear_ref);

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

Reply via email to