registers.hh revision 6313
1955SN/A/*
2955SN/A * Copyright (c) 2007 The Hewlett-Packard Development Company
35871Snate@binkert.org * All rights reserved.
41762SN/A *
5955SN/A * Redistribution and use of this software in source and binary forms,
6955SN/A * with or without modification, are permitted provided that the
7955SN/A * following conditions are met:
8955SN/A *
9955SN/A * The software must be used only for Non-Commercial Use which means any
10955SN/A * use which is NOT directed to receiving any direct monetary
11955SN/A * compensation for, or commercial advantage from such use.  Illustrative
12955SN/A * examples of non-commercial use are academic research, personal study,
13955SN/A * teaching, education and corporate research & development.
14955SN/A * Illustrative examples of commercial use are distributing products for
15955SN/A * commercial advantage and providing services using the software for
16955SN/A * commercial advantage.
17955SN/A *
18955SN/A * If you wish to use this software or functionality therein that may be
19955SN/A * covered by patents for commercial use, please contact:
20955SN/A *     Director of Intellectual Property Licensing
21955SN/A *     Office of Strategy and Technology
22955SN/A *     Hewlett-Packard Company
23955SN/A *     1501 Page Mill Road
24955SN/A *     Palo Alto, California  94304
25955SN/A *
26955SN/A * Redistributions of source code must retain the above copyright notice,
27955SN/A * this list of conditions and the following disclaimer.  Redistributions
28955SN/A * in binary form must reproduce the above copyright notice, this list of
292665Ssaidi@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or
302665Ssaidi@eecs.umich.edu * other materials provided with the distribution.  Neither the name of
315863Snate@binkert.org * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
32955SN/A * contributors may be used to endorse or promote products derived from
33955SN/A * this software without specific prior written permission.  No right of
34955SN/A * sublicense is granted herewith.  Derivatives of the software and
35955SN/A * output created using the software may be prepared, but only for
36955SN/A * Non-Commercial Uses.  Derivatives of the software may be shared with
372632Sstever@eecs.umich.edu * others provided: (i) the others agree to abide by the list of
382632Sstever@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions;
392632Sstever@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright
402632Sstever@eecs.umich.edu * notice to acknowledge the contribution from this software where
41955SN/A * applicable, this list of conditions and the disclaimer below.
422632Sstever@eecs.umich.edu *
432632Sstever@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
442761Sstever@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
452632Sstever@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
462632Sstever@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
472632Sstever@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
482761Sstever@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
492761Sstever@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
502761Sstever@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
512632Sstever@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
522632Sstever@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
532761Sstever@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
542761Sstever@eecs.umich.edu *
552761Sstever@eecs.umich.edu * Authors: Gabe Black
562761Sstever@eecs.umich.edu */
572761Sstever@eecs.umich.edu
582632Sstever@eecs.umich.edu#ifndef __ARCH_X86_REGFILE_HH__
592632Sstever@eecs.umich.edu#define __ARCH_X86_REGFILE_HH__
602632Sstever@eecs.umich.edu
612632Sstever@eecs.umich.edu#include <string>
622632Sstever@eecs.umich.edu
632632Sstever@eecs.umich.edu#include "arch/x86/floatregfile.hh"
642632Sstever@eecs.umich.edu#include "arch/x86/intregfile.hh"
65955SN/A#include "arch/x86/miscregs.hh"
66955SN/A#include "arch/x86/isa_traits.hh"
67955SN/A#include "arch/x86/types.hh"
685863Snate@binkert.org#include "base/types.hh"
695863Snate@binkert.org
705863Snate@binkert.orgclass Checkpoint;
715863Snate@binkert.orgclass EventManager;
725863Snate@binkert.org
735863Snate@binkert.orgnamespace X86ISA
745863Snate@binkert.org{
755863Snate@binkert.org    const int NumMiscArchRegs = NUM_MISCREGS;
765863Snate@binkert.org    const int NumMiscRegs = NUM_MISCREGS;
775863Snate@binkert.org
785863Snate@binkert.org    class RegFile
795863Snate@binkert.org    {
805863Snate@binkert.org      protected:
815863Snate@binkert.org        Addr rip; //Program Counter
825863Snate@binkert.org        Addr nextRip; //Next Program Counter
835863Snate@binkert.org
845863Snate@binkert.org      public:
855863Snate@binkert.org        Addr readPC();
865863Snate@binkert.org        void setPC(Addr val);
875863Snate@binkert.org
885863Snate@binkert.org        Addr readNextPC();
895863Snate@binkert.org        void setNextPC(Addr val);
905863Snate@binkert.org
915863Snate@binkert.org        Addr readNextNPC();
925863Snate@binkert.org        void setNextNPC(Addr val);
935863Snate@binkert.org
945863Snate@binkert.org      protected:
955863Snate@binkert.org        IntRegFile intRegFile; // integer register file
965863Snate@binkert.org        FloatRegFile floatRegFile; // floating point register file
975863Snate@binkert.org
985863Snate@binkert.org      public:
996654Snate@binkert.org
100955SN/A        void clear();
1015396Ssaidi@eecs.umich.edu
1025863Snate@binkert.org        FloatReg readFloatReg(int floatReg, int width);
1035863Snate@binkert.org
1044202Sbinkertn@umich.edu        FloatReg readFloatReg(int floatReg);
1055863Snate@binkert.org
1065863Snate@binkert.org        FloatRegBits readFloatRegBits(int floatReg, int width);
1075863Snate@binkert.org
1085863Snate@binkert.org        FloatRegBits readFloatRegBits(int floatReg);
109955SN/A
1106654Snate@binkert.org        void setFloatReg(int floatReg, const FloatReg &val, int width);
1115273Sstever@gmail.com
1125871Snate@binkert.org        void setFloatReg(int floatReg, const FloatReg &val);
1135273Sstever@gmail.com
1146655Snate@binkert.org        void setFloatRegBits(int floatReg, const FloatRegBits &val, int width);
1156655Snate@binkert.org
1166655Snate@binkert.org        void setFloatRegBits(int floatReg, const FloatRegBits &val);
1176655Snate@binkert.org
1186655Snate@binkert.org        IntReg readIntReg(int intReg);
1196655Snate@binkert.org
1205871Snate@binkert.org        void setIntReg(int intReg, const IntReg &val);
1216654Snate@binkert.org
1225396Ssaidi@eecs.umich.edu        void serialize(EventManager *em, std::ostream &os);
1235871Snate@binkert.org        void unserialize(EventManager *em, Checkpoint *cp,
1245871Snate@binkert.org            const std::string &section);
1256121Snate@binkert.org    };
1265871Snate@binkert.org
1275871Snate@binkert.org    void copyRegs(ThreadContext *src, ThreadContext *dest);
1286003Snate@binkert.org
1296655Snate@binkert.org    void copyMiscRegs(ThreadContext *src, ThreadContext *dest);
130955SN/A
1315871Snate@binkert.org    int InterruptLevel(uint64_t softint);
1325871Snate@binkert.org
1335871Snate@binkert.org}; // namespace X86ISA
1345871Snate@binkert.org
135955SN/A#endif // __ARCH_X86_REGFILE_HH__
1366121Snate@binkert.org