diff options
author | Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 2016-02-03 13:46:33 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-02-03 13:46:33 +0000 |
commit | 98d68ec289750139258d9cd9ab3f6d7dd10bb762 (patch) | |
tree | de98b88fd3c51360fca308f3513a5e7a8091d732 /target-arm | |
parent | 48d21a576a9cd5fd223bda416abb68b5c2818b52 (diff) | |
download | qemu-98d68ec289750139258d9cd9ab3f6d7dd10bb762.zip qemu-98d68ec289750139258d9cd9ab3f6d7dd10bb762.tar.gz qemu-98d68ec289750139258d9cd9ab3f6d7dd10bb762.tar.bz2 |
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.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c index b631b83..f5e6fb1 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6775,11 +6775,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); @@ -6803,20 +6811,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; } |