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

set_memory.h (989B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _ASMS390_SET_MEMORY_H
      3#define _ASMS390_SET_MEMORY_H
      4
      5#include <linux/mutex.h>
      6
      7extern struct mutex cpa_mutex;
      8
      9#define SET_MEMORY_RO	1UL
     10#define SET_MEMORY_RW	2UL
     11#define SET_MEMORY_NX	4UL
     12#define SET_MEMORY_X	8UL
     13#define SET_MEMORY_4K  16UL
     14
     15int __set_memory(unsigned long addr, int numpages, unsigned long flags);
     16
     17static inline int set_memory_ro(unsigned long addr, int numpages)
     18{
     19	return __set_memory(addr, numpages, SET_MEMORY_RO);
     20}
     21
     22static inline int set_memory_rw(unsigned long addr, int numpages)
     23{
     24	return __set_memory(addr, numpages, SET_MEMORY_RW);
     25}
     26
     27static inline int set_memory_nx(unsigned long addr, int numpages)
     28{
     29	return __set_memory(addr, numpages, SET_MEMORY_NX);
     30}
     31
     32static inline int set_memory_x(unsigned long addr, int numpages)
     33{
     34	return __set_memory(addr, numpages, SET_MEMORY_X);
     35}
     36
     37static inline int set_memory_4k(unsigned long addr, int numpages)
     38{
     39	return __set_memory(addr, numpages, SET_MEMORY_4K);
     40}
     41
     42#endif