From: Sascha Bischoff Date: Tue, 18 Apr 2017 14:11:15 +0000 (+0100) Subject: dev: Fix address type promotion issues in VirtIO devices X-Git-Tag: v19.0.0.0~2705 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd5b754974dd7b76a0b8798eb206a4c76a311cee;p=gem5.git dev: Fix address type promotion issues in VirtIO devices With the change we explicitly update the types for the VirtIO bit masks to be Addr (uint64_t). By changing this, we ensure type promotion where it is needed. Therefore, this fixes issues where, in certain situations, address calculations were performed in 32-bits, resulting in overflows. Change-Id: I5c5c3f9a3f94e806812282da01268e18ae0d2d39 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/3968 --- diff --git a/src/dev/virtio/base.hh b/src/dev/virtio/base.hh index 89c281f21..ed3b1b431 100644 --- a/src/dev/virtio/base.hh +++ b/src/dev/virtio/base.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016 ARM Limited + * Copyright (c) 2014, 2016-2017 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -433,8 +433,8 @@ public: * Page size used by VirtIO.\ It's hard-coded to 4096 bytes in * the spec for historical reasons. */ - static const unsigned ALIGN_BITS = 12; - static const unsigned ALIGN_SIZE = 1 << ALIGN_BITS; + static const Addr ALIGN_BITS = 12; + static const Addr ALIGN_SIZE = 1 << ALIGN_BITS; /** @} */ protected: