On Sat, Dec 05, 2020 at 06:38:25AM -0600, Richard Henderson wrote: > The difference is that the slow path is aware that there are input registers > that are live, containing data (addrlo, addrhi, datalo, datahi), which must be > stored into the arguments for the slow path call. Those input registers (and > all other call-clobbered registers) are dead *after* the slow path call. > > You are injecting your filter call while those input registers are still live. > They will be next used by the fast-path store. > > That is a very significant difference.
Ok. That's why I saved REG_L1 (prepared by tlb_load) for both st/ld_direct use, plus datalo for st_direct only. I saw datahi is only used for MO_64 on 32bits tcg-target. And I better understand it thanks to you. This leads me to that simple reflection: If we want to filter on every memory accesses, *out of the fast-path*, the most natural place to do so would be in store_helper() and load_helper() from accel/tcg/cputlb.c. By doing so, every target would benefit from filtering, and even specific helpers using cpu_ldst functions would be intercepted. No ? For the remaining fast-path case, it could be interesting to generate it this time at IR level (tlb_load, jne to slow_path, direct load/store) ? Again every target would benefit from filtering without the need for a specific fast-path implementation in tcg/<arch>/tcg-target.c.inc Wouldn't it be simplier than actual mem plugin implementation, which generate fitler callback *after* load/store and has specific extra work for tracking memory accesses performed from helpers (afaiu) ?
