summaryrefslogtreecommitdiffstats
path: root/target-arm
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@xilinx.com>2016-02-03 13:46:33 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:31:25 -0600
commit37bd535d6a20f3888beb23b3c09a2a064271338f (patch)
tree7b1f5f536171507450fed4de76a6acd61616c2fa /target-arm
parent1ea7d5a4e84ba3068e08201eea5d684ffe78f1e6 (diff)
downloadhqemu-37bd535d6a20f3888beb23b3c09a2a064271338f.zip
hqemu-37bd535d6a20f3888beb23b3c09a2a064271338f.tar.gz
target-arm: Apply S2 MMU startlevel table size check to AArch64
The S2 starting level table size check applies to both AArch32 and AArch64. Move it to common code. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Message-id: 1453932970-14576-2-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/helper.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 5908745..4d0c79c 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -6778,11 +6778,19 @@ typedef enum {
static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
int inputsize, int stride)
{
+ const int grainsize = stride + 3;
+ int startsizecheck;
+
/* Negative levels are never allowed. */
if (level < 0) {
return false;
}
+ startsizecheck = inputsize - ((3 - level) * stride + grainsize);
+ if (startsizecheck < 1 || startsizecheck > stride + 4) {
+ return false;
+ }
+
if (is_aa64) {
unsigned int pamax = arm_pamax(cpu);
@@ -6806,20 +6814,12 @@ static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
g_assert_not_reached();
}
} else {
- const int grainsize = stride + 3;
- int startsizecheck;
-
/* AArch32 only supports 4KB pages. Assert on that. */
assert(stride == 9);
if (level == 0) {
return false;
}
-
- startsizecheck = inputsize - ((3 - level) * stride + grainsize);
- if (startsizecheck < 1 || startsizecheck > stride + 4) {
- return false;
- }
}
return true;
}
OpenPOWER on IntegriCloud