#ifndef CPU_H #define CPU_H #include "hos_types.h" static u32_t read_cr0() { u32_t val; __asm__ __volatile__ ("movl %%cr0, %0" : "=r" (val)); return val; } static u32_t read_cr2() { u32_t val; __asm__ __volatile__ ("movl %%cr2, %0" : "=r" (val)); return val; } static u32_t read_cr3() { u32_t val; __asm__ __volatile__ ("movl %%cr3, %0" : "=r" (val)); return val; } #define set_cr0(val) \ __asm__ __volatile__ ("movl %0, %%cr0" : : "r" (val)); #define set_cr3(val) \ __asm__ __volatile__ ("movl %0, %%cr3" : : "r" (val)); #endif