112294Sgabeblack@google.com/* 212294Sgabeblack@google.com * Copyright (c) 2006-2007 The Regents of The University of Michigan 312294Sgabeblack@google.com * All rights reserved. 412294Sgabeblack@google.com * 512294Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 612294Sgabeblack@google.com * modification, are permitted provided that the following conditions are 712294Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 812294Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 912294Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1012294Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1112294Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1212294Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1312294Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1412294Sgabeblack@google.com * this software without specific prior written permission. 1512294Sgabeblack@google.com * 1612294Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712294Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812294Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912294Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012294Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112294Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212294Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312294Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412294Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512294Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612294Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712294Sgabeblack@google.com * 2812294Sgabeblack@google.com * Authors: Ali Saidi 2912294Sgabeblack@google.com * Gabe Black 3012294Sgabeblack@google.com * Steve Reinhardt 3112294Sgabeblack@google.com */ 3212294Sgabeblack@google.com 3312294Sgabeblack@google.com#ifndef __ARCH_SPARC_INSTS_MEM_HH__ 3412294Sgabeblack@google.com#define __ARCH_SPARC_INSTS_MEM_HH__ 3512294Sgabeblack@google.com 3612294Sgabeblack@google.com#include "arch/sparc/insts/static_inst.hh" 3712294Sgabeblack@google.com 3812294Sgabeblack@google.comnamespace SparcISA 3912294Sgabeblack@google.com{ 4012294Sgabeblack@google.com 4112294Sgabeblack@google.com//////////////////////////////////////////////////////////////////// 4212294Sgabeblack@google.com// 4312294Sgabeblack@google.com// Mem utility templates and functions 4412294Sgabeblack@google.com// 4512294Sgabeblack@google.com 4612294Sgabeblack@google.com/** 4712294Sgabeblack@google.com * Base class for memory operations. 4812294Sgabeblack@google.com */ 4912294Sgabeblack@google.comclass Mem : public SparcStaticInst 5012294Sgabeblack@google.com{ 5112294Sgabeblack@google.com protected: 5212294Sgabeblack@google.com using SparcStaticInst::SparcStaticInst; 5312294Sgabeblack@google.com 5412294Sgabeblack@google.com std::string generateDisassembly( 5512294Sgabeblack@google.com Addr pc, const SymbolTable *symtab) const override; 5612294Sgabeblack@google.com}; 5712294Sgabeblack@google.com 5812294Sgabeblack@google.com/** 5912294Sgabeblack@google.com * Class for memory operations which use an immediate offset. 6012294Sgabeblack@google.com */ 6112294Sgabeblack@google.comclass MemImm : public Mem 6212294Sgabeblack@google.com{ 6312294Sgabeblack@google.com protected: 6412294Sgabeblack@google.com 6512294Sgabeblack@google.com // Constructor 6612294Sgabeblack@google.com MemImm(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 6712294Sgabeblack@google.com Mem(mnem, _machInst, __opClass), imm(sext<13>(bits(_machInst, 12, 0))) 6812294Sgabeblack@google.com {} 6912294Sgabeblack@google.com 7012294Sgabeblack@google.com std::string generateDisassembly( 7112294Sgabeblack@google.com Addr pc, const SymbolTable *symtab) const override; 7212294Sgabeblack@google.com 7312294Sgabeblack@google.com const int32_t imm; 7412294Sgabeblack@google.com}; 7512294Sgabeblack@google.com 7612294Sgabeblack@google.com} 7712294Sgabeblack@google.com 7812294Sgabeblack@google.com#endif // __ARCH_SPARC_INSTS_MEM_HH__ 79