Received: from eggs.gnu.org ([2001:4830:134:3::10]:55866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMD5m-0004Zr-7k for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMD5g-0007dJ-TH for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:22 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:50008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMD5g-0007dB-NE for qemu-devel@nongnu.org; Fri, 13 Feb 2015 05:03:16 -0500 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 77BA6E156E744 for ; Fri, 13 Feb 2015 10:03:13 +0000 (GMT) From: Leon Alrae Date: Fri, 13 Feb 2015 10:02:08 +0000 Message-ID: <1423821732-22542-11-git-send-email-leon.alrae@imgtec.com> In-Reply-To: <1423821732-22542-1-git-send-email-leon.alrae@imgtec.com> References: <1423821732-22542-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PULL 10/14] target-mips: ll and lld cause AdEL exception for unaligned address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Leon Alrae Reviewed-by: Maciej W. Rozycki --- target-mips/op_helper.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index ea7d95f..73a8e45 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -304,16 +304,20 @@ static inline hwaddr do_translate_address(CPUMIPSState *env, } } -#define HELPER_LD_ATOMIC(name, insn) \ +#define HELPER_LD_ATOMIC(name, insn, almask) \ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \ { \ + if (arg & almask) { \ + env->CP0_BadVAddr = arg; \ + helper_raise_exception(env, EXCP_AdEL); \ + } \ env->lladdr = do_translate_address(env, arg, 0); \ env->llval = do_##insn(env, arg, mem_idx); \ return env->llval; \ } -HELPER_LD_ATOMIC(ll, lw) +HELPER_LD_ATOMIC(ll, lw, 0x3) #ifdef TARGET_MIPS64 -HELPER_LD_ATOMIC(lld, ld) +HELPER_LD_ATOMIC(lld, ld, 0x7) #endif #undef HELPER_LD_ATOMIC -- 2.1.0