if (isLoad)
ret->allocate();
else
- ret->dataDynamicArray(data);
+ ret->dataDynamic(data);
return ret;
}
// Build packet here.
PacketPtr data_pkt = new Packet(mem_req, MemCmd::ReadReq);
- data_pkt->dataDynamicArray(new uint8_t[fetchBufferSize]);
+ data_pkt->dataDynamic(new uint8_t[fetchBufferSize]);
fetchBufferPC[tid] = fetchBufferBlockPC;
fetchBufferValid[tid] = false;
{
PacketPtr pkt;
buildPacket(pkt, req, read);
- pkt->dataDynamicArray<uint8_t>(data);
+ pkt->dataDynamic<uint8_t>(data);
if (req->getFlags().isSet(Request::NO_ACCESS)) {
assert(!dcache_pkt);
pkt->makeResponse();
req->setPhys(req1->getPaddr(), req->getSize(), req1->getFlags(), dataMasterId());
PacketPtr pkt = new Packet(req, pkt1->cmd.responseCommand());
- pkt->dataDynamicArray<uint8_t>(data);
+ pkt->dataDynamic<uint8_t>(data);
pkt1->dataStatic<uint8_t>(data);
pkt2->dataStatic<uint8_t>(data + req1->getSize());
} else {
panic("initiate was unexpectedly called\n");
}
- uint8_t* dummyData = new uint8_t;
- *dummyData = 0;
- pkt->dataDynamic(dummyData);
+ pkt->allocate();
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
}
PacketPtr pkt = new Packet(req, cmd);
- uint8_t* dummyData = new uint8_t;
- *dummyData = 0;
- pkt->dataDynamic(dummyData);
+ pkt->allocate();
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
blockAddr(req->getPaddr()), *result);
PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
- pkt->dataDynamicArray(new uint8_t[req->getSize()]);
+ pkt->dataDynamic(new uint8_t[req->getSize()]);
MemTestSenderState *state = new MemTestSenderState(result);
pkt->senderState = state;
PacketPtr pkt = new Packet(req, MemCmd::WriteReq);
uint8_t *pkt_data = new uint8_t[req->getSize()];
- pkt->dataDynamicArray(pkt_data);
+ pkt->dataDynamic(pkt_data);
memcpy(pkt_data, &data, req->getSize());
MemTestSenderState *state = new MemTestSenderState(result);
pkt->senderState = state;
destination, req->getPaddr());
PacketPtr pkt = new Packet(req, requestType);
- pkt->dataDynamicArray(new uint8_t[req->getSize()]);
+ pkt->dataDynamic(new uint8_t[req->getSize()]);
pkt->senderState = NULL;
sendPkt(pkt);
// despite the oddity of the 0 size (questionable if this should
// even be allowed), a prefetch is still a read and as such needs
// a place to store the result
- uint8_t *data = new uint8_t;
+ uint8_t *data = new uint8_t[1];
pkt->dataDynamic(data);
// push the subblock onto the sender state. The sequencer will
// }
PacketPtr pkt = new Packet(req, cmd);
- uint8_t *writeData = new uint8_t;
+ uint8_t *writeData = new uint8_t[1];
*writeData = m_value + m_store_count;
pkt->dataDynamic(writeData);
req->setThreadContext(index, 0);
PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
uint8_t *dataArray = new uint8_t[CHECK_SIZE];
- pkt->dataDynamicArray(dataArray);
+ pkt->dataDynamic(dataArray);
// push the subblock onto the sender state. The sequencer will
// update the subblock on the return
PacketPtr pkt = new Packet(req, cmd);
uint8_t* pkt_data = new uint8_t[req->getSize()];
- pkt->dataDynamicArray(pkt_data);
+ pkt->dataDynamic(pkt_data);
if (cmd.isWrite()) {
memset(pkt_data, 0xA, req->getSize());
/// when the packet is destroyed?
static const FlagsType STATIC_DATA = 0x00001000;
/// The data pointer points to a value that should be freed when
- /// the packet is destroyed.
+ /// the packet is destroyed. The pointer is assumed to be pointing
+ /// to an array, and delete [] is consequently called
static const FlagsType DYNAMIC_DATA = 0x00002000;
- /// the data pointer points to an array (thus delete []) needs to
- /// be called on it rather than simply delete.
- static const FlagsType ARRAY_DATA = 0x00004000;
/// suppress the error if this packet encounters a functional
/// access failure.
static const FlagsType SUPPRESS_FUNC_ERROR = 0x00008000;
void
dataStatic(T *p)
{
- assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA));
data = (PacketDataPtr)p;
flags.set(STATIC_DATA);
}
void
dataStaticConst(const T *p)
{
- assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA));
data = const_cast<PacketDataPtr>(p);
flags.set(STATIC_DATA);
}
*/
template <typename T>
void
- dataDynamicArray(T *p)
- {
- assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
- data = (PacketDataPtr)p;
- flags.set(DYNAMIC_DATA|ARRAY_DATA);
- }
-
- /**
- * set the data pointer to a value that should have delete called
- * on it.
- */
- template <typename T>
- void
dataDynamic(T *p)
{
- assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA));
data = (PacketDataPtr)p;
flags.set(DYNAMIC_DATA);
}
void
deleteData()
{
- if (flags.isSet(ARRAY_DATA))
+ if (flags.isSet(DYNAMIC_DATA))
delete [] data;
- else if (flags.isSet(DYNAMIC_DATA))
- delete data;
- flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA);
+ flags.clear(STATIC_DATA|DYNAMIC_DATA);
data = NULL;
}
allocate()
{
assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA));
- flags.set(DYNAMIC_DATA|ARRAY_DATA);
+ flags.set(DYNAMIC_DATA);
data = new uint8_t[getSize()];
}