[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/25] exec.c: address_space_translate: handle acces
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 01/25] exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region |
Date: |
Thu, 20 Jun 2013 16:44:29 +0200 |
From: Peter Maydell <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
exec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exec.c b/exec.c
index 5b8b40d..eb200d0 100644
--- a/exec.c
+++ b/exec.c
@@ -218,7 +218,7 @@ MemoryRegionSection *address_space_translate(AddressSpace
*as, hwaddr addr,
*xlat = addr + section->offset_within_region;
diff = int128_sub(section->mr->size, int128_make64(addr));
- *plen = MIN(int128_get64(diff), *plen);
+ *plen = int128_get64(int128_min(diff, int128_make64(*plen)));
return section;
}
#endif
--
1.8.1.4
- [Qemu-devel] [PULL 00/25] Memory/IOMMU patches, part 3: IOMMU implementation, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 01/25] exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 02/25] memory: Introduce address_space_lookup_region, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 03/25] memory: move private types to exec.c, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 04/25] exec: Allow unaligned address_space_rw, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 05/25] exec: Resolve subpages in one step except for IOTLB fills, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 06/25] exec: Implement subpage_read/write via address_space_rw, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 07/25] exec: return MemoryRegion from address_space_translate, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 08/25] Revert "memory: limit sections in the radix tree to the actual address space size", Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 09/25] Revert "s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62", Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 10/25] exec: reorganize mem_add to match Int128 version, Paolo Bonzini, 2013/06/20
- [Qemu-devel] [PATCH 12/25] memory: iommu support, Paolo Bonzini, 2013/06/20