cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

page.h (676B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2
      3#include <asm/shmparam.h>
      4
      5extern void flush_dcache_page(struct page *page);
      6
      7static inline unsigned long pages_do_alias(unsigned long addr1,
      8					   unsigned long addr2)
      9{
     10	return (addr1 ^ addr2) & (SHMLBA-1);
     11}
     12
     13static inline void clear_user_page(void *addr, unsigned long vaddr,
     14				   struct page *page)
     15{
     16	clear_page(addr);
     17	if (pages_do_alias((unsigned long) addr, vaddr & PAGE_MASK))
     18		flush_dcache_page(page);
     19}
     20
     21static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
     22				  struct page *page)
     23{
     24	copy_page(to, from);
     25	if (pages_do_alias((unsigned long) to, vaddr & PAGE_MASK))
     26		flush_dcache_page(page);
     27}