Re: Kernel crash on qemu-m68k-system while building r-cran packages

Laurent Vivier
2020-05-30T16:19:26Z

Le 30/05/2020 à 17:27, John Paul Adrian Glaubitz a écrit :
> Hi Laurent!
>
> On 5/30/20 5:12 PM, Laurent Vivier wrote:
>> As the package is available, I've been able to reproduce the problem
>> with logs enabled. Apparently the instruction is not decoded correctly:
>>
>> ----------------
>> IN:
>> 0x00016a2c: fmovel #0,%fpsr
>> Disassembler disagrees with translator over instruction decoding
>> Please report this to qemu-devel@nongnu.org
>>
>> OP:
>> ld_i32 tmp0,env,$0xfffffffffffffff0
>> movi_i32 tmp1,$0x0
>> brcond_i32 tmp0,tmp1,lt,$L0
>>
>> ---- 00016a2c 00000000
>> movi_i32 PC,$0x16a2c
>> movi_i32 tmp0,$0x3
>> call raise_exception,$0x0,$0,env,tmp0
>> set_label $L0
>> exit_tb $0x7fc2a0da5643
>>
>> INT 49331: Address Error(0xc) pc=00016a2c sp=3cc91f30 sr=2004
>>
>> I try to fix that...
>
> Ah, cool. Thanks a lot. And sorry for not replying earlier, I missed your
> previous mail.

No problem.

I've investigated and the fmovel with immediate value is not implemented...

The following patch fixes the crash but then I have a soft lockup. IT
needs more investigation.

diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 0f80888203d3..c093f6c683e8 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -4936,6 +4936,20 @@ static void gen_op_fmove_fcr(CPUM68KState *env,
DisasContext *s,
gen_store_fcr(s, AREG(insn, 0), mask);
}
return;
+ case 7: /* Immediate */
+ if (REG(insn, 0) == 4) {
+ if (is_write ||
+ (mask != M68K_FPIAR && mask != M68K_FPSR &&
+ mask != M68K_FPCR)) {
+ gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
+ return;
+ }
+ tmp = tcg_const_i32(read_im32(env, s));
+ gen_store_fcr(s, tmp, mask);
+ tcg_temp_free(tmp);
+ return;
+ }
+ break;
default:
break;
}

Thanks,
Laurent