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>
This commit is contained in:
Andrew Boie 2019-07-29 18:20:35 -07:00 committed by Carles Cufí
commit fcd2c14500

View file

@ -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_ */