cpuid.hh revision 5659
14166Sgblack@eecs.umich.edu/* 24166Sgblack@eecs.umich.edu * Copyright (c) 2008 The Regents of The University of Michigan 34166Sgblack@eecs.umich.edu * All rights reserved. 44166Sgblack@eecs.umich.edu * 54166Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64166Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 74166Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84166Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94166Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104166Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114166Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124166Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134166Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144166Sgblack@eecs.umich.edu * this software without specific prior written permission. 154166Sgblack@eecs.umich.edu * 164166Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174166Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184166Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194166Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204166Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214166Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224166Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234166Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244166Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254166Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264166Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274166Sgblack@eecs.umich.edu * 284166Sgblack@eecs.umich.edu * Authors: Gabe Black 294166Sgblack@eecs.umich.edu */ 304166Sgblack@eecs.umich.edu 314166Sgblack@eecs.umich.edu#ifndef __ARCH_X86_CPUID_HH__ 324166Sgblack@eecs.umich.edu#define __ARCH_X86_CPUID_HH__ 334166Sgblack@eecs.umich.edu 344166Sgblack@eecs.umich.edu#include <inttypes.h> 354166Sgblack@eecs.umich.edu 364166Sgblack@eecs.umich.educlass ThreadContext; 374166Sgblack@eecs.umich.edu 384166Sgblack@eecs.umich.edunamespace X86ISA 394166Sgblack@eecs.umich.edu{ 404166Sgblack@eecs.umich.edu struct CpuidResult 414166Sgblack@eecs.umich.edu { 424166Sgblack@eecs.umich.edu uint64_t rax; 434166Sgblack@eecs.umich.edu uint64_t rbx; 444166Sgblack@eecs.umich.edu uint64_t rcx; 454166Sgblack@eecs.umich.edu uint64_t rdx; 464166Sgblack@eecs.umich.edu 474166Sgblack@eecs.umich.edu // These are not in alphebetical order on purpose. The order reflects 484166Sgblack@eecs.umich.edu // how the CPUID orders the registers when it returns results. 494166Sgblack@eecs.umich.edu CpuidResult(uint64_t _rax, uint64_t _rbx, 504166Sgblack@eecs.umich.edu uint64_t _rdx, uint64_t _rcx) : 514166Sgblack@eecs.umich.edu rax(_rax), rbx(_rbx), rcx(_rcx), rdx(_rdx) 524166Sgblack@eecs.umich.edu {} 534166Sgblack@eecs.umich.edu 544166Sgblack@eecs.umich.edu CpuidResult() 554166Sgblack@eecs.umich.edu {} 564166Sgblack@eecs.umich.edu }; 574166Sgblack@eecs.umich.edu 584166Sgblack@eecs.umich.edu bool doCpuid(ThreadContext * tc, uint32_t function, CpuidResult &result); 594166Sgblack@eecs.umich.edu} // namespace X86ISA 604166Sgblack@eecs.umich.edu 614166Sgblack@eecs.umich.edu#endif 624166Sgblack@eecs.umich.edu