]> git.proxmox.com Git - qemu.git/commit - exec.c
exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 20 Jun 2013 14:18:04 +0000 (15:18 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Jun 2013 14:32:46 +0000 (16:32 +0200)
commit3752a0364883ed00100cc537832c434de3f77931
treefbd3ed77e78cffb8cbd987d3e60e9d2fc56899d8
parent4eda32f588086b6cd0ec2be6a7a6c131f8c2b427
exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region

The memory API allows a MemoryRegion's size to be 2^64, as a special
case (otherwise the size always fits in a 64 bit integer). This meant
that attempts to access address zero in a 2^64 sized region would
assert in address_space_translate():

  #3  0x00007ffff3e4d192 in __GI___assert_fail#(assertion=0x555555a43f32
    "!a.hi", file=0x555555a43ef0 "include/qemu/int128.h", line=18,
    function=0x555555a4439f "int128_get64") at assert.c:103
  #4  0x0000555555877642 in int128_get64 (a=...)
    at include/qemu/int128.h:18
  #5  0x00005555558782f2 in address_space_translate (as=0x55555668d140,
   /addr=0, xlat=0x7fffafac9918, plen=0x7fffafac9920, is_write=false)
    at exec.c:221

Fix this by doing the 'min' operation in 128 bit arithmetic
rather than 64 bit arithmetic (we know the result of the 'min'
definitely fits in 64 bits because one of the inputs did).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c