summaryrefslogtreecommitdiff
path: root/src/VBox/VMM/VMMAll/MMAllHyper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/VMM/VMMAll/MMAllHyper.cpp')
-rw-r--r--src/VBox/VMM/VMMAll/MMAllHyper.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/VBox/VMM/VMMAll/MMAllHyper.cpp b/src/VBox/VMM/VMMAll/MMAllHyper.cpp
index 4d12895b..b62dd6d7 100644
--- a/src/VBox/VMM/VMMAll/MMAllHyper.cpp
+++ b/src/VBox/VMM/VMMAll/MMAllHyper.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -321,14 +321,13 @@ static int mmHyperAllocInternal(PVM pVM, size_t cb, unsigned uAlignment, MMTAG e
return VERR_MM_HYPER_NO_MEMORY;
}
+
/**
* Wrapper for mmHyperAllocInternal
*/
VMMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv)
{
- int rc;
-
- rc = mmHyperLock(pVM);
+ int rc = mmHyperLock(pVM);
AssertRCReturn(rc, rc);
LogFlow(("MMHyperAlloc %x align=%x tag=%s\n", cb, uAlignment, mmGetTagName(enmTag)));
@@ -339,6 +338,19 @@ VMMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag,
return rc;
}
+
+/**
+ * Duplicates a block of memory.
+ */
+VMMDECL(int) MMHyperDupMem(PVM pVM, const void *pvSrc, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv)
+{
+ int rc = MMHyperAlloc(pVM, cb, uAlignment, enmTag, ppv);
+ if (RT_SUCCESS(rc))
+ memcpy(*ppv, pvSrc, cb);
+ return rc;
+}
+
+
/**
* Allocates a chunk of memory from the specified heap.
* The caller validates the parameters of this request.