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 */ 3112294Sgabeblack@google.com 3212294Sgabeblack@google.com#include "arch/sparc/insts/blockmem.hh" 3312294Sgabeblack@google.com 3412294Sgabeblack@google.comnamespace SparcISA 3512294Sgabeblack@google.com{ 3612294Sgabeblack@google.com 3712294Sgabeblack@google.comstd::string 3812294Sgabeblack@google.comBlockMemMicro::generateDisassembly(Addr pc, const SymbolTable *symtab) const 3912294Sgabeblack@google.com{ 4012294Sgabeblack@google.com std::stringstream response; 4112294Sgabeblack@google.com bool load = flags[IsLoad]; 4212294Sgabeblack@google.com bool save = flags[IsStore]; 4312294Sgabeblack@google.com 4412294Sgabeblack@google.com printMnemonic(response, mnemonic); 4512294Sgabeblack@google.com if (save) { 4612294Sgabeblack@google.com printReg(response, _srcRegIdx[0]); 4712294Sgabeblack@google.com ccprintf(response, ", "); 4812294Sgabeblack@google.com } 4912294Sgabeblack@google.com ccprintf(response, "[ "); 5012294Sgabeblack@google.com printReg(response, _srcRegIdx[!save ? 0 : 1]); 5112294Sgabeblack@google.com ccprintf(response, " + "); 5212294Sgabeblack@google.com printReg(response, _srcRegIdx[!save ? 1 : 2]); 5312294Sgabeblack@google.com ccprintf(response, " ]"); 5412294Sgabeblack@google.com if (load) { 5512294Sgabeblack@google.com ccprintf(response, ", "); 5612294Sgabeblack@google.com printReg(response, _destRegIdx[0]); 5712294Sgabeblack@google.com } 5812294Sgabeblack@google.com 5912294Sgabeblack@google.com return response.str(); 6012294Sgabeblack@google.com} 6112294Sgabeblack@google.com 6212294Sgabeblack@google.comstd::string 6312294Sgabeblack@google.comBlockMemImmMicro::generateDisassembly(Addr pc, const SymbolTable *symtab) const 6412294Sgabeblack@google.com{ 6512294Sgabeblack@google.com std::stringstream response; 6612294Sgabeblack@google.com bool load = flags[IsLoad]; 6712294Sgabeblack@google.com bool save = flags[IsStore]; 6812294Sgabeblack@google.com 6912294Sgabeblack@google.com printMnemonic(response, mnemonic); 7012294Sgabeblack@google.com if (save) { 7112294Sgabeblack@google.com printReg(response, _srcRegIdx[1]); 7212294Sgabeblack@google.com ccprintf(response, ", "); 7312294Sgabeblack@google.com } 7412294Sgabeblack@google.com ccprintf(response, "[ "); 7512294Sgabeblack@google.com printReg(response, _srcRegIdx[0]); 7612294Sgabeblack@google.com if (imm >= 0) 7712294Sgabeblack@google.com ccprintf(response, " + 0x%x ]", imm); 7812294Sgabeblack@google.com else 7912294Sgabeblack@google.com ccprintf(response, " + -0x%x ]", -imm); 8012294Sgabeblack@google.com if (load) { 8112294Sgabeblack@google.com ccprintf(response, ", "); 8212294Sgabeblack@google.com printReg(response, _destRegIdx[0]); 8312294Sgabeblack@google.com } 8412294Sgabeblack@google.com 8512294Sgabeblack@google.com return response.str(); 8612294Sgabeblack@google.com} 8712294Sgabeblack@google.com 8812294Sgabeblack@google.com} 89