return status;
}
+__checkReturn
+XEN_API
+NTSTATUS
+MemoryRemoveFromPhysmap(
+ IN PFN_NUMBER Pfn
+ )
+{
+ struct xen_remove_from_physmap op;
+ LONG_PTR rc;
+ NTSTATUS status;
+
+ op.domid = DOMID_SELF;
+ op.gpfn = (xen_pfn_t)Pfn;
+
+ rc = MemoryOp(XENMEM_remove_from_physmap, &op);
+
+ if (rc < 0) {
+ ERRNO_TO_STATUS(-rc, status);
+ goto fail1;
+ }
+
+ return STATUS_SUCCESS;
+
+fail1:
+ Error("fail1 (%08x)\n", status);
+
+ return status;
+}
+
__checkReturn
XEN_API
ULONG
fail3:
Error("fail3\n");
- // Not clear what to do here
+ (VOID) MemoryRemoveFromPhysmap((PFN_NUMBER)(Address.QuadPart >> PAGE_SHIFT));
fail2:
Error("fail2\n");
)
{
LONG Index;
- PHYSICAL_ADDRESS Address;
NTSTATUS status;
- Address = Context->Address;
-
for (Index = 0; Index <= Context->FrameIndex; Index++) {
+ PHYSICAL_ADDRESS Address;
+
+ Address = Context->Address;
+ Address.QuadPart += (ULONGLONG)Index << PAGE_SHIFT;
+
status = MemoryAddToPhysmap((PFN_NUMBER)(Address.QuadPart >> PAGE_SHIFT),
XENMAPSPACE_grant_table,
Index);
Index,
Address.HighPart,
Address.LowPart);
-
- Address.QuadPart += PAGE_SIZE;
}
}
{
LONG Index;
- // Not clear what to do here
+ for (Index = Context->FrameIndex; Index >= 0; --Index) {
+ PHYSICAL_ADDRESS Address;
+
+ Address = Context->Address;
+ Address.QuadPart += (ULONGLONG)Index << PAGE_SHIFT;
+
+ (VOID) MemoryRemoveFromPhysmap((PFN_NUMBER)(Address.QuadPart >> PAGE_SHIFT));
- for (Index = Context->FrameIndex; Index >= 0; --Index)
LogPrintf(LOG_LEVEL_INFO,
"GNTTAB: UNMAP XENMAPSPACE_grant_table[%d]\n",
Index);
+ }
}
static VOID
IN PXENBUS_SHARED_INFO_CONTEXT Context
)
{
- UNREFERENCED_PARAMETER(Context);
-
LogPrintf(LOG_LEVEL_INFO,
"SHARED_INFO: UNMAP XENMAPSPACE_shared_info\n");
- // Not clear what to do here
+
+ (VOID) MemoryRemoveFromPhysmap((PFN_NUMBER)(Context->Address.QuadPart >> PAGE_SHIFT));
}
static VOID