Skip to content

Instantly share code, notes, and snippets.

@yuriks
Created April 30, 2017 20:06
Show Gist options
  • Save yuriks/0541b18ed09abf9dbe0732301e34d5d8 to your computer and use it in GitHub Desktop.
Save yuriks/0541b18ed09abf9dbe0732301e34d5d8 to your computer and use it in GitHub Desktop.
void MapSharedPages(VMManager& address_space) {
auto cfg_mem_vma = address_space
.MapBackingMemory(Memory::CONFIG_MEMORY_VADDR,
reinterpret_cast<u8*>(&ConfigMem::config_mem),
Memory::CONFIG_MEMORY_SIZE, MemoryState::Shared)
.MoveFrom();
address_space.Reprotect(cfg_mem_vma, VMAPermission::Read);
auto shared_page_vma = address_space
.MapBackingMemory(Memory::SHARED_PAGE_VADDR,
reinterpret_cast<u8*>(&SharedPage::shared_page),
Memory::SHARED_PAGE_SIZE, MemoryState::Shared)
.MoveFrom();
address_space.Reprotect(shared_page_vma, VMAPermission::Read);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment