qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for-1.7 v2 4/8] exec: don't ignore high address bits


From: Marcel Apfelbaum
Subject: [Qemu-devel] [PATCH for-1.7 v2 4/8] exec: don't ignore high address bits on lookup
Date: Thu, 7 Nov 2013 12:41:20 +0200

From: "Michael S. Tsirkin" <address@hidden>

Lookup of address > target address space should
return an unassigned section, instead of silently
ignoring high bits.

Reported-by: Luiz Capitulino <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
 exec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/exec.c b/exec.c
index 79610ce..aeeaf00 100644
--- a/exec.c
+++ b/exec.c
@@ -197,6 +197,9 @@ static void phys_page_set_level(PhysPageEntry *lp, hwaddr 
*index,
     }
 }
 
+#define TARGET_PHYS_MAX_ADDR  \
+        (0x1ULL << (TARGET_PHYS_ADDR_SPACE_BITS - TARGET_PAGE_BITS))
+
 static void phys_page_set(AddressSpaceDispatch *d,
                           hwaddr index, hwaddr nb,
                           uint16_t leaf)
@@ -213,6 +216,10 @@ static MemoryRegionSection *phys_page_find(PhysPageEntry 
lp, hwaddr index,
     PhysPageEntry *p;
     int i;
 
+    if (index >= TARGET_PHYS_MAX_ADDR) {
+        return &sections[PHYS_SECTION_UNASSIGNED];
+    }
+
     for (i = P_L2_LEVELS - 1; i >= 0 && !lp.is_leaf; i--) {
         if (lp.ptr == PHYS_MAP_NODE_NIL) {
             return &sections[PHYS_SECTION_UNASSIGNED];
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]