return cpu->processRetry();
}
+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;
+}
-
+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;
+}
SimpleCPU::SimpleCPU(Params *p)
: BaseCPU(p), icachePort(this),
virtual void recvStatusChange(Status status);
virtual Packet *recvRetry();
+
+ virtual void readBlobFunctional(Addr addr, uint8_t *p, int size);
+
+ virtual void writeBlobFunctional(Addr addr, uint8_t *p, int size);
};
CpuPort icachePort;
virtual void unserialize(Checkpoint *cp, const std::string §ion);
};
-uint64_t
+/*uint64_t
PhysicalMemory::phys_read_qword(Addr addr) const
{
if (addr + sizeof(uint64_t) > pmem_size)
return 0;
return *(uint64_t *)(pmem_addr + addr);
-}
+}*/
#endif //__PHYSICAL_MEMORY_HH__
appropriate chunks. The default implementation can use
getBlockSize() to determine the block size and go from there.
*/
- virtual void readBlobFunctional(Addr addr, uint8_t *p, int size);
+ virtual void readBlobFunctional(Addr addr, uint8_t *p, int size)
+ { panic("Unimplemented"); }
/** This function is a wrapper around sendFunctional()
that breaks a larger, arbitrarily aligned access into
appropriate chunks. The default implementation can use
getBlockSize() to determine the block size and go from there.
*/
- virtual void writeBlobFunctional(Addr addr, const uint8_t *p, int size);
+ virtual void writeBlobFunctional(Addr addr, uint8_t *p, int size)
+ { panic("Unimplemented"); }
/** Fill size bytes starting at addr with byte value val. This
should not need to be virtual, since it can be implemented in
prot_memset on the old functional memory that's never used),
but Nate claims it is.
*/
- void memsetBlobFunctional(Addr addr, uint8_t val, int size);
-
- // I believe these two string functions can be defined once and
- // for all at the top level by implementing them in terms of
- // readBlob and writeBlob.
-
- /** Write null-terminated string 'str' into memory at 'addr'. */
- void writeStringFunctional(Addr addr, const char *str);
-
- /** Read null-terminated string from 'addr' into 'str'. */
- void readStringFunctional(std::string &str, Addr addr);
+ void memsetBlobFunctional(Addr addr, uint8_t val, int size)
+ { panic("Unimplemented"); }
};
#endif //__MEM_PORT_HH__
}
Fault
-TranslatingPort::writeBlobFunctional(Addr addr, const uint8_t *p, int size)
+TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size)
{
Addr paddr;
Addr paddr;
//@todo Break up things larger than a page size
+ //Use the Stever breakup code
pTable->page_check(addr, size);
if (!pTable->translate(addr,paddr))
Fault
TranslatingPort::writeStringFunctional(Addr addr, const char *str)
{
- //@todo Break up things larger than a page size
- //pTable->page_check(addr, size);
- //Need to check string length???
+ Addr paddr,vaddr;
+ uint8_t c;
- Addr paddr;
+ vaddr = addr;
- if (!pTable->translate(addr,paddr))
- return Machine_Check_Fault;
+ do {
+ c = *str++;
+ if (!pTable->translate(vaddr++,paddr))
+ return Machine_Check_Fault;
+
+ port->writeBlobFunctional(paddr, &c, 1);
+ } while (c);
- port->writeStringFunctional(paddr, str);
return No_Fault;
}
Fault
TranslatingPort::readStringFunctional(std::string &str, Addr addr)
{
- //@todo Break up things larger than a page size
- //pTable->page_check(addr, size);
- //Need to check string length???
+ Addr paddr,vaddr;
+ uint8_t c;
- Addr paddr;
+ vaddr = addr;
- if (!pTable->translate(addr,paddr))
- return Machine_Check_Fault;
+ do {
+ if (!pTable->translate(vaddr++,paddr))
+ return Machine_Check_Fault;
+
+ port->readBlobFunctional(paddr, &c, 1);
+ str += c;
+ } while (c);
- //@todo Break this up into readBlobs
- port->readStringFunctional(str, paddr);
return No_Fault;
}
public:
Fault readBlobFunctional(Addr addr, uint8_t *p, int size);
- Fault writeBlobFunctional(Addr addr, const uint8_t *p, int size);
+ Fault writeBlobFunctional(Addr addr, uint8_t *p, int size);
Fault memsetBlobFunctional(Addr addr, uint8_t val, int size);
Fault writeStringFunctional(Addr addr, const char *str);
Fault readStringFunctional(std::string &str, Addr addr);