sim: Use forward declarations for ports.
authorAli Saidi <Ali.Saidi@ARM.com>
Mon, 8 Nov 2010 19:58:22 +0000 (13:58 -0600)
committerAli Saidi <Ali.Saidi@ARM.com>
Mon, 8 Nov 2010 19:58:22 +0000 (13:58 -0600)
Virtual ports need TLB data which means anything touching a file in the arch
directory rebuilds any file that includes system.hh which in everything.

15 files changed:
src/arch/alpha/freebsd/system.cc
src/arch/alpha/linux/system.cc
src/arch/alpha/stacktrace.cc
src/arch/alpha/system.cc
src/arch/alpha/tru64/system.cc
src/arch/arm/linux/system.cc
src/arch/arm/stacktrace.cc
src/arch/arm/system.cc
src/arch/mips/system.cc
src/base/remote_gdb.cc
src/cpu/simple_thread.cc
src/dev/simple_disk.cc
src/dev/sparc/iob.cc
src/sim/system.cc
src/sim/system.hh

index ac7a92ed33f3b74a9aeae83debb11a4f66bd1e20..6c7da711f27d1fded32911b11b6115f889dd0ae6 100644 (file)
@@ -43,6 +43,7 @@
 #include "cpu/thread_context.hh"
 #include "mem/physical.hh"
 #include "mem/port.hh"
+#include "mem/vport.hh"
 #include "sim/byteswap.hh"
 
 #define TIMER_FREQUENCY 1193180
@@ -77,8 +78,8 @@ FreebsdAlphaSystem::doCalibrateClocks(ThreadContext *tc)
     ppc_vaddr = (Addr)tc->readIntReg(17);
     timer_vaddr = (Addr)tc->readIntReg(18);
 
-    virtPort.write(ppc_vaddr, (uint32_t)SimClock::Frequency);
-    virtPort.write(timer_vaddr, (uint32_t)TIMER_FREQUENCY);
+    virtPort->write(ppc_vaddr, (uint32_t)SimClock::Frequency);
+    virtPort->write(timer_vaddr, (uint32_t)TIMER_FREQUENCY);
 }
 
 void
index c2af286dde573a7c31214e84b2c15cf1916fd617..1bb8bd2cf9b3c491da0db396286fd19477b7507c 100644 (file)
@@ -77,7 +77,7 @@ LinuxAlphaSystem::LinuxAlphaSystem(Params *p)
      * Since we aren't using a bootloader, we have to copy the
      * kernel arguments directly into the kernel's memory.
      */
