Received: from eggs.gnu.org ([2001:4830:134:3::10]:35032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNFz-0002eM-Uq for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuNFv-0001j2-TX for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:23 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:48962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuNFv-0001ih-BT for qemu-devel@nongnu.org; Thu, 05 Nov 2015 11:19:19 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Nov 2015 16:19:18 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5FBBC1B0806E for ; Thu, 5 Nov 2015 16:19:15 +0000 (GMT) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tA5GJ0x2000326 for ; Thu, 5 Nov 2015 16:19:00 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tA5GIxgS021185 for ; Thu, 5 Nov 2015 09:19:00 -0700 From: Pierre Morel Date: Thu, 5 Nov 2015 17:18:52 +0100 Message-Id: <1446740339-31366-1-git-send-email-pmorel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 0/7] int128: reparing broken 128 bit memory calculations List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, pbonzini@redhat.com, pmorel@linux.vnet.ibm.com, peter.maydell@linaro.org The size of a memory area can never be negative. It follows it must be defined as an unsigned value. Let's modify the memory regions size to unsigned 128 integer and modify accordingly the 128 bit arithmetic. This makes memory size calculations easier and easier to understand. I fear loud protest but really, it is a broken concept that obfuscate the code. Pierre Morel (7): int128: use unsigned 128 bit arithmetic memory: modify memory size for an unsigned 128bit int 128bit: adapt core files for unsigned 128bits 128bit: adapt sparc mmu_helper for UInt128 128bit: adapt VFIO for UInt128 arithmetic 128bit: adapt Virtio for UInt128 arithmetic 128bits: some HW components use 128bit arithmetic. exec.c | 32 ++++---- hw/core/loader.c | 2 +- hw/display/exynos4210_fimd.c | 4 +- hw/display/framebuffer.c | 2 +- hw/mem/pc-dimm.c | 6 +- hw/pci-host/ppce500.c | 2 +- hw/vfio/common.c | 20 +++--- hw/virtio/dataplane/vring.c | 2 +- hw/virtio/vhost.c | 4 +- hw/virtio/virtio-balloon.c | 2 +- include/exec/memory.h | 4 +- include/qemu/int128.h | 95 ++++++++++----------- kvm-all.c | 16 ++-- memory.c | 184 +++++++++++++++++++++--------------------- memory_mapping.c | 2 +- target-sparc/mmu_helper.c | 2 +- 16 files changed, 187 insertions(+), 192 deletions(-)