Memory mapping is one of the most important features to protect the memory system in Linux. Linux provides several functions to map a physical address into a virtual address. 1. mmap # Linux/fs/sysfs/bin.c:337 static int mmap(struct file* file, struct vm_area_struct* vma) {...} mmap() maps the file to a virtual memory. And this can be used with the special file /dev/mem (system memory) or /dev/kmem (kernel memory). 2. vm_insert_pfn # This function is called by sgx_enclave_add_page().