a bit of bad code trampling on memory
--HG-- extra : convert_revision : c0252dce6d7fc4c35ecd9f87ac4555e704de91b7
This commit is contained in:
parent
6a7108897b
commit
2609ed2a7c
3 changed files with 9 additions and 10 deletions
|
@ -85,8 +85,10 @@ Bus::recvFunctional(Packet &pkt, int id)
|
||||||
void
|
void
|
||||||
Bus::recvStatusChange(Port::Status status, int id)
|
Bus::recvStatusChange(Port::Status status, int id)
|
||||||
{
|
{
|
||||||
assert(status == Port:: RangeChange &&
|
assert(status == Port::RangeChange &&
|
||||||
"The other statuses need to be implemented.");
|
"The other statuses need to be implemented.");
|
||||||
|
|
||||||
|
assert(id < interfaces.size() && id >= 0);
|
||||||
Port *port = interfaces[id];
|
Port *port = interfaces[id];
|
||||||
AddrRangeList ranges;
|
AddrRangeList ranges;
|
||||||
AddrRangeList snoops;
|
AddrRangeList snoops;
|
||||||
|
|
13
mem/bus.hh
13
mem/bus.hh
|
@ -127,12 +127,9 @@ class Bus : public MemObject
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A count of the number of interfaces connected to this bus. */
|
|
||||||
int num_interfaces;
|
|
||||||
|
|
||||||
/** An array of pointers to the peer port interfaces
|
/** An array of pointers to the peer port interfaces
|
||||||
connected to this bus.*/
|
connected to this bus.*/
|
||||||
Port *interfaces[];
|
std::vector<Port*> interfaces;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -140,12 +137,12 @@ class Bus : public MemObject
|
||||||
virtual Port *getPort(const std::string &if_name)
|
virtual Port *getPort(const std::string &if_name)
|
||||||
{
|
{
|
||||||
// if_name ignored? forced to be empty?
|
// if_name ignored? forced to be empty?
|
||||||
int id = num_interfaces++;
|
int id = interfaces.size();
|
||||||
interfaces[id] = new BusPort(this, id);
|
interfaces.push_back(new BusPort(this, id));
|
||||||
return interfaces[id];
|
return interfaces.back();
|
||||||
}
|
}
|
||||||
Bus(const std::string &n)
|
Bus(const std::string &n)
|
||||||
: MemObject(n), num_interfaces(0) {}
|
: MemObject(n) {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ PhysicalMemory::MemResponseEvent::description()
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalMemory::PhysicalMemory(const string &n)
|
PhysicalMemory::PhysicalMemory(const string &n)
|
||||||
: MemObject(n), base_addr(0), pmem_addr(NULL)
|
: MemObject(n), base_addr(0), pmem_addr(NULL), port(NULL)
|
||||||
{
|
{
|
||||||
// Hardcoded to 128 MB for now.
|
// Hardcoded to 128 MB for now.
|
||||||
pmem_size = 1 << 27;
|
pmem_size = 1 << 27;
|
||||||
|
|
Loading…
Reference in a new issue