Change everything to use the cached virtPort rather than created their own each time.

This appears to work, but I don't want to commit it until it gets tested a lot more.
I haven't deleted the functionality in this patch that will come later, but one question
is how to enforce encourage objects that call getVirtPort() to not cache the virtual port
since if the CPU changes out from under them it will be worse than useless. Perhaps a null
function like delVirtPort() is still useful in that case.
This commit is contained in:
Ali Saidi
2008-07-01 10:24:19 -04:00
parent 50e3e50e1a
commit c5fbbf376a
6 changed files with 10 additions and 10 deletions

View File

@@ -49,7 +49,7 @@ uint64_t getArgument(ThreadContext *tc, int number, bool fp)
return tc->readIntReg(ArgumentReg[number]);
} else {
Addr sp = tc->readIntReg(StackPointerReg);
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);

View File

@@ -59,7 +59,7 @@ getArgument(ThreadContext *tc, int number, bool fp)
return tc->readIntReg(ArgumentReg[number]);
} else {
Addr sp = tc->readIntReg(StackPointerReg);
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);

View File

@@ -50,7 +50,7 @@ uint64_t getArgument(ThreadContext *tc, int number, bool fp) {
return tc->readIntReg(ArgumentReg[number]);
} else {
Addr sp = tc->readIntReg(StackPointerReg);
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
uint64_t arg = vp->read<uint64_t>(sp + 92 +
(number-NumArgumentRegs) * sizeof(uint64_t));
tc->delVirtPort(vp);

View File

@@ -454,7 +454,7 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data)
DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size);
#if FULL_SYSTEM
VirtualPort *port = context->getVirtPort(context);
VirtualPort *port = context->getVirtPort();
#else
TranslatingPort *port = context->getMemPort();
#endif
@@ -499,7 +499,7 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data)
DPRINTFNR("\n");
}
#if FULL_SYSTEM
VirtualPort *port = context->getVirtPort(context);
VirtualPort *port = context->getVirtPort();
#else
TranslatingPort *port = context->getMemPort();
#endif

View File

@@ -75,7 +75,7 @@ void
CopyOut(ThreadContext *tc, void *dest, Addr src, size_t cplen)
{
uint8_t *dst = (uint8_t *)dest;
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
vp->readBlob(src, dst, cplen);
@@ -87,7 +87,7 @@ void
CopyIn(ThreadContext *tc, Addr dest, void *source, size_t cplen)
{
uint8_t *src = (uint8_t *)source;
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
vp->writeBlob(dest, src, cplen);
@@ -99,7 +99,7 @@ CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen)
{
int len = 0;
char *start = dst;
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
do {
vp->readBlob(vaddr++, (uint8_t*)dst++, 1);
@@ -112,7 +112,7 @@ CopyStringOut(ThreadContext *tc, char *dst, Addr vaddr, size_t maxlen)
void
CopyStringIn(ThreadContext *tc, char *src, Addr vaddr)
{
VirtualPort *vp = tc->getVirtPort(tc);
VirtualPort *vp = tc->getVirtPort();
for (ChunkGenerator gen(vaddr, strlen(src), TheISA::PageBytes); !gen.done();
gen.next())
{

View File

@@ -71,7 +71,7 @@ class VPtr
if (!ptr)
return;
VirtualPort *port = tc->getVirtPort(tc);
VirtualPort *port = tc->getVirtPort();
port->readBlob(ptr, buffer, sizeof(T));
tc->delVirtPort(port);
}