]> xenbits.xensource.com Git - pvdrivers/win/xenvbd.git/commitdiff
Fix HvmGetParameter/HvmSetParameter
authorOwen Smith <owen.smith@citrix.com>
Wed, 25 Feb 2015 15:05:10 +0000 (15:05 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 25 Feb 2015 15:21:27 +0000 (15:21 +0000)
Signed-off-by: Owen Smith <owen.smith@citrix.com>
src/xencrsh/hvm.c
src/xencrsh/hvm.h
src/xencrsh/store.c

index dcc72b6e17219d82d8d0b4483366bdc2fb92d08c..db12256b4b8d53d1e3be6fe1f6ae927f742d5684 100644 (file)
@@ -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;
 }
index 8784fbcfea4e2e9015cba671615f97184e2540be..9b8f1dfb8ba36c8a5f7dab7c662218230f3afdd4 100644 (file)
@@ -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
index f182bf2b7292f0806eec7b0e1a710f95a2277448..d474d5e92670a66291ff6aefd267148280b28c43 100644 (file)
@@ -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;