1/* 2 * Copyright (c) 2006 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; --- 94 unchanged lines hidden (view full) --- 103 delete oldPkt; 104 } 105 106 void partialWriteFix(Port *port) 107 { 108 assert(!partialWriteFixed); 109 assert(expectResponse); 110 |
111 Addr pbs = port->peerBlockSize(); 112 Addr blockAddr = pkt->getAddr() & ~(pbs-1); |
113 partialWriteFixed = true; 114 PacketDataPtr data; 115 116 data = new uint8_t[pbs]; |
117 RequestPtr funcReq = new Request(blockAddr, 4, 0); 118 PacketPtr funcPkt = new Packet(funcReq, MemCmd::ReadReq, 119 Packet::Broadcast); 120 for (int x = 0; x < pbs; x+=4) { 121 funcReq->setPhys(blockAddr + x, 4, 0); 122 funcPkt->reinitFromRequest(); 123 funcPkt->dataStatic(data + x); 124 port->sendFunctional(funcPkt); 125 assert(funcPkt->result == Packet::Success); 126 } |
127 delete funcPkt; |
128 delete funcReq; |
129 130 oldPkt = pkt; 131 memcpy(data + oldPkt->getOffset(pbs), pkt->getPtr<uint8_t>(), 132 pkt->getSize()); 133 pkt = new Packet(oldPkt->req, MemCmd::WriteInvalidateReq, 134 Packet::Broadcast, pbs); 135 pkt->dataDynamicArray(data); 136 pkt->senderState = oldPkt->senderState; --- 135 unchanged lines hidden --- |