-    virtPort.writeBlob(CommandLine(), (uint8_t*)params()->boot_osflags.c_str(),
+    virtPort->writeBlob(CommandLine(), (uint8_t*)params()->boot_osflags.c_str(),
                 params()->boot_osflags.length()+1);
 
     /**
@@ -86,7 +86,7 @@ LinuxAlphaSystem::LinuxAlphaSystem(Params *p)
      * calculated it by using the PIT, RTC, etc.
      */
     if (kernelSymtab->findAddress("est_cycle_freq", addr))
-        virtPort.write(addr, (uint64_t)(SimClock::Frequency /
+        virtPort->write(addr, (uint64_t)(SimClock::Frequency /
                     p->boot_cpu_frequency));
 
 
@@ -97,7 +97,7 @@ LinuxAlphaSystem::LinuxAlphaSystem(Params *p)
      * 255 ASNs.
      */
     if (kernelSymtab->findAddress("dp264_mv", addr))
-        virtPort.write(addr + 0x18, LittleEndianGuest::htog((uint32_t)127));
+        virtPort->write(addr + 0x18, LittleEndianGuest::htog((uint32_t)127));
     else
         panic("could not find dp264_mv\n");
 
index 9c6b3cff0b8d1831601f555a1960e46862e0e563..9744d56d13754bd8b1d32a0585c6548cd84812cf 100644 (file)
@@ -37,6 +37,7 @@
 #include "base/trace.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
+#include "mem/vport.hh"
 #include "sim/system.hh"
 
 using namespace std;
index 2c5570d46522170b28fbc7803d80b3e7a228dcd6..4964347fb2c9655eb7209f7ee924bc7e6ab9464b 100644 (file)
@@ -38,6 +38,7 @@
 #include "base/loader/symtab.hh"
 #include "base/trace.hh"
 #include "mem/physical.hh"
+#include "mem/vport.hh"
 #include "params/AlphaSystem.hh"
 #include "sim/byteswap.hh"
 
@@ -65,8 +66,8 @@ AlphaSystem::AlphaSystem(Params *p)
 
 
     // Load program sections into memory
-    pal->loadSections(&functionalPort, loadAddrMask);
-    console->loadSections(&functionalPort, loadAddrMask);
+    pal->loadSections(functionalPort, loadAddrMask);
+    console->loadSections(functionalPort, loadAddrMask);
 
     // load symbols
     if (!console->loadGlobalSymbols(consoleSymtab))
@@ -99,7 +100,7 @@ AlphaSystem::AlphaSystem(Params *p)
      * others do.)
      */
     if (consoleSymtab->findAddress("env_booted_osflags", addr)) {
-        virtPort.writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(),
+        virtPort->writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(),
                 strlen(params()->boot_osflags.c_str()));
     }
 
@@ -110,9 +111,9 @@ AlphaSystem::AlphaSystem(Params *p)
     if (consoleSymtab->findAddress("m5_rpb", addr)) {
         uint64_t data;
         data = htog(params()->system_type);
-        virtPort.write(addr+0x50, data);
+        virtPort->write(addr+0x50, data);
         data = htog(params()->system_rev);
-        virtPort.write(addr+0x58, data);
+        virtPort->write(addr+0x58, data);
     } else
         panic("could not find hwrpb\n");
 }
@@ -168,8 +169,8 @@ AlphaSystem::fixFuncEventAddr(Addr addr)
     // lda  gp,Y(gp): opcode 8, Ra = 29, rb = 29
     const uint32_t gp_lda_pattern  = (8 << 26) | (29 << 21) | (29 << 16);
 
