1/* 2 * Copyright 2014, Pawe�� Dziepak, pdziepak@quarnos.org. 3 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk. 4 * Distributed under the terms of the MIT License. 5 */ 6 7 8#include <arch_system_info.h> 9 10#include <cpuid.h> 11 12 13status_t 14get_current_cpuid(cpuid_info* info, uint32 eax, uint32 ecx) 15{ 16 __cpuid_count(eax, ecx, info->regs.eax, info->regs.ebx, info->regs.ecx, 17 info->regs.edx); 18 return B_OK; 19} 20 21 22uint32 23get_eflags() 24{ 25 uint64_t flags; 26 __asm__("pushf; popq %0;" : "=r" (flags)); 27 return flags; 28} 29 30 31void 32set_eflags(uint32 value) 33{ 34 uint64_t flags = value; 35 __asm__("pushq %0; popf;" : : "r" (flags) : "cc"); 36} 37 38