On Thu, Jul 03, 2025 at 10:13:44AM -0700, Dave Hansen wrote: > On 7/1/25 02:58, Kirill A. Shutemov wrote: > > Extract memcpy and memset functions from copy_user_generic() and > > __clear_user(). > > > > They can be used as inline memcpy and memset instead of the GCC builtins > > whenever necessary. LASS requires them to handle text_poke. > > Why are we messing with the normal user copy functions? Code reuse is > great, but as you're discovering, the user copy code is highly > specialized and not that easy to reuse for other things. > > Don't we just need a dirt simple chunk of code that does (logically): > > stac(); > asm("rep stosq..."); > clac(); > > Performance doesn't matter for text poking, right? It could be stosq or > anything else that you can inline. It could be a for() loop for all I > care as long as the compiler doesn't transform it into some out-of-line > memset. Right? Yeah, performance doesn't matter for text poking. And this approach simplifies the code quite a bit. I will use direct asm() for text poke. -- Kiryl Shutsemau / Kirill A. Shutemov