aboutsummaryrefslogtreecommitdiff
path: root/hw/intc/arm_gicv3_redist.c
diff options
context:
space:
mode:
authorAmol Surati <suratiamol@gmail.com>2018-06-22 13:28:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-06-22 13:28:34 +0100
commitd419890c0448281d0cf11d9384d9a30c8808f648 (patch)
tree7a97a197adbe61c052f4368369c051f61b22b9c8 /hw/intc/arm_gicv3_redist.c
parentde44c044420d1139480fa50c2d5be19223391218 (diff)
hw/intc/arm_gicv3: fix an extra left-shift when reading IPRIORITYR
When either GICD_IPRIORITYR or GICR_IPRIORITYR is read as a 32-bit register, the post left-shift operator in the for loop causes an extra shift after the least significant byte has been placed. The 32-bit value actually returned is therefore the expected value shifted left by 8 bits. Signed-off-by: Amol Surati <suratiamol@gmail.com> Message-id: 20180614054857.26248-1-suratiamol@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/intc/arm_gicv3_redist.c')
-rw-r--r--hw/intc/arm_gicv3_redist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c
index 8a8684d76e..3b0ba6de1a 100644
--- a/hw/intc/arm_gicv3_redist.c
+++ b/hw/intc/arm_gicv3_redist.c
@@ -192,7 +192,8 @@ static MemTxResult gicr_readl(GICv3CPUState *cs, hwaddr offset,
int i, irq = offset - GICR_IPRIORITYR;
uint32_t value = 0;
- for (i = irq + 3; i >= irq; i--, value <<= 8) {
+ for (i = irq + 3; i >= irq; i--) {
+ value <<= 8;
value |= gicr_read_ipriorityr(cs, attrs, i);
}
*data = value;