#include <string>
#include "base/cprintf.hh"
+#include "base/chunk_generator.hh"
#include "base/inifile.hh"
#include "base/loader/symtab.hh"
#include "base/misc.hh"
void
SimpleCPU::CpuPort::writeBlobFunctional(Addr addr, uint8_t *p, int size)
{
- int blksize = sendBlockSizeQuery();
- //Use Stever's break it inot block size chunk code
- //then send functional
- blksize |= blksize;
+ int prevSize = 0;
+ //Base Packet
+ for (ChunkGenerator gen(addr, size, sendBlockSizeQuery()); !gen.done(); gen.next())
+ {
+ Packet *blobpkt = new Packet();
+ CpuRequest *blobreq = new CpuRequest();
+ blobpkt->addr = gen.addr();
+ blobpkt->size = gen.size();
+ blobpkt->cmd = Write;
+ blobpkt->req = blobreq;
+ blobpkt->req->paddr = blobpkt->addr;
+ blobpkt->req->size = blobpkt->size;
+ blobpkt->data = p + prevSize;
+ prevSize += blobpkt->size;
+
+ sendFunctional(*blobpkt);
+ }
}
void
SimpleCPU::CpuPort::readBlobFunctional(Addr addr, uint8_t *p, int size)
{
- int blksize = sendBlockSizeQuery();
- //Use Stever's break it inot block size chunk code
- //then send functional
- blksize |= blksize;
+ int prevSize = 0;
+ //Base Packet
+ for (ChunkGenerator gen(addr, size, sendBlockSizeQuery()); !gen.done(); gen.next())
+ {
+ Packet *blobpkt = new Packet();
+ CpuRequest *blobreq = new CpuRequest();
+ blobpkt->addr = gen.addr();
+ blobpkt->size = gen.size();
+ blobpkt->cmd = Write;
+ blobpkt->req = blobreq;
+ blobpkt->req->paddr = blobpkt->addr;
+ blobpkt->req->size = blobpkt->size;
+ blobpkt->data = p + prevSize;
+ prevSize += blobpkt->size;
+
+ sendFunctional(*blobpkt);
+ }
}
SimpleCPU::SimpleCPU(Params *p)
*/
#include <string>
+#include "base/chunk_generator.hh"
#include "mem/port.hh"
#include "mem/translating_port.hh"
#include "mem/page_table.hh"
TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size)
{
Addr paddr;
+ int prevSize = 0;
- //@todo Break up things larger than a page size
- pTable->page_check(addr, size);
+ for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) {
+ if (!pTable->translate(gen.addr(),paddr))
+ return Machine_Check_Fault;
- if (!pTable->translate(addr,paddr))
- return Machine_Check_Fault;
+ port->readBlobFunctional(paddr, p + prevSize, gen.size());
+ prevSize += gen.size();
+ }
- port->readBlobFunctional(paddr, p, size);
return No_Fault;
}
TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size)
{
Addr paddr;
+ int prevSize = 0;
- //@todo Break up things larger than a page size
- pTable->page_check(addr, size);
+ for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) {
- if (!pTable->translate(addr,paddr))
- return Machine_Check_Fault;
+ if (!pTable->translate(gen.addr(),paddr))
+ return Machine_Check_Fault;
+
+ port->writeBlobFunctional(paddr, p + prevSize, gen.size());
+ prevSize += gen.size();
+ }
- port->writeBlobFunctional(paddr, p, size);
return No_Fault;
}
{
Addr paddr;
- //@todo Break up things larger than a page size
- //Use the Stever breakup code
- pTable->page_check(addr, size);
+ for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) {
+
+ if (!pTable->translate(gen.addr(),paddr))
+ return Machine_Check_Fault;
- if (!pTable->translate(addr,paddr))
- return Machine_Check_Fault;
+ port->memsetBlobFunctional(paddr, val, gen.size());
+ }
- port->memsetBlobFunctional(paddr, val, size);
return No_Fault;
}