aboutsummaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-08-03 11:56:14 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-05 10:57:36 -0500
commit8417cebfda193c7f9ca70be5e308eaa92cf84b94 (patch)
treeeda047bcb27a66a65875f4b1b9daa195a7f4b6f6 /exec.c
parent39b796f28c7b42cbecdba56612b5f9c505572f07 (diff)
memory: use signed arithmetic
When trying to map an alias of a ram region, where the alias starts at address A and we map it into address B, and A > B, we had an arithmetic underflow. Because we use unsigned arithmetic, the underflow converted into a large number which failed addrrange_intersects() tests. The concrete example which triggered this was cirrus vga mapping the framebuffer at offsets 0xc0000-0xc7fff (relative to the start of the framebuffer) into offsets 0xa0000 (relative to system addres space start). With our favorite analogy of a windowing system, this is equivalent to dragging a subwindow off the left edge of the screen, and failing to clip it into its parent window which is on screen. Fix by switching to signed arithmetic. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index 476b507e5..751fd8967 100644
--- a/exec.c
+++ b/exec.c
@@ -3818,7 +3818,7 @@ static void io_mem_init(void)
static void memory_map_init(void)
{
system_memory = qemu_malloc(sizeof(*system_memory));
- memory_region_init(system_memory, "system", UINT64_MAX);
+ memory_region_init(system_memory, "system", INT64_MAX);
set_system_memory_map(system_memory);
}