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