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 (1160B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _ASM_POWERPC_SET_MEMORY_H
      3#define _ASM_POWERPC_SET_MEMORY_H
      4
      5#define SET_MEMORY_RO	0
      6#define SET_MEMORY_RW	1
      7#define SET_MEMORY_NX	2
      8#define SET_MEMORY_X	3
      9#define SET_MEMORY_NP	4	/* Set memory non present */
     10#define SET_MEMORY_P	5	/* Set memory present */
     11
     12int change_memory_attr(unsigned long addr, int numpages, long action);
     13
     14static inline int set_memory_ro(unsigned long addr, int numpages)
     15{
     16	return change_memory_attr(addr, numpages, SET_MEMORY_RO);
     17}
     18
     19static inline int set_memory_rw(unsigned long addr, int numpages)
     20{
     21	return change_memory_attr(addr, numpages, SET_MEMORY_RW);
     22}
     23
     24static inline int set_memory_nx(unsigned long addr, int numpages)
     25{
     26	return change_memory_attr(addr, numpages, SET_MEMORY_NX);
     27}
     28
     29static inline int set_memory_x(unsigned long addr, int numpages)
     30{
     31	return change_memory_attr(addr, numpages, SET_MEMORY_X);
     32}
     33
     34static inline int set_memory_np(unsigned long addr, int numpages)
     35{
     36	return change_memory_attr(addr, numpages, SET_MEMORY_NP);
     37}
     38
     39static inline int set_memory_p(unsigned long addr, int numpages)
     40{
     41	return change_memory_attr(addr, numpages, SET_MEMORY_P);
     42}
     43
     44#endif