On 28 February 2018 at 11:01, Abdallah Bouassida <abdallah.bouass...@lauterbach.com> wrote: > This is a callback to set the cp-regs registered by the dynamic XML. > > Signed-off-by: Abdallah Bouassida <abdallah.bouass...@lauterbach.com> > --- >>> Some of our customers need to connect to Qemu using our tool TRACE32® >>> via GDB, >>> and for some use case they need to have write access to some particular >>> cpregs. >>> So, it will be nice to have this capability! >>> Usually, a user won't modify these registers unless he knows what he is >>> doing! > >> I also still don't really like using write_raw_cp_reg() here -- >> it will bypass some behaviour you want and in some cases will >> just break the emulation because invariants we assume will >> hold no longer hold. It would be a lot lot safer to not >> provide write access at all, only read access. > > Adding to that our customers may need this write access, our tool TRACE32® > needs this also in some particular cases. For example: temporary disabling MMU > to do a physical memory access.
By clearing the SCTLR bit? That's a good example of a case that won't work reliably. If you clear the SCTLR.M bit via raw_write this will not perform the tlb_flush() that it needs to, which means that if anything does a memory access via the QEMU TLB it may get the wrong cached results. If you always clear the bit, do one gdb memory access then set the bit then it will probably not run into problems but you're walking on thin ice. thanks -- PMM