3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-02-01 07:42:18 +00:00
Brooklyn/arch/riscv/include/asm/set_memory.h

41 lines
1.2 KiB
C
Raw Normal View History

2021-05-26 19:09:36 +00:00
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2019 SiFive
*/
#ifndef _ASM_RISCV_SET_MEMORY_H
#define _ASM_RISCV_SET_MEMORY_H
#ifndef __ASSEMBLY__
/*
* Functions to change memory attributes.
*/
#ifdef CONFIG_MMU
int set_memory_ro(unsigned long addr, int numpages);
int set_memory_rw(unsigned long addr, int numpages);
int set_memory_x(unsigned long addr, int numpages);
int set_memory_nx(unsigned long addr, int numpages);
#else
static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
#endif
2021-05-26 19:09:36 +00:00
int set_direct_map_invalid_noflush(struct page *page);
int set_direct_map_default_noflush(struct page *page);
#endif /* __ASSEMBLY__ */
2021-09-23 16:59:15 +00:00
#ifdef CONFIG_ARCH_HAS_STRICT_KERNEL_RWX
2021-05-26 19:09:36 +00:00
#ifdef CONFIG_64BIT
#define SECTION_ALIGN (1 << 21)
#else
#define SECTION_ALIGN (1 << 22)
#endif
2021-09-23 16:59:15 +00:00
#else /* !CONFIG_ARCH_HAS_STRICT_KERNEL_RWX */
2021-05-26 19:09:36 +00:00
#define SECTION_ALIGN L1_CACHE_BYTES
2021-09-23 16:59:15 +00:00
#endif /* CONFIG_ARCH_HAS_STRICT_KERNEL_RWX */
2021-05-26 19:09:36 +00:00
#endif /* _ASM_RISCV_SET_MEMORY_H */