Deleted Added
sdiff udiff text old ( 5275:5279ced1dd8b ) new ( 5314:e902f12a3af1 )
full compact
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 300 unchanged lines hidden (view full) ---

309PhysicalMemory::doFunctionalAccess(PacketPtr pkt)
310{
311 assert(pkt->getAddr() >= start() &&
312 pkt->getAddr() + pkt->getSize() <= start() + size());
313
314
315 uint8_t *hostAddr = pmemAddr + pkt->getAddr() - start();
316
317 if (pkt->cmd == MemCmd::ReadReq) {
318 memcpy(pkt->getPtr<uint8_t>(), hostAddr, pkt->getSize());
319 TRACE_PACKET("Read");
320 } else if (pkt->cmd == MemCmd::WriteReq) {
321 memcpy(hostAddr, pkt->getPtr<uint8_t>(), pkt->getSize());
322 TRACE_PACKET("Write");
323 } else {
324 panic("PhysicalMemory: unimplemented functional command %s",
325 pkt->cmdString());
326 }
327
328 pkt->makeAtomicResponse();
329}
330
331
332Port *
333PhysicalMemory::getPort(const std::string &if_name, int idx)
334{
335 // Accept request for "functional" port for backwards compatibility
336 // with places where this function is called from C++. I'd prefer

--- 63 unchanged lines hidden (view full) ---

400PhysicalMemory::MemoryPort::recvAtomic(PacketPtr pkt)
401{
402 return memory->doAtomicAccess(pkt);
403}
404
405void
406PhysicalMemory::MemoryPort::recvFunctional(PacketPtr pkt)
407{
408 if (!checkFunctional(pkt)) {
409 // Default implementation of SimpleTimingPort::recvFunctional()
410 // calls recvAtomic() and throws away the latency; we can save a
411 // little here by just not calculating the latency.
412 memory->doFunctionalAccess(pkt);
413 }
414}
415
416unsigned int
417PhysicalMemory::drain(Event *de)
418{
419 int count = 0;
420 for (PortIterator pi = ports.begin(); pi != ports.end(); ++pi) {
421 count += (*pi)->drain(de);

--- 123 unchanged lines hidden ---