Revision 39d51eb8 target-mips/helper.c

b/target-mips/helper.c
295 295
            /* If the exception was raised from a delay slot,
296 296
               come back to the jump.  */
297 297
            env->CP0_DEPC = env->PC - 4;
298
            if (!(env->hflags & MIPS_HFLAG_EXL))
299
                env->CP0_Cause |= (1 << CP0Ca_BD);
298 300
            env->hflags &= ~MIPS_HFLAG_BMASK;
299 301
        } else {
300 302
            env->CP0_DEPC = env->PC;
303
            env->CP0_Cause &= ~(1 << CP0Ca_BD);
301 304
        }
302 305
    enter_debug_mode:
303 306
        env->hflags |= MIPS_HFLAG_DM;
......
318 321
            /* If the exception was raised from a delay slot,
319 322
               come back to the jump.  */
320 323
            env->CP0_ErrorEPC = env->PC - 4;
324
            if (!(env->hflags & MIPS_HFLAG_EXL))
325
                env->CP0_Cause |= (1 << CP0Ca_BD);
321 326
            env->hflags &= ~MIPS_HFLAG_BMASK;
322 327
        } else {
323 328
            env->CP0_ErrorEPC = env->PC;
329
            env->CP0_Cause &= ~(1 << CP0Ca_BD);
324 330
        }
325 331
        env->hflags |= MIPS_HFLAG_ERL;
326 332
	env->CP0_Status |= (1 << CP0St_ERL) | (1 << CP0St_BEV);
......
364 370
        goto set_EPC;
365 371
    case EXCP_CpU:
366 372
        cause = 11;
367
        env->CP0_Cause = (env->CP0_Cause & ~0x03000000) | (env->error_code << 28);
373
        env->CP0_Cause = (env->CP0_Cause & ~(0x3 << CP0Ca_CE)) |
374
                         (env->error_code << CP0Ca_CE);
368 375
        goto set_EPC;
369 376
    case EXCP_OVERFLOW:
370 377
        cause = 12;
......
385 392
            /* If the exception was raised from a delay slot,
386 393
               come back to the jump.  */
387 394
            env->CP0_EPC = env->PC - 4;
388
            env->CP0_Cause |= 0x80000000;
395
            if (!(env->hflags & MIPS_HFLAG_EXL))
396
                env->CP0_Cause |= (1 << CP0Ca_BD);
389 397
            env->hflags &= ~MIPS_HFLAG_BMASK;
390 398
        } else {
391 399
            env->CP0_EPC = env->PC;
392
            env->CP0_Cause &= ~0x80000000;
400
            env->CP0_Cause &= ~(1 << CP0Ca_BD);
393 401
        }
394 402
        if (env->CP0_Status & (1 << CP0St_BEV)) {
395 403
            env->PC = (int32_t)0xBFC00200;

Also available in: Unified diff