15659Sgblack@eecs.umich.edu/*
25659Sgblack@eecs.umich.edu * Copyright (c) 2008 The Regents of The University of Michigan
35659Sgblack@eecs.umich.edu * All rights reserved.
45659Sgblack@eecs.umich.edu *
55659Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
65659Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
75659Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
85659Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
95659Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
105659Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
115659Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
125659Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
135659Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
145659Sgblack@eecs.umich.edu * this software without specific prior written permission.
155659Sgblack@eecs.umich.edu *
165659Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
175659Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
185659Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
195659Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
205659Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
215659Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
225659Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
235659Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245659Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
255659Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265659Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
275659Sgblack@eecs.umich.edu *
285659Sgblack@eecs.umich.edu * Authors: Gabe Black
295659Sgblack@eecs.umich.edu */
305659Sgblack@eecs.umich.edu
315659Sgblack@eecs.umich.edu#ifndef __ARCH_X86_CPUID_HH__
325659Sgblack@eecs.umich.edu#define __ARCH_X86_CPUID_HH__
335659Sgblack@eecs.umich.edu
346215Snate@binkert.org#include "base/types.hh"
355659Sgblack@eecs.umich.edu
365659Sgblack@eecs.umich.educlass ThreadContext;
375659Sgblack@eecs.umich.edu
385659Sgblack@eecs.umich.edunamespace X86ISA
395659Sgblack@eecs.umich.edu{
405659Sgblack@eecs.umich.edu    struct CpuidResult
415659Sgblack@eecs.umich.edu    {
425659Sgblack@eecs.umich.edu        uint64_t rax;
435659Sgblack@eecs.umich.edu        uint64_t rbx;
445659Sgblack@eecs.umich.edu        uint64_t rcx;
455659Sgblack@eecs.umich.edu        uint64_t rdx;
465659Sgblack@eecs.umich.edu
475659Sgblack@eecs.umich.edu        // These are not in alphebetical order on purpose. The order reflects
485659Sgblack@eecs.umich.edu        // how the CPUID orders the registers when it returns results.
495659Sgblack@eecs.umich.edu        CpuidResult(uint64_t _rax, uint64_t _rbx,
505659Sgblack@eecs.umich.edu                    uint64_t _rdx, uint64_t _rcx) :
515659Sgblack@eecs.umich.edu            rax(_rax), rbx(_rbx), rcx(_rcx), rdx(_rdx)
525659Sgblack@eecs.umich.edu        {}
535659Sgblack@eecs.umich.edu
545659Sgblack@eecs.umich.edu        CpuidResult()
555659Sgblack@eecs.umich.edu        {}
565659Sgblack@eecs.umich.edu    };
575659Sgblack@eecs.umich.edu
589554Sandreas.hansson@arm.com    uint64_t stringToRegister(const char *str);
599554Sandreas.hansson@arm.com
607072Sgblack@eecs.umich.edu    bool doCpuid(ThreadContext * tc, uint32_t function,
617072Sgblack@eecs.umich.edu            uint32_t index, CpuidResult &result);
625659Sgblack@eecs.umich.edu} // namespace X86ISA
635659Sgblack@eecs.umich.edu
645659Sgblack@eecs.umich.edu#endif
65