microldstop.cc revision 11793:ef606668d247
112SN/A/*
21762SN/A * Copyright (c) 2007 The Hewlett-Packard Development Company
312SN/A * Copyright (c) 2015 Advanced Micro Devices, Inc.
412SN/A * All rights reserved.
512SN/A *
612SN/A * The license below extends only to copyright in the software and shall
712SN/A * not be construed as granting a license to any other intellectual
812SN/A * property including but not limited to intellectual property relating
912SN/A * to a hardware implementation of the functionality of the software
1012SN/A * licensed hereunder.  You may use the software subject to the license
1112SN/A * terms below provided that you ensure that this notice is replicated
1212SN/A * unmodified and in its entirety in all distributions of the software,
1312SN/A * modified or unmodified, in source code or in binary form.
1412SN/A *
1512SN/A * Redistribution and use in source and binary forms, with or without
1612SN/A * modification, are permitted provided that the following conditions are
1712SN/A * met: redistributions of source code must retain the above copyright
1812SN/A * notice, this list of conditions and the following disclaimer;
1912SN/A * redistributions in binary form must reproduce the above copyright
2012SN/A * notice, this list of conditions and the following disclaimer in the
2112SN/A * documentation and/or other materials provided with the distribution;
2212SN/A * neither the name of the copyright holders nor the names of its
2312SN/A * contributors may be used to endorse or promote products derived from
2412SN/A * this software without specific prior written permission.
2512SN/A *
2612SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
272665Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
282665Ssaidi@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
292665Ssaidi@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3012SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3112SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3312SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
342634Sstever@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35468SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3656SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
374484Sbinkertn@umich.edu *
382439SN/A * Authors: Gabe Black
3956SN/A */
402423SN/A
412423SN/A#include "arch/x86/insts/microldstop.hh"
4212SN/A
4312SN/A#include <string>
4412SN/A
4512SN/Anamespace X86ISA
4612SN/A{
47443SN/A    std::string LdStOp::generateDisassembly(Addr pc,
48443SN/A            const SymbolTable *symtab) const
492207SN/A    {
502207SN/A        std::stringstream response;
51443SN/A
52468SN/A        printMnemonic(response, instMnem, mnemonic);
531708SN/A        if (flags[IsLoad])
541708SN/A            printDestReg(response, 0, dataSize);
55443SN/A        else
56468SN/A            printSrcReg(response, 2, dataSize);
57443SN/A        response << ", ";
58468SN/A        printMem(response, segment, scale, index, base, disp,
59443SN/A                addressSize, false);
60443SN/A        return response.str();
61468SN/A    }
62468SN/A
63443SN/A    std::string LdStSplitOp::generateDisassembly(Addr pc,
64443SN/A            const SymbolTable *symtab) const
65443SN/A    {
662476SN/A        std::stringstream response;
672207SN/A
682207SN/A        printMnemonic(response, instMnem, mnemonic);
692207SN/A        int baseRegIdx = flags[IsLoad] ? 0 : 2;
702207SN/A        response << "[";
712207SN/A        printDestReg(response, baseRegIdx, dataSize);
724111Sgblack@eecs.umich.edu        response << ", ";
734111Sgblack@eecs.umich.edu        printDestReg(response, baseRegIdx+1, dataSize);
742620SN/A        response << "], ";
754111Sgblack@eecs.umich.edu        printMem(response, segment, scale, index, base, disp,
764111Sgblack@eecs.umich.edu                addressSize, false);
774111Sgblack@eecs.umich.edu        return response.str();
784111Sgblack@eecs.umich.edu    }
794111Sgblack@eecs.umich.edu}
802207SN/A