mem.cc revision 7205:e3dfcdf19561
12686Sksewell@umich.edu/*
22686Sksewell@umich.edu * Copyright (c) 2010 ARM Limited
35268Sksewell@umich.edu * All rights reserved
45268Sksewell@umich.edu *
55268Sksewell@umich.edu * The license below extends only to copyright in the software and shall
65268Sksewell@umich.edu * not be construed as granting a license to any other intellectual
75268Sksewell@umich.edu * property including but not limited to intellectual property relating
85268Sksewell@umich.edu * to a hardware implementation of the functionality of the software
95268Sksewell@umich.edu * licensed hereunder.  You may use the software subject to the license
105268Sksewell@umich.edu * terms below provided that you ensure that this notice is replicated
115268Sksewell@umich.edu * unmodified and in its entirety in all distributions of the software,
125268Sksewell@umich.edu * modified or unmodified, in source code or in binary form.
135268Sksewell@umich.edu *
145268Sksewell@umich.edu * Copyright (c) 2007-2008 The Florida State University
155268Sksewell@umich.edu * All rights reserved.
165268Sksewell@umich.edu *
175268Sksewell@umich.edu * Redistribution and use in source and binary forms, with or without
185268Sksewell@umich.edu * modification, are permitted provided that the following conditions are
195268Sksewell@umich.edu * met: redistributions of source code must retain the above copyright
205268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer;
215268Sksewell@umich.edu * redistributions in binary form must reproduce the above copyright
225268Sksewell@umich.edu * notice, this list of conditions and the following disclaimer in the
235268Sksewell@umich.edu * documentation and/or other materials provided with the distribution;
245268Sksewell@umich.edu * neither the name of the copyright holders nor the names of its
255268Sksewell@umich.edu * contributors may be used to endorse or promote products derived from
265268Sksewell@umich.edu * this software without specific prior written permission.
275268Sksewell@umich.edu *
285268Sksewell@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
295268Sksewell@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
305268Sksewell@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312706Sksewell@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322022SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332022SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342022SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352022SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362022SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372022SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382022SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392022SN/A *
402022SN/A * Authors: Stephen Hines
412028SN/A */
422022SN/A
432022SN/A#include "arch/arm/insts/mem.hh"
442022SN/A#include "base/loader/symtab.hh"
452022SN/A
462028SN/Ausing namespace std;
472022SN/A
482022SN/Anamespace ArmISA
492022SN/A{
502022SN/A
512022SN/Astring
525222Sksewell@umich.eduSwap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
535222Sksewell@umich.edu{
545222Sksewell@umich.edu    stringstream ss;
555222Sksewell@umich.edu    printMnemonic(ss);
565222Sksewell@umich.edu    printReg(ss, dest);
575222Sksewell@umich.edu    ss << ", ";
585222Sksewell@umich.edu    printReg(ss, op1);
595222Sksewell@umich.edu    ss << ", [";
605222Sksewell@umich.edu    printReg(ss, base);
615222Sksewell@umich.edu    ss << "]";
625222Sksewell@umich.edu    return ss.str();
635222Sksewell@umich.edu}
645222Sksewell@umich.edu
655222Sksewell@umich.eduvoid
665222Sksewell@umich.eduMemory::printInst(std::ostream &os, AddrMode addrMode) const
675222Sksewell@umich.edu{
685222Sksewell@umich.edu    printMnemonic(os);
692022SN/A    printReg(os, dest);
702022SN/A    os << ", [";
712022SN/A    printReg(os, base);
722022SN/A    if (addrMode != AddrMd_PostIndex) {
732022SN/A        os << ", ";
742686Sksewell@umich.edu        printOffset(os);
752022SN/A        os << "]";
765222Sksewell@umich.edu        if (addrMode == AddrMd_PreIndex) {
775222Sksewell@umich.edu            os << "!";
785222Sksewell@umich.edu        }
795222Sksewell@umich.edu    } else {
802022SN/A        os << "] ";
812022SN/A        printOffset(os);
822022SN/A
832686Sksewell@umich.edu    }
8412234Sgabeblack@google.com}
8512234Sgabeblack@google.com
862022SN/A}
872022SN/A