x86: MMU: Configure page tables entries for memory domain in swap.

During swap the required page tables are configured. The outgoing
thread's memory domain pages are reset and the incoming thread's
memory domain is loaded. The pages are configured if userspace
is enabled and if memory domain has been initialized before
calling swap.

GH-3852

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2017-10-09 11:22:41 +05:30 committed by Andrew Boie
parent f7b0731ce4
commit 538fa7b37c

View file

@ -164,9 +164,18 @@ void _x86_swap_update_page_tables(struct k_thread *incoming,
*/
_main_tss.esp0 = incoming->stack_info.start;
/* TODO: if either thread defines different memory domains, efficiently
/* If either thread defines different memory domains, efficiently
* switch between them
*/
if (incoming->mem_domain_info.mem_domain !=
outgoing->mem_domain_info.mem_domain){
/* Ensure that the outgoing mem domain configuration
* is set back to default state.
*/
_arch_mem_domain_destroy(outgoing->mem_domain_info.mem_domain);
_x86_mmu_mem_domain_load(incoming);
}
}