31 #ifndef CPU_X86_MM_PAGING_PROT_DOMAINS_H_
32 #define CPU_X86_MM_PAGING_PROT_DOMAINS_H_
40 #include "syscalls-int.h"
42 struct dom_kern_data {
59 uintptr_t orig_ret_addr;
67 #define PROT_DOMAINS_MMIO_LINEAR_BASE (MIN_PAGE_SIZE + (uintptr_t)&_ebss_kern_addr)
70 #define PROT_DOMAINS_MAX_MMIO_SZ 0x4000
73 #define PROT_DOMAINS_META_LINEAR_BASE \
74 (MIN_PAGE_SIZE + (PROT_DOMAINS_MMIO_LINEAR_BASE + PROT_DOMAINS_MAX_MMIO_SZ))
76 #define PROT_DOMAINS_META_OFF_TO_PHYS(off, meta_phys_base) \
77 ((meta_phys_base) + ((off) - PROT_DOMAINS_META_LINEAR_BASE))
80 #define PROT_DOMAINS_MMIO(dcd) PROT_DOMAINS_MMIO_LINEAR_BASE
84 #define PROT_DOMAINS_META(dcd) PROT_DOMAINS_META_LINEAR_BASE
86 #define PROT_DOMAINS_ENTER_ISR(exc) \
87 PROT_DOMAINS_ENTER_ISR_COMMON(exc)
88 #define PROT_DOMAINS_LEAVE_ISR(exc) PROT_DOMAINS_LEAVE_ISR_COMMON(exc)
91 #define CR0_PG BIT(31)
93 #define CR0_WP BIT(16)
105 static inline void prot_domains_set_wp(
bool en)
107 uint32_t cr0_val = CR0_PG | CR0_PE;
111 __asm__ __volatile__ (
"mov %0, %%cr0" ::
"r"(cr0_val));
#define __attribute__(nothing)
Define attribute to nothing since it isn't handled by IAR.