This makes sure that the last cache line gets invalidated properly.
This matches the example code at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/BABJDBHI.html.
Differential D42196
[compiler-rt] [builtins] Align addresses to cache lines in __clear_cache for aarch64 mstorsjo on Jan 17 2018, 12:55 PM. Authored by
Details
This makes sure that the last cache line gets invalidated properly. This matches the example code at http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/BABJDBHI.html.
Diff Detail
Event TimelineComment Actions I guess this comes down to the interpretation of (begin, end] when you can only clear a cache line at a time. I think that this makes sense as it matches the powerpc64 below, Linux also follows this approach. I'm not sure how this is done on BSD and Darwin. Linux links:
Comment Actions It also matches libgcc: https://github.com/gcc-mirror/gcc/blob/master/libgcc/config/aarch64/sync-cache.c I'm not sure at what granularity memory protection can be set (if it can be more granular than the cache line size) - in that case, we shouldn't align the start but instead align after each (= the first) increment instead. But seeing as nobody else does that, including libgcc that operates in user mode, I think this should be fine. Comment Actions @peter.smith Would you care to approve this one, when there don't seem to be anybody else interested in it? Comment Actions @hans - I think this is a pretty simple/straightforward bugfix that might be worthy of backporting to 6.0. |