mem.cc revision 7279
17118Sgblack@eecs.umich.edu/* 27118Sgblack@eecs.umich.edu * Copyright (c) 2010 ARM Limited 37118Sgblack@eecs.umich.edu * All rights reserved 47118Sgblack@eecs.umich.edu * 57118Sgblack@eecs.umich.edu * The license below extends only to copyright in the software and shall 67118Sgblack@eecs.umich.edu * not be construed as granting a license to any other intellectual 77118Sgblack@eecs.umich.edu * property including but not limited to intellectual property relating 87118Sgblack@eecs.umich.edu * to a hardware implementation of the functionality of the software 97118Sgblack@eecs.umich.edu * licensed hereunder. You may use the software subject to the license 107118Sgblack@eecs.umich.edu * terms below provided that you ensure that this notice is replicated 117118Sgblack@eecs.umich.edu * unmodified and in its entirety in all distributions of the software, 127118Sgblack@eecs.umich.edu * modified or unmodified, in source code or in binary form. 137118Sgblack@eecs.umich.edu * 147118Sgblack@eecs.umich.edu * Copyright (c) 2007-2008 The Florida State University 156253Sgblack@eecs.umich.edu * All rights reserved. 166253Sgblack@eecs.umich.edu * 176253Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 186253Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 196253Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 206253Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 216253Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 226253Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 236253Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 246253Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 256253Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 266253Sgblack@eecs.umich.edu * this software without specific prior written permission. 276253Sgblack@eecs.umich.edu * 286253Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 296253Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 306253Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 316253Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 326253Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 336253Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 346253Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 356253Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 366253Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 376253Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 386253Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 396253Sgblack@eecs.umich.edu * 406253Sgblack@eecs.umich.edu * Authors: Stephen Hines 416253Sgblack@eecs.umich.edu */ 426253Sgblack@eecs.umich.edu 436253Sgblack@eecs.umich.edu#include "arch/arm/insts/mem.hh" 446253Sgblack@eecs.umich.edu#include "base/loader/symtab.hh" 456253Sgblack@eecs.umich.edu 467205Sgblack@eecs.umich.eduusing namespace std; 477205Sgblack@eecs.umich.edu 486253Sgblack@eecs.umich.edunamespace ArmISA 496253Sgblack@eecs.umich.edu{ 507118Sgblack@eecs.umich.edu 517205Sgblack@eecs.umich.edustring 527205Sgblack@eecs.umich.eduSwap::generateDisassembly(Addr pc, const SymbolTable *symtab) const 537205Sgblack@eecs.umich.edu{ 547205Sgblack@eecs.umich.edu stringstream ss; 557205Sgblack@eecs.umich.edu printMnemonic(ss); 567205Sgblack@eecs.umich.edu printReg(ss, dest); 577205Sgblack@eecs.umich.edu ss << ", "; 587205Sgblack@eecs.umich.edu printReg(ss, op1); 597205Sgblack@eecs.umich.edu ss << ", ["; 607205Sgblack@eecs.umich.edu printReg(ss, base); 617205Sgblack@eecs.umich.edu ss << "]"; 627205Sgblack@eecs.umich.edu return ss.str(); 637205Sgblack@eecs.umich.edu} 647205Sgblack@eecs.umich.edu 657118Sgblack@eecs.umich.eduvoid 667132Sgblack@eecs.umich.eduMemory::printInst(std::ostream &os, AddrMode addrMode) const 677118Sgblack@eecs.umich.edu{ 687118Sgblack@eecs.umich.edu printMnemonic(os); 697279Sgblack@eecs.umich.edu printDest(os); 707118Sgblack@eecs.umich.edu os << ", ["; 717118Sgblack@eecs.umich.edu printReg(os, base); 727118Sgblack@eecs.umich.edu if (addrMode != AddrMd_PostIndex) { 737118Sgblack@eecs.umich.edu os << ", "; 747118Sgblack@eecs.umich.edu printOffset(os); 757118Sgblack@eecs.umich.edu os << "]"; 767118Sgblack@eecs.umich.edu if (addrMode == AddrMd_PreIndex) { 777118Sgblack@eecs.umich.edu os << "!"; 787118Sgblack@eecs.umich.edu } 797118Sgblack@eecs.umich.edu } else { 807118Sgblack@eecs.umich.edu os << "] "; 817118Sgblack@eecs.umich.edu printOffset(os); 827118Sgblack@eecs.umich.edu 837118Sgblack@eecs.umich.edu } 847118Sgblack@eecs.umich.edu} 857118Sgblack@eecs.umich.edu 866253Sgblack@eecs.umich.edu} 87