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

[Xen-devel] [PATCH v4 09/14] hvmloader: Check modules whereabouts in perform_tests



As perform_tests() is going to clear memory past 4MB, we check that the
memory can be use or we skip the tests.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
Changes in v4:
- move the check into the perform_test() function.
- skip tests instead of using BUG.

New in V3
---
 tools/firmware/hvmloader/tests.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tools/firmware/hvmloader/tests.c b/tools/firmware/hvmloader/tests.c
index fea3ad3..7996206 100644
--- a/tools/firmware/hvmloader/tests.c
+++ b/tools/firmware/hvmloader/tests.c
@@ -210,6 +210,26 @@ void perform_tests(void)
         return;
     }
 
+    /* Check that tests does not use memory where modules are stored */
+    if ( ((uint32_t)hvm_start_info + sizeof(struct hvm_start_info)) > 4 << 20
+         && (uint32_t)hvm_start_info < 8 << 20 )
+    {
+        printf("Skipping tests due to memory used by hvm_start_info\n");
+        return;
+    }
+    for ( unsigned i = 0; i < hvm_start_info->nr_modules; i++ )
+    {
+        const struct hvm_modlist_entry *modlist =
+            (struct hvm_modlist_entry *)hvm_start_info->modlist_paddr;
+        if ( modlist[i].paddr
+             && modlist[i].paddr + modlist[i].size > 4ul << 20
+             && modlist[i].paddr < 8ul << 20 )
+        {
+            printf("Skipping tests due to memory used by a module\n");
+            return;
+        }
+    }
+
     passed = skipped = 0;
     for ( i = 0; tests[i].test; i++ )
     {
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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