[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause AD
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL exception |
Date: |
Fri, 22 Jun 2018 01:31:33 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 06/20/2018 09:06 AM, Yongbok Kim wrote:
> From: Yongbok Kim <address@hidden>
>
> Fix ERET/ERETNC can cause ADEL exception
>
> Signed-off-by: Yongbok Kim <address@hidden>
> ---
> target/mips/op_helper.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
> index 6f5e5a3..09ec20a 100644
> --- a/target/mips/op_helper.c
> +++ b/target/mips/op_helper.c
> @@ -2434,6 +2434,13 @@ static void set_pc(CPUMIPSState *env, target_ulong
> error_pc)
> env->active_tc.PC = error_pc & ~(target_ulong)1;
> if (env->insn_flags & ISA_NANOMIPS32) {
> /* Don't clear MIPS_HFLAG_M16 */
> + if (error_pc & 1) {
> + if (!(env->hflags & MIPS_HFLAG_DM)) {
> + env->CP0_BadVAddr = error_pc;
> + }
> + env->active_tc.PC = error_pc;
> + do_raise_exception(env, EXCP_AdEL, 0);
> + }
> return;
> }
> if (error_pc & 1) {
> @@ -2471,10 +2478,12 @@ void helper_eretnc(CPUMIPSState *env)
> void helper_deret(CPUMIPSState *env)
> {
> debug_pre_eret(env);
> - set_pc(env, env->CP0_DEPC);
>
> env->hflags &= ~MIPS_HFLAG_DM;
> compute_hflags(env);
> +
> + set_pc(env, env->CP0_DEPC);
Now set_pc() uses MIPS_HFLAG_DM, so it makes sens to call it _after_
updating env->hflags. Correct.
> +
> debug_post_eret(env);
> }
> #endif /* !CONFIG_USER_ONLY */
>
- [Qemu-devel] [PATCH 22/35] target/mips: Fix data type for offset, (continued)
- [Qemu-devel] [PATCH 22/35] target/mips: Fix data type for offset, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 23/35] target/mips: Update BadInstr{P} regs on nanoMIPS, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 24/35] target/mips: Add nanoMIPS CP0_BadInstrX register, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 25/35] target/mips: Config3.ISAOnExc is read only in nanoMIPS, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 26/35] target/mips: Fix nanoMIPS exception_resume_pc, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 27/35] target/mips: Fix nanoMIPS set_hflags_for_handler, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 28/35] target/mips: Fix nanoMIPS set_pc, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL exception, Yongbok Kim, 2018/06/20
- Re: [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL exception,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 30/35] hw/mips: Add basic nanoMIPS boot code, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 31/35] mips_malta: Setup GT64120 BARs in nanoMIPS bootloader, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 32/35] hw/mips: Fix semihosting argument passing for nanoMIPS bare metal, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 33/35] target/mips: Fix gdbstub to read/write 64 bit FP registers, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 34/35] target/mips: Disable gdbstub nanoMIPS ISA bit, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 35/35] target/mips: Add I7200 CPU, Yongbok Kim, 2018/06/20
- Re: [Qemu-devel] [PATCH 00/35] nanoMIPS, Philippe Mathieu-Daudé, 2018/06/22