DataBlock.cc revision 6288
16288Snate@binkert.org 26288Snate@binkert.org/* 36288Snate@binkert.org * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 46288Snate@binkert.org * All rights reserved. 56288Snate@binkert.org * 66288Snate@binkert.org * Redistribution and use in source and binary forms, with or without 76288Snate@binkert.org * modification, are permitted provided that the following conditions are 86288Snate@binkert.org * met: redistributions of source code must retain the above copyright 96288Snate@binkert.org * notice, this list of conditions and the following disclaimer; 106288Snate@binkert.org * redistributions in binary form must reproduce the above copyright 116288Snate@binkert.org * notice, this list of conditions and the following disclaimer in the 126288Snate@binkert.org * documentation and/or other materials provided with the distribution; 136288Snate@binkert.org * neither the name of the copyright holders nor the names of its 146288Snate@binkert.org * contributors may be used to endorse or promote products derived from 156288Snate@binkert.org * this software without specific prior written permission. 166288Snate@binkert.org * 176288Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 186288Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 196288Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 206288Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 216288Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 226288Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 236288Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 246288Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 256288Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 266288Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 276288Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 286288Snate@binkert.org */ 296145Snate@binkert.org 306154Snate@binkert.org#include "mem/ruby/common/DataBlock.hh" 316145Snate@binkert.org 326285Snate@binkert.orgDataBlock & 336285Snate@binkert.orgDataBlock::operator=(const DataBlock & obj) 346145Snate@binkert.org{ 356285Snate@binkert.org if (this == &obj) { 366285Snate@binkert.org // assert(false); 376285Snate@binkert.org } else { 386285Snate@binkert.org if (!m_alloc) 396285Snate@binkert.org m_data = new uint8[RubySystem::getBlockSizeBytes()]; 406285Snate@binkert.org memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes()); 416285Snate@binkert.org m_alloc = true; 426145Snate@binkert.org } 436285Snate@binkert.org return *this; 446145Snate@binkert.org} 45