target/arm/cpu: Use div-round-up to determine predicate register array size

Unless we're guaranteed to always increase ARM_MAX_VQ by a multiple of
four, then we should use DIV_ROUND_UP to ensure we get an appropriate
array size.

Backports commit 46417784d21c89446763f2047228977bdc267895 from qemu
This commit is contained in:
Andrew Jones 2019-11-18 20:16:44 -05:00 committed by Lioncash
parent bb8b3bc42b
commit ad63ee7509
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -185,7 +185,7 @@ typedef struct ARMVectorReg {
#ifdef TARGET_AARCH64 #ifdef TARGET_AARCH64
/* In AArch32 mode, predicate registers do not exist at all. */ /* In AArch32 mode, predicate registers do not exist at all. */
typedef struct ARMPredicateReg { typedef struct ARMPredicateReg {
uint64_t QEMU_ALIGNED(16, p[2 * ARM_MAX_VQ / 8]); uint64_t QEMU_ALIGNED(16, p[DIV_ROUND_UP(2 * ARM_MAX_VQ, 8)]);
} ARMPredicateReg; } ARMPredicateReg;
/* In AArch32 mode, PAC keys do not exist at all. */ /* In AArch32 mode, PAC keys do not exist at all. */