-    uint32_t i1 = virtPort.read<uint32_t>(addr);
-    uint32_t i2 = virtPort.read<uint32_t>(addr + sizeof(MachInst));
+    uint32_t i1 = virtPort->read<uint32_t>(addr);
+    uint32_t i2 = virtPort->read<uint32_t>(addr + sizeof(MachInst));
 
     if ((i1 & inst_mask) == gp_ldah_pattern &&
         (i2 & inst_mask) == gp_lda_pattern) {
@@ -186,7 +187,7 @@ AlphaSystem::setAlphaAccess(Addr access)
 {
     Addr addr = 0;
     if (consoleSymtab->findAddress("m5AlphaAccess", addr)) {
-        virtPort.write(addr, htog(Phys2K0Seg(access)));
+        virtPort->write(addr, htog(Phys2K0Seg(access)));
     } else {
         panic("could not find m5AlphaAccess\n");
     }
index db3402d2ab49417a5ecd820fbe06c528822c5c97..5a47addbd24112a965dc12474414733faf198570 100644 (file)
@@ -40,6 +40,7 @@
 #include "kern/system_events.hh"
 #include "mem/physical.hh"
 #include "mem/port.hh"
+#include "mem/vport.hh"
 
 using namespace std;
 
@@ -48,7 +49,7 @@ Tru64AlphaSystem::Tru64AlphaSystem(Tru64AlphaSystem::Params *p)
 {
     Addr addr = 0;
     if (kernelSymtab->findAddress("enable_async_printf", addr)) {
-        virtPort.write(addr, (uint32_t)0);
+        virtPort->write(addr, (uint32_t)0);
     }
 
 #ifdef DEBUG
index 40658976bbd0a2d36ca085ffb90378034f90a5f2..ddf7f19f35b3bea8cd1cd0266c507b99b9185312 100644 (file)
 #include "arch/arm/isa_traits.hh"
 #include "arch/arm/linux/atag.hh"
 #include "arch/arm/linux/system.hh"
+#include "arch/arm/utility.hh"
 #include "base/loader/object_file.hh"
 #include "base/loader/symtab.hh"
+#include "cpu/thread_context.hh"
 #include "mem/physical.hh"
 
 using namespace ArmISA;
@@ -87,7 +89,7 @@ LinuxArmSystem::LinuxArmSystem(Params *p)
     DPRINTF(Loader, "Boot atags was %d bytes in total\n", size << 2);
     DDUMP(Loader, boot_data, size << 2);
 
-    functionalPort.writeBlob(ParamsList, boot_data, size << 2);
+    functionalPort->writeBlob(ParamsList, boot_data, size << 2);
 
 #ifndef NDEBUG
     kernelPanicEvent = addKernelFuncEvent<BreakPCEvent>("panic");
index 6b346b0abff761e717752bfdfff3d903eec644c5..31376cdae3777f1a190dc4fd3c643e4374ebe0bb 100644 (file)
@@ -37,6 +37,7 @@
 #include "base/trace.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
+#include "mem/vport.hh"
 #include "sim/system.hh"
 
 using namespace std;
index 756f64eb7a2a297179585153de5505aafa6c5afa..f6e265ae45a3fe05c0d92ac57fa583b174549b57 100644 (file)
@@ -44,7 +44,6 @@
 #include <iostream>
 
 using namespace std;
-using namespace ArmISA;
 using namespace Linux;
 
 ArmSystem::ArmSystem(Params *p)
index d11d473e35a891deae582bb505b4e1a27946be2f..6e2ad4d5a174ba8c7bade07851deb36e63b02671 100755 (executable)
@@ -50,7 +50,7 @@ MipsSystem::MipsSystem(Params *p) : System(p)
 #if FULL_SYSTEM
     if (p->bare_iron == true) {
         hexFile = new HexFile(params()->hex_file_name);
-        if (!hexFile->loadSections(&functionalPort))
+        if (!hexFile->loadSections(functionalPort))
             panic("Could not load hex file\n");
     }
 
@@ -70,7 +70,7 @@ MipsSystem::MipsSystem(Params *p) : System(p)
     if (console == NULL)
         fatal("Could not load console file %s", params()->console);
     //Load program sections into memory
-    console->loadSections(&functionalPort, loadAddrMask);
+    console->loadSections(functionalPort, loadAddrMask);
 
     //load symbols
     if (!console->loadGlobalSymbols(consoleSymtab))
@@ -92,7 +92,7 @@ MipsSystem::MipsSystem(Params *p) : System(p)
      */
     if (consoleSymtab->findAddress("env_booted_osflags", addr)) {
         warn("writing addr starting from %#x", addr);
-        virtPort.writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(),
+        virtPort->writeBlob(addr, (uint8_t*)params()->boot_osflags.c_str(),
                 strlen(params()->boot_osflags.c_str()));
     }
 
@@ -103,9 +103,9 @@ MipsSystem::MipsSystem(Params *p) : System(p)
     if (consoleSymtab->findAddress("m5_rpb", addr)) {
         uint64_t data;
         data = htog(params()->system_type);
-        virtPort.write(addr + 0x50, data);
+        virtPort->write(addr + 0x50, data);
         data = htog(params()->system_rev);
-        virtPort.write(addr + 0x58, data);
+        virtPort->write(addr + 0x58, data);
     } else {
         panic("could not find hwrpb\n");
     }
index 4a06ff30793664d7c578dcaa6b587e8fa476e223..b7c34859b02e6d4b3e57d7e25d453b96f5190a72 100644 (file)
 
 #if FULL_SYSTEM
 #include "arch/vtophys.hh"
+#include "mem/vport.hh"
 #endif
 
 #include "base/intmath.hh"
index 15fac86779ef515ccfd112172d8c4aff3896483f..51e27188cd64dd6e55f46ee73da63ef14cde47a8 100644 (file)
@@ -50,6 +50,7 @@
 #include "base/trace.hh"
 #include "cpu/profile.hh"
 #include "cpu/quiesce_event.hh"
+#include "mem/vport.hh"
 #include "sim/serialize.hh"
 #include "sim/sim_exit.hh"
 #else
index b8096d2138c1fd9fc23b43eedd7bef3a89acae04..eb603c6c7e6d4f1b9c41eabbde6d19a1edfc24ed 100644 (file)
@@ -68,7 +68,7 @@ SimpleDisk::read(Addr addr, baddr_t block, int count) const
     for (int i = 0, j = 0; i < count; i += SectorSize, j++)
         image->read(data + i, block + j);
 
-    system->functionalPort.writeBlob(addr, data, count);
+    system->functionalPort->writeBlob(addr, data, count);
 
     DPRINTF(SimpleDisk, "read  block=%#x len=%d\n", (uint64_t)block, count);
     DDUMP(SimpleDiskData, data, count);
index 40f856d8af2b2f8bb14063391acf8950e7408152..0b03aceb6f1078cfe54fb8f086cda1d414d3e190 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "arch/sparc/isa_traits.hh"
 #include "arch/sparc/faults.hh"
+#include "base/bitfield.hh"
 #include "base/trace.hh"
 #include "cpu/intr_control.hh"
 #include "dev/sparc/iob.hh"
index 45e06616da83929bfd217a348e6658dfbe2179af..6ed6b8e4222898c59099f7249880114618c19429 100644 (file)
@@ -49,6 +49,7 @@
 #if FULL_SYSTEM
 #include "arch/vtophys.hh"
 #include "kern/kernel_stats.hh"
+#include "mem/vport.hh"
 #else
 #include "params/System.hh"
 #endif
@@ -64,8 +65,6 @@ System::System(Params *p)
     : SimObject(p), physmem(p->physmem), _numContexts(0),
 #if FULL_SYSTEM
       init_param(p->init_param),
-      functionalPort(p->name + "-fport"),
-      virtPort(p->name + "-vport"),
       loadAddrMask(p->load_addr_mask),
 #else
       page_ptr(0),
@@ -86,13 +85,15 @@ System::System(Params *p)
      * Get a functional port to memory
      */
     Port *mem_port;
+    functionalPort = new FunctionalPort(name() + "-fport");
     mem_port = physmem->getPort("functional");
-    functionalPort.setPeer(mem_port);
-    mem_port->setPeer(&functionalPort);
+    functionalPort->setPeer(mem_port);
+    mem_port->setPeer(functionalPort);
 
+    virtPort = new VirtualPort(name() + "-fport");
     mem_port = physmem->getPort("functional");
-    virtPort.setPeer(mem_port);
-    mem_port->setPeer(&virtPort);
+    virtPort->setPeer(mem_port);
+    mem_port->setPeer(virtPort);
 
 
     /**
@@ -110,7 +111,7 @@ System::System(Params *p)
             fatal("Could not load kernel file %s", params()->kernel);
 
         // Load program sections into memory
-        kernel->loadSections(&functionalPort, loadAddrMask);
+        kernel->loadSections(functionalPort, loadAddrMask);
 
         // setup entry points
         kernelStart = kernel->textBase();
index cc92bba09c96848c8ed8773ccf7d1dfa7675c6b2..11a4b007a4b93412acc356b2914cb81bed7a43ef 100644 (file)
@@ -48,7 +48,6 @@
 
 #if FULL_SYSTEM
 #include "kern/system_events.hh"
-#include "mem/vport.hh"
 #endif
 
 class BaseCPU;
@@ -58,6 +57,8 @@ class PhysicalMemory;
 
 #if FULL_SYSTEM
 class Platform;
+class FunctionalPort;
+class VirtualPort;
 #endif
 class GDBListener;
 class BaseRemoteGDB;
@@ -108,8 +109,8 @@ class System : public SimObject
 
     /** Port to physical memory used for writing object files into ram at
      * boot.*/
-    FunctionalPort functionalPort;
-    VirtualPort virtPort;
+    FunctionalPort *functionalPort;
+    VirtualPort *virtPort;
 
     /** kernel symbol table */
     SymbolTable *kernelSymtab;