2021-06-09 11:34:23 +10:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _ASM_POWERPC_SET_MEMORY_H
|
|
|
|
#define _ASM_POWERPC_SET_MEMORY_H
|
|
|
|
|
|
|
|
#define SET_MEMORY_RO 0
|
|
|
|
#define SET_MEMORY_RW 1
|
|
|
|
#define SET_MEMORY_NX 2
|
|
|
|
#define SET_MEMORY_X 3
|
2021-12-24 11:07:40 +00:00
|
|
|
#define SET_MEMORY_NP 4 /* Set memory non present */
|
|
|
|
#define SET_MEMORY_P 5 /* Set memory present */
|
2024-02-16 11:12:05 +01:00
|
|
|
#define SET_MEMORY_ROX 6
|
2021-06-09 11:34:23 +10:00
|
|
|
|
|
|
|
int change_memory_attr(unsigned long addr, int numpages, long action);
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_ro(unsigned long addr, int numpages)
|
2021-06-09 11:34:23 +10:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_RO);
|
|
|
|
}
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_rw(unsigned long addr, int numpages)
|
2021-06-09 11:34:23 +10:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_RW);
|
|
|
|
}
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_nx(unsigned long addr, int numpages)
|
2021-06-09 11:34:23 +10:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_NX);
|
|
|
|
}
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_x(unsigned long addr, int numpages)
|
2021-06-09 11:34:23 +10:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_X);
|
|
|
|
}
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_np(unsigned long addr, int numpages)
|
2021-12-24 11:07:40 +00:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_NP);
|
|
|
|
}
|
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_p(unsigned long addr, int numpages)
|
2021-12-24 11:07:40 +00:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_P);
|
|
|
|
}
|
2021-06-09 11:34:30 +10:00
|
|
|
|
2024-09-07 17:40:41 +02:00
|
|
|
static inline int __must_check set_memory_rox(unsigned long addr, int numpages)
|
2024-02-16 11:12:05 +01:00
|
|
|
{
|
|
|
|
return change_memory_attr(addr, numpages, SET_MEMORY_ROX);
|
|
|
|
}
|
|
|
|
#define set_memory_rox set_memory_rox
|
|
|
|
|
2021-06-09 11:34:23 +10:00
|
|
|
#endif
|