microldstop.cc revision 4842
14679Sgblack@eecs.umich.edu/* 24679Sgblack@eecs.umich.edu * Copyright (c) 2007 The Hewlett-Packard Development Company 34679Sgblack@eecs.umich.edu * All rights reserved. 44679Sgblack@eecs.umich.edu * 54679Sgblack@eecs.umich.edu * Redistribution and use of this software in source and binary forms, 64679Sgblack@eecs.umich.edu * with or without modification, are permitted provided that the 74679Sgblack@eecs.umich.edu * following conditions are met: 84679Sgblack@eecs.umich.edu * 94679Sgblack@eecs.umich.edu * The software must be used only for Non-Commercial Use which means any 104679Sgblack@eecs.umich.edu * use which is NOT directed to receiving any direct monetary 114679Sgblack@eecs.umich.edu * compensation for, or commercial advantage from such use. Illustrative 124679Sgblack@eecs.umich.edu * examples of non-commercial use are academic research, personal study, 134679Sgblack@eecs.umich.edu * teaching, education and corporate research & development. 144679Sgblack@eecs.umich.edu * Illustrative examples of commercial use are distributing products for 154679Sgblack@eecs.umich.edu * commercial advantage and providing services using the software for 164679Sgblack@eecs.umich.edu * commercial advantage. 174679Sgblack@eecs.umich.edu * 184679Sgblack@eecs.umich.edu * If you wish to use this software or functionality therein that may be 194679Sgblack@eecs.umich.edu * covered by patents for commercial use, please contact: 204679Sgblack@eecs.umich.edu * Director of Intellectual Property Licensing 214679Sgblack@eecs.umich.edu * Office of Strategy and Technology 224679Sgblack@eecs.umich.edu * Hewlett-Packard Company 234679Sgblack@eecs.umich.edu * 1501 Page Mill Road 244679Sgblack@eecs.umich.edu * Palo Alto, California 94304 254679Sgblack@eecs.umich.edu * 264679Sgblack@eecs.umich.edu * Redistributions of source code must retain the above copyright notice, 274679Sgblack@eecs.umich.edu * this list of conditions and the following disclaimer. Redistributions 284679Sgblack@eecs.umich.edu * in binary form must reproduce the above copyright notice, this list of 294679Sgblack@eecs.umich.edu * conditions and the following disclaimer in the documentation and/or 304679Sgblack@eecs.umich.edu * other materials provided with the distribution. Neither the name of 314679Sgblack@eecs.umich.edu * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 324679Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 334679Sgblack@eecs.umich.edu * this software without specific prior written permission. No right of 344679Sgblack@eecs.umich.edu * sublicense is granted herewith. Derivatives of the software and 354679Sgblack@eecs.umich.edu * output created using the software may be prepared, but only for 364679Sgblack@eecs.umich.edu * Non-Commercial Uses. Derivatives of the software may be shared with 374679Sgblack@eecs.umich.edu * others provided: (i) the others agree to abide by the list of 384679Sgblack@eecs.umich.edu * conditions herein which includes the Non-Commercial Use restrictions; 394679Sgblack@eecs.umich.edu * and (ii) such Derivatives of the software include the above copyright 404679Sgblack@eecs.umich.edu * notice to acknowledge the contribution from this software where 414679Sgblack@eecs.umich.edu * applicable, this list of conditions and the disclaimer below. 424679Sgblack@eecs.umich.edu * 434679Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 444679Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 454679Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 464679Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 474679Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 484679Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 494679Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 504679Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 514679Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 524679Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 534679Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 544679Sgblack@eecs.umich.edu * 554679Sgblack@eecs.umich.edu * Authors: Gabe Black 564679Sgblack@eecs.umich.edu */ 574679Sgblack@eecs.umich.edu 584679Sgblack@eecs.umich.edu#include "arch/x86/insts/microldstop.hh" 594679Sgblack@eecs.umich.edu#include <string> 604679Sgblack@eecs.umich.edu 614679Sgblack@eecs.umich.edunamespace X86ISA 624679Sgblack@eecs.umich.edu{ 634679Sgblack@eecs.umich.edu std::string LdStOp::generateDisassembly(Addr pc, 644679Sgblack@eecs.umich.edu const SymbolTable *symtab) const 654679Sgblack@eecs.umich.edu { 664679Sgblack@eecs.umich.edu std::stringstream response; 674842Sgblack@eecs.umich.edu bool someAddr = false; 684679Sgblack@eecs.umich.edu 694679Sgblack@eecs.umich.edu printMnemonic(response, instMnem, mnemonic); 704842Sgblack@eecs.umich.edu if(flags[IsLoad]) 714842Sgblack@eecs.umich.edu printDestReg(response, 0, dataSize); 724842Sgblack@eecs.umich.edu else 734842Sgblack@eecs.umich.edu printSrcReg(response, 2, dataSize); 744679Sgblack@eecs.umich.edu response << ", "; 754679Sgblack@eecs.umich.edu printSegment(response, segment); 764842Sgblack@eecs.umich.edu response << ":["; 774842Sgblack@eecs.umich.edu if(scale != 0 && _srcRegIdx[0] != ZeroReg) 784842Sgblack@eecs.umich.edu { 794842Sgblack@eecs.umich.edu if(scale != 1) 804842Sgblack@eecs.umich.edu ccprintf(response, "%d*", scale); 814842Sgblack@eecs.umich.edu printSrcReg(response, 0, addressSize); 824842Sgblack@eecs.umich.edu someAddr = true; 834842Sgblack@eecs.umich.edu } 844842Sgblack@eecs.umich.edu if(_srcRegIdx[1] != ZeroReg) 854842Sgblack@eecs.umich.edu { 864842Sgblack@eecs.umich.edu if(someAddr) 874842Sgblack@eecs.umich.edu response << " + "; 884842Sgblack@eecs.umich.edu printSrcReg(response, 1, addressSize); 894842Sgblack@eecs.umich.edu someAddr = true; 904842Sgblack@eecs.umich.edu } 914842Sgblack@eecs.umich.edu if(disp != 0) 924842Sgblack@eecs.umich.edu { 934842Sgblack@eecs.umich.edu if(someAddr) 944842Sgblack@eecs.umich.edu response << " + "; 954842Sgblack@eecs.umich.edu ccprintf(response, "%#x", disp); 964842Sgblack@eecs.umich.edu someAddr = true; 974842Sgblack@eecs.umich.edu } 984842Sgblack@eecs.umich.edu if(!someAddr) 994842Sgblack@eecs.umich.edu response << "0"; 1004842Sgblack@eecs.umich.edu response << "]"; 1014679Sgblack@eecs.umich.edu return response.str(); 1024679Sgblack@eecs.umich.edu } 1034679Sgblack@eecs.umich.edu} 104