15 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
23 cpuid(leaf, &eax, &tmp, &tmp, &tmp);
32 cpuid(leaf, &tmp, &ebx, &tmp, &tmp);
41 cpuid(leaf, &tmp, &tmp, &ecx, &tmp);
50 cpuid(leaf, &tmp, &tmp, &tmp, &edx);
60 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
69 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
70 :
"0" (leaf),
"2" (subleaf));
78 :
"=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
79 :
"0" (leaf),
"2" (subleaf));
86 asm volatile(
"inb %w1, %b0":
"=a" (val):
"Nd" (port));
95 asm volatile(
"inw %w1, %w0":
"=a" (val):
"Nd" (port));
104 asm volatile(
"inl %w1, %k0":
"=a" (val):
"Nd" (port));
111 asm volatile(
"outb %b0, %w1": :
"a" (val),
"Nd" (port));
116 asm volatile(
"outw %w0, %w1": :
"a" (val),
"Nd" (port));
121 asm volatile(
"outl %k0, %w1": :
"a" (val),
"Nd" (port));
128 asm volatile (
"mov %%cs, %0" :
"=rm" (cs));
137 asm volatile (
"mov %%ds, %0" :
"=rm" (ds));
146 asm volatile (
"mov %%es, %0" :
"=rm" (es));
155 asm volatile (
"mov %%fs, %0" :
"=rm" (fs));
164 asm volatile (
"mov %%gs, %0" :
"=rm" (gs));
173 asm volatile (
"mov %%ss, %0" :
"=rm" (ss));
180 asm volatile (
"push %0;"
188 asm volatile (
"mov %0, %%ds" ::
"rm" (ds));
193 asm volatile (
"mov %0, %%es" ::
"rm" (es));
198 asm volatile (
"mov %0, %%fs" ::
"rm" (fs));
203 asm volatile (
"mov %0, %%gs" ::
"rm" (gs));
208 asm volatile (
"mov %0, %%ss" ::
"rm" (ss));
215 asm volatile (
"pushf; pop %0" :
"=rm" (flags));
222 asm volatile (
"push %0; popf" ::
"rme" (flags));
229 asm volatile (
"mov %%cr0, %0" :
"=r" (cr0));
238 asm volatile (
"mov %%cr2, %0" :
"=r" (cr2));
247 asm volatile (
"mov %%cr3, %0" :
"=r" (cr3));
256 asm volatile (
"mov %%cr4, %0" :
"=r" (cr4));
265 asm volatile (
"mov %%cr8, %0" :
"=r" (cr8));
272 asm volatile (
"mov %0, %%cr0" ::
"r" (cr0));
277 asm volatile (
"mov %0, %%cr2" ::
"r" (cr2));
282 asm volatile (
"mov %0, %%cr3" ::
"r" (cr3));
287 asm volatile (
"mov %0, %%cr4" ::
"r" (cr4));
294 asm volatile (
"1: mov %[cr4], %%cr4; 2:"
305 asm volatile (
"mov %0, %%cr8" ::
"r" (cr8));
312 asm volatile (
"stmxcsr %0" :
"=m" (mxcsr));
319 asm volatile (
"ldmxcsr %0" ::
"m" (mxcsr));
324 asm volatile (
"invlpg (%0)" ::
"r" (va));
327static inline void lgdt(
const desc_ptr *gdtr)
329 asm volatile (
"lgdt %0" ::
"m" (*gdtr));
332static inline void lidt(
const desc_ptr *idtr)
334 asm volatile (
"lidt %0" ::
"m" (*idtr));
337static inline void lldt(
unsigned int sel)
339 asm volatile (
"lldt %w0" ::
"rm" (sel));
342static inline void ltr(
unsigned int sel)
344 asm volatile (
"ltr %w0" ::
"rm" (sel));
347static inline void sgdt(desc_ptr *gdtr)
349 asm volatile (
"sgdt %0" :
"=m" (*gdtr));
352static inline void sidt(desc_ptr *idtr)
354 asm volatile (
"sidt %0" :
"=m" (*idtr));
357static inline unsigned int sldt(
void)
361 asm volatile (
"sldt %0" :
"=r" (sel));
366static inline unsigned int str(
void)
370 asm volatile (
"str %0" :
"=r" (sel));
379 asm volatile (
"xgetbv" :
"=a" (feat_lo),
"=d" (feat_hi)
382 return feat_lo | ((
uint64_t)feat_hi << 32);
387 asm volatile (
"xsetbv" ::
"a" ((
uint32_t)value),
404 asm volatile (
"clflush %0" ::
"m" (*(
const char *)ptr));
#define _ASM_XEN_FEP
Xen Forced Emulation Prefix.
bool ex_record_fault_edi(struct cpu_regs *regs, const struct extable_entry *ex)
Record the current fault in %edi.
static uint32_t read_mxcsr(void)
static void write_xcr0(uint64_t xcr0)
static uint8_t inb(uint16_t port)
static void write_cs(unsigned long cs)
static void write_mxcsr(uint32_t mxcsr)
static void write_ss(unsigned int ss)
static uint32_t cpuid_ebx(uint32_t leaf)
static void write_ds(unsigned int ds)
static void write_cr3(unsigned long cr3)
static void lidt(const desc_ptr *idtr)
static uint32_t cpuid_ecx(uint32_t leaf)
static void invlpg(const void *va)
static unsigned long read_cr3(void)
static void flush_tlb(void)
static unsigned int read_cs(void)
static uint32_t cpuid_eax(uint32_t leaf)
static unsigned long read_cr4(void)
static void write_fs(unsigned int fs)
static unsigned long read_cr2(void)
static void write_cr2(unsigned long cr2)
static void outb(uint8_t val, uint16_t port)
static void write_cr8(unsigned long cr8)
static unsigned int sldt(void)
static unsigned long read_flags(void)
static bool write_cr4_safe(unsigned long cr4)
static void write_cr0(unsigned long cr0)
static void cpuid_count(uint32_t leaf, uint32_t subleaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
static void clflush(const void *ptr)
static unsigned long read_cr8(void)
static void sgdt(desc_ptr *gdtr)
static uint32_t inl(uint16_t port)
static void sidt(desc_ptr *idtr)
static void pv_cpuid_count(uint32_t leaf, uint32_t subleaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
static void lldt(unsigned int sel)
static unsigned int str(void)
static unsigned int read_es(void)
static unsigned int read_ds(void)
static uint16_t inw(uint16_t port)
static void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
static void write_cr4(unsigned long cr4)
static unsigned int read_fs(void)
static void ltr(unsigned int sel)
static unsigned long read_cr0(void)
static void write_flags(unsigned long flags)
static void outw(uint16_t val, uint16_t port)
static uint32_t cpuid_edx(uint32_t leaf)
static void pv_cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
static void lgdt(const desc_ptr *gdtr)
static void xsetbv(uint32_t index, uint64_t value)
static unsigned int read_ss(void)
static uint64_t read_xcr0(void)
static void write_es(unsigned int es)
static void write_gs(unsigned int gs)
static uint64_t xgetbv(uint32_t index)
static void outl(uint32_t val, uint16_t port)
static unsigned int read_gs(void)
x86 segment descriptor infrastructure.
unsigned int exinfo_t
Packed exception and error code information.
#define _ASM_EXTABLE_HANDLER(fault, fixup, handler)
Create an exception table entry with custom handler.
Model Specific Register mnemonics and bit definitions.
Common declarations for all tests.