|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Update util.h
XENNET does not use much of the functionality in util.h, including the
__AllocatePages()/__FreePages() functions modified by this change, however
it is good to keep the header in-sync with the other drivers.
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
src/xennet/util.h | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/xennet/util.h b/src/xennet/util.h
index d634033..83008ad 100644
--- a/src/xennet/util.h
+++ b/src/xennet/util.h
@@ -170,8 +170,8 @@ __FreePoolWithTag(
}
static FORCEINLINE PMDL
-__AllocatePage(
- VOID
+__AllocatePages(
+ IN ULONG Count
)
{
PHYSICAL_ADDRESS LowAddress;
@@ -185,7 +185,7 @@ __AllocatePage(
LowAddress.QuadPart = 0ull;
HighAddress.QuadPart = ~0ull;
SkipBytes.QuadPart = 0ull;
- TotalBytes = (SIZE_T)PAGE_SIZE;
+ TotalBytes = (SIZE_T)PAGE_SIZE * Count;
Mdl = MmAllocatePagesForMdlEx(LowAddress,
HighAddress,
@@ -198,7 +198,7 @@ __AllocatePage(
if (Mdl == NULL)
goto fail1;
- if (Mdl->ByteCount < PAGE_SIZE)
+ if (Mdl->ByteCount < TotalBytes)
goto fail2;
ASSERT((Mdl->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA |
@@ -219,9 +219,13 @@ __AllocatePage(
if (MdlMappedSystemVa == NULL)
goto fail3;
- ASSERT3P(MdlMappedSystemVa, ==, Mdl->MappedSystemVa);
+ Mdl->StartVa = PAGE_ALIGN(MdlMappedSystemVa);
- RtlZeroMemory(MdlMappedSystemVa, PAGE_SIZE);
+ ASSERT3U(Mdl->ByteOffset, ==, 0);
+ ASSERT3P(Mdl->StartVa, ==, MdlMappedSystemVa);
+ ASSERT3P(Mdl->MappedSystemVa, ==, MdlMappedSystemVa);
+
+ RtlZeroMemory(MdlMappedSystemVa, Mdl->ByteCount);
return Mdl;
@@ -240,8 +244,10 @@ fail1:
return NULL;
}
+#define __AllocatePage() __AllocatePages(1)
+
static FORCEINLINE VOID
-__FreePage(
+__FreePages(
IN PMDL Mdl
)
{
@@ -250,13 +256,14 @@ __FreePage(
ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
MdlMappedSystemVa = Mdl->MappedSystemVa;
- RtlFillMemory(MdlMappedSystemVa, PAGE_SIZE, 0xAA);
-
MmUnmapLockedPages(MdlMappedSystemVa, Mdl);
MmFreePagesFromMdl(Mdl);
+ ExFreePool(Mdl);
}
+#define __FreePage(_Mdl) __FreePages(_Mdl)
+
static FORCEINLINE PCHAR
__strtok_r(
IN PCHAR Buffer,
--
2.5.3
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |