void
Bus::recvStatusChange(Port::Status status, int id)
{
- assert(status == Port:: RangeChange &&
+ assert(status == Port::RangeChange &&
"The other statuses need to be implemented.");
+
+ assert(id < interfaces.size() && id >= 0);
Port *port = interfaces[id];
AddrRangeList ranges;
AddrRangeList snoops;
};
- /** A count of the number of interfaces connected to this bus. */
- int num_interfaces;
-
/** An array of pointers to the peer port interfaces
connected to this bus.*/
- Port *interfaces[];
+ std::vector<Port*> interfaces;
public:
virtual Port *getPort(const std::string &if_name)
{
// if_name ignored? forced to be empty?
- int id = num_interfaces++;
- interfaces[id] = new BusPort(this, id);
- return interfaces[id];
+ int id = interfaces.size();
+ interfaces.push_back(new BusPort(this, id));
+ return interfaces.back();
}
Bus(const std::string &n)
- : MemObject(n), num_interfaces(0) {}
+ : MemObject(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.
pmem_size = 1 << 27;