From e5fc5a0ed63e722b58a8212b6301dd1da17d3e92 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 29 May 2020 20:04:11 +0100 Subject: [PATCH] Fix infinite loops when testing restricted address ranges. --- app/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.c b/app/main.c index 65c7533..6f9340c 100644 --- a/app/main.c +++ b/app/main.c @@ -214,6 +214,8 @@ static void global_init(void) static void setup_vm_map(uintptr_t win_start, uintptr_t win_end) { + vm_map_size = 0; + // Reduce the window to fit in the user-specified limits. if (win_start < pm_limit_lower) { win_start = pm_limit_lower; @@ -227,7 +229,6 @@ static void setup_vm_map(uintptr_t win_start, uintptr_t win_end) // Now initialise the virtual memory map with the intersection // of the window and the physical memory segments. - vm_map_size = 0; for (int i = 0; i < pm_map_size; i++) { uintptr_t seg_start = pm_map[i].start; uintptr_t seg_end = pm_map[i].end; @@ -327,6 +328,9 @@ static void test_all_windows(int my_pcpu, int my_vcpu) if (vm_map_size == 0) { // No memory to test in this window. + if (my_vcpu == master_vcpu) { + window_num++; + } continue; }