From: Edgar E. Iglesias Date: Wed, 3 Feb 2016 13:46:33 +0000 (+0000) Subject: target-arm: Implement the S2 MMU inputsize > pamax check X-Git-Tag: v2.6.0-rc0~149^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3526423e867765568ad95b8094ae8b4042cac215;p=thirdparty%2Fqemu.git target-arm: Implement the S2 MMU inputsize > pamax check Implement the inputsize > pamax check for Stage 2 translations. This is CONSTRAINED UNPREDICTABLE and we choose to fault. Signed-off-by: Edgar E. Iglesias Reviewed-by: Alex Bennée Message-id: 1453932970-14576-4-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- diff --git a/target-arm/helper.c b/target-arm/helper.c index 31ff6501479..5ea507f5bc7 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6790,6 +6790,7 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, } if (is_aa64) { + CPUARMState *env = &cpu->env; unsigned int pamax = arm_pamax(cpu); switch (stride) { @@ -6811,6 +6812,13 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, default: g_assert_not_reached(); } + + /* Inputsize checks. */ + if (inputsize > pamax && + (arm_el_is_aa64(env, 1) || inputsize > 40)) { + /* This is CONSTRAINED UNPREDICTABLE and we choose to fault. */ + return false; + } } else { /* AArch32 only supports 4KB pages. Assert on that. */ assert(stride == 9);