On 30/05/14 23:41, Aurelien Jarno wrote: >> In R6 the special behaviour for data references is also specified for Kernel >> and Supervisor mode. Therefore MIPS_HFLAG_UX is replaced by generic >> MIPS_HFLAG_X >> indicating whether 64-bit mode is enabled in current operating mode. > > I haven't found any indication of that in the MIPS64R6 manual (MD00091 > version 6.00). Section 4.10 still only mentions the user mode. > > Did I miss something?
You can find it in the Volume-II document (MD00087): Section "2.2.2.4.3 memory_address". It seems that some parts of MD00091 document haven't been fully updated yet. >> +#if defined(TARGET_MIPS64) >> +static inline int is_wrapping_needed(DisasContext *ctx) >> +{ >> + if (!(ctx->hflags & MIPS_HFLAG_X)) { >> + /* If not R6 then wrap only in User Mode */ >> + if ((ctx->insn_flags & ISA_MIPS64R6) || >> + ((ctx->hflags & MIPS_HFLAG_KSU) == MIPS_HFLAG_UM)) { >> + return 1; >> + } >> + } >> + return 0; >> +} >> +#endif > > As Richard said, this code should be moved above, and the HFLAG semantic > should be changed to "address wrapping needed". The current code is > already wrong (and I am afraid I am the author...). > > So this could be done by renaming the HFLAG to for exemple > MIPS_HFLAG_AWRAP, and checking only for this flag in gen_op_addr_add. > Then the checks have to be adapted in compute_hflags, including the R6 > case. I'll correct this. Thanks for the suggestion. Leon