On Mon, Oct 26, 2009 at 4:00 AM, David Brownell <[email protected]> wrote: > On Sunday 25 October 2009, Øyvind Harboe wrote: >> The default implementation of target_read/write_phys_memory >> is to call target_read/write_memory, but I'm thinking the default >> implementation should return an error and >> LOG_ERROR("Not implemented"). > > I count three cases: > > - No MMU ... current approach is more-or-less correct > - MMU, disabled ... ditto > - MMU, enabled ... default is wrong
The default implementation could check if the mmu is enabled (there's even a target->type to do this) and then produce an error if it is enabled. I don't particularly care what happens if someone specifies "phys" on a Cortex M0 that will *never* grow an MMU... > I suspect things get torqued around because the underlying > hardware requires write_phys() to work something like > > if (mmu_enabled) > flush caches and disable mmu > target->write() > if (phys) > reenable mmu > > Is that sort of correct? No. There are targets that can write directly to physical memory without disabling the mmu. I don't think we need or should worry about performance, but rather simplicity and testability. Writing to physical memory is used for tricks like writing to peripherals or creating software breakpoints in mmu read only memory. -- Øyvind Harboe http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer _______________________________________________ Openocd-development mailing list [email protected] https://lists.berlios.de/mailman/listinfo/openocd-development
