[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 1/3] Fix HvmGetParameter/HvmSetParameter



Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/xencrsh/hvm.c   | 64 ++++++++++++++++++++++++++++++++++-------------------
 src/xencrsh/hvm.h   |  4 ++--
 src/xencrsh/store.c |  8 +++----
 3 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/src/xencrsh/hvm.c b/src/xencrsh/hvm.c
index dcc72b6..db12256 100644
--- a/src/xencrsh/hvm.c
+++ b/src/xencrsh/hvm.c
@@ -298,46 +298,64 @@ HvmOp(
 
 NTSTATUS
 HvmGetParameter(
-    IN  ULONG           Param,
-    OUT PULONG_PTR      Value
+    IN  ULONG               Param,
+    OUT PULONGLONG          Value
     )
 {
-    struct xen_hvm_param a;
-    LONG_PTR rc;
+    struct xen_hvm_param    op;
+    LONG_PTR                rc;
+    NTSTATUS                status;
 
-    a.domid = DOMID_SELF;
-    a.index = Param;
-    a.value = 0xf001dead;
+    op.domid = DOMID_SELF;
+    op.index = Param;
+    op.value = 0xf001dead;
 
-    rc = HvmOp(HVMOP_get_param, &a);
-    if (rc < 0) {
-        return STATUS_UNSUCCESSFUL;
-    }
+    rc = HvmOp(HVMOP_get_param, &op);
+    if (rc < 0)
+        goto fail1;
 
     /* Horrible hack to cope with the transition from
        return parameters through the hypercall return
        value to returning them through an in-memory
        structure. */
-    if (a.value != 0xf001dead)
-        *Value = (ULONG_PTR)a.value;
+    if (op.value != 0xf001dead)
+        *Value = (ULONG_PTR)op.value;
     else
         *Value = (ULONG_PTR)rc;
 
     return STATUS_SUCCESS;
+
+fail1:
+    ERRNO_TO_STATUS(-rc, status);
+    LogError("fail1 (%08x)\n", status);
+
+    return status;
 }
 
 NTSTATUS
 HvmSetParameter(
-    IN  ULONG           Param,
-    IN  ULONG_PTR       Value
+    IN  ULONG               Param,
+    IN  ULONGLONG           Value
     )
 {
-    struct xen_hvm_param a;
-    a.domid = DOMID_SELF;
-    a.index = Param;
-    a.value = Value;
-    if (HvmOp(HVMOP_set_param, &a) == 0)
-        return STATUS_UNSUCCESSFUL;
-    else
-        return STATUS_SUCCESS;
+    struct xen_hvm_param    op;
+    LONG_PTR                rc;
+    NTSTATUS                status;
+
+    op.domid = DOMID_SELF;
+    op.index = Param;
+    op.value = Value;
+
+    rc = HvmOp(HVMOP_set_param, &op);
+
+    if (rc < 0)
+        goto fail1;
+
+    return STATUS_SUCCESS;
+
+fail1:
+    ERRNO_TO_STATUS(-rc, status);
+    LogError("fail1 (%08x)\n", status);
+
+    return status;
 }
diff --git a/src/xencrsh/hvm.h b/src/xencrsh/hvm.h
index 8784fbc..9b8f1df 100644
--- a/src/xencrsh/hvm.h
+++ b/src/xencrsh/hvm.h
@@ -50,13 +50,13 @@ HvmAddToPhysMap(
 NTSTATUS
 HvmGetParameter(
     IN  ULONG           Param,
-    OUT PULONG_PTR      Value
+    OUT PULONGLONG      Value
     );
 
 NTSTATUS
 HvmSetParameter(
     IN  ULONG           Param,
-    IN  ULONG_PTR       Value
+    IN  ULONGLONG       Value
     );
 
 #endif // _XENVBD_HVM_H
diff --git a/src/xencrsh/store.c b/src/xencrsh/store.c
index f182bf2..d474d5e 100644
--- a/src/xencrsh/store.c
+++ b/src/xencrsh/store.c
@@ -1062,8 +1062,8 @@ __Round(
 NTSTATUS
 StoreInitialize()
 {
-    ULONG_PTR                   Mfn;
-    ULONG_PTR                   Port;
+    ULONGLONG                   Mfn;
+    ULONGLONG                   Port;
     PHYSICAL_ADDRESS            PhysAddr;
     NTSTATUS                    Status;
     struct xenstore_domain_interface*  StoreRingPtr;
@@ -1082,7 +1082,7 @@ StoreInitialize()
     if (!NT_SUCCESS(Status))
         goto fail2;
     
-    LogVerbose("HVM_PARAM_STORE_PFN = %p\n", (PVOID)Mfn);
+    LogVerbose("HVM_PARAM_STORE_PFN = %p\n", (PVOID)(ULONG_PTR)Mfn);
     StoreRingPtr = __Round(&__StoreRingSection[0], PAGE_SIZE);
     PhysAddr = MmGetPhysicalAddress(StoreRingPtr);
 
@@ -1095,7 +1095,7 @@ StoreInitialize()
             LogWarning("Page Swizzle to map store ring succeeded, but didn't 
actually do anything!\n");
     } else {
         LogVerbose("Page Swizzle failed\n");
-        PhysAddr.QuadPart = (ULONGLONG)Mfn << PAGE_SHIFT;
+        PhysAddr.QuadPart = Mfn << PAGE_SHIFT;
         StoreRingPtr = MmMapIoSpace(PhysAddr, PAGE_SIZE, MmCached);
         if (StoreRingPtr == NULL)
             goto fail3;
-- 
1.9.4.msysgit.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.