Skip to content
Permalink
Browse files

x86: add functions to get/set page tables

Wrapper to assembly code working with CR3 register.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie authored and carlescufi committed Jul 30, 2019
1 parent ea201b2 commit fcd2c1450007f511f26b360d700d9188d11b9d4b
Showing with 13 additions and 0 deletions.
  1. +13 −0 arch/x86/include/ia32/mmustructs.h
@@ -526,6 +526,19 @@ struct x86_mmu_pt {
*/
void z_x86_dump_page_tables(struct x86_mmu_pdpt *pdpt);

static inline void z_x86_page_tables_set(struct x86_mmu_pdpt *pdpt)
{
__asm__ volatile("movl %0, %%cr3\n\t" : : "r" (pdpt));
}

static inline struct x86_mmu_pdpt *z_x86_page_tables_get(void)
{
struct x86_mmu_pdpt *ret;

__asm__ volatile("movl %%cr3, %0\n\t" : "=r" (ret));

return ret;
}
#endif /* _ASMLANGUAGE */

#endif /* ZEPHYR_ARCH_X86_INCLUDE_IA32_MMUSTRUCTS_H_ */

0 comments on commit fcd2c14

Please sign in to comment.
You can’t perform that action at this time.