Patchwork [2/5] cpu: default TARGET_LONG_ALIGNMENT to TARGET_LONG_SIZE

login
register
mail settings
Submitter Paolo Bonzini
Date April 2, 2013, 2:44 p.m.
Message ID <1364913860-25159-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/233021/
State New
Headers show

Comments

Paolo Bonzini - April 2, 2013, 2:44 p.m.
This is the case for all supported 64-bits architectures.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/exec/cpu-defs.h | 2 +-
 target-alpha/cpu.h      | 1 -
 target-i386/cpu.h       | 1 -
 target-ppc/cpu.h        | 1 -
 target-s390x/cpu.h      | 1 -
 target-sparc/cpu.h      | 1 -
 6 files changed, 1 insertion(+), 6 deletions(-)
Peter Maydell - April 2, 2013, 3:16 p.m.
On 2 April 2013 15:44, Paolo Bonzini <pbonzini@redhat.com> wrote:
> This is the case for all supported 64-bits architectures.

Being sensible with the defaults is good, but I wonder if
we could structure cpu-defs.h (or somewhere else) so there
was a nice clear list of "here are all the things you need
to either define for your new target or check that the
defaults are sensible". Especially for things like the
type alignment it's easy to end up with something that
only mostly works if the default isn't correct for you.

Or maybe I'm being overoptimistic about whether new target
authors would actually check through the list anyway :-)

-- PMM

Patch

diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
index 32d11e8..7d23fc2 100644
--- a/include/exec/cpu-defs.h
+++ b/include/exec/cpu-defs.h
@@ -43,7 +43,7 @@ 
 #define TARGET_INT_ALIGNMENT 4
 #endif
 #ifndef TARGET_LONG_ALIGNMENT
-#define TARGET_LONG_ALIGNMENT 4
+#define TARGET_LONG_ALIGNMENT TARGET_LONG_SIZE
 #endif
 #ifndef TARGET_LLONG_ALIGNMENT
 #define TARGET_LLONG_ALIGNMENT 8
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index b0338fb..2156a1e 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -24,7 +24,6 @@ 
 #include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
-#define TARGET_LONG_ALIGNMENT 8
 
 #define CPUArchState struct CPUAlphaState
 
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index f1ef87c..48f41ca 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -24,7 +24,6 @@ 
 
 #ifdef TARGET_X86_64
 #define TARGET_LONG_BITS 64
-#define TARGET_LONG_ALIGNMENT 8
 #else
 #define TARGET_LONG_BITS 32
 #endif
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 19d4e4c..42c36e2 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -27,7 +27,6 @@ 
 #if defined (TARGET_PPC64)
 /* PowerPC 64 definitions */
 #define TARGET_LONG_BITS 64
-#define TARGET_LONG_ALIGNMENT 8
 #define TARGET_PAGE_BITS 12
 
 /* Note that the official physical address space bits is 62-M where M
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 8a241d3..e351005 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -26,7 +26,6 @@ 
 #include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
-#define TARGET_LONG_ALIGNMENT 8
 
 #define ELF_MACHINE	EM_S390
 
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index 9e5941a..6fa7778 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -13,7 +13,6 @@ 
 #define TARGET_VIRT_ADDR_SPACE_BITS 32
 #else
 #define TARGET_LONG_BITS 64
-#define TARGET_LONG_ALIGNMENT 8
 #define TARGET_DPREGS 32
 #define TARGET_PAGE_BITS 13 /* 8k */
 #define TARGET_PHYS_ADDR_SPACE_BITS 41