6 #define SEL_RPL(selector) ((selector)&0x3)
8 typedef unsigned int reg32;
9 typedef unsigned short reg16;
21 } __attribute__((packed)) gp_regs;
29 } __attribute__((packed)) sg_reg;
32 cpu_get_brand(char* brand_out);
37 #pragma GCC diagnostic push
38 #pragma GCC diagnostic ignored "-Wreturn-type"
43 asm volatile("movl %%cr0,%0" : "=r"(val));
51 asm volatile("movl %%cr2,%0" : "=r"(val));
59 asm volatile("movl %%cr3,%0" : "=r"(val));
67 asm volatile("pushf\n"
72 #pragma GCC diagnostic pop
77 asm("mov %0, %%cr0" ::"r"(v));
83 asm("mov %0, %%cr2" ::"r"(v));
89 asm("mov %0, %%cr3" ::"r"(v));
95 asm volatile("invlpg (%0)" ::"r"((uintptr_t)va) : "memory");
99 cpu_enable_interrupt()
105 cpu_disable_interrupt()
114 asm("movl %%cr3, %0\n"
121 cpu_rdmsr(uint32_t msr_idx, uint32_t* reg_high, uint32_t* reg_low);
124 cpu_wrmsr(uint32_t msr_idx, uint32_t reg_high, uint32_t reg_low);