#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
     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
 
      * 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);
 
     /**
      * 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));
 
 
      * 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");
 
 
 #include "base/trace.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
+#include "mem/vport.hh"
 #include "sim/system.hh"
 
 using namespace std;
 
 #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"
 
 
 
     // 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))
      * 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()));
     }
 
     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");
 }
     // 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) {
 {
     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");
     }
 
 #include "kern/system_events.hh"
 #include "mem/physical.hh"
 #include "mem/port.hh"
+#include "mem/vport.hh"
 
 using namespace std;
 
 {
     Addr addr = 0;
     if (kernelSymtab->findAddress("enable_async_printf", addr)) {
-        virtPort.write(addr, (uint32_t)0);
+        virtPort->write(addr, (uint32_t)0);
     }
 
 #ifdef DEBUG
 
 #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;
     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");
 
 #include "base/trace.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
+#include "mem/vport.hh"
 #include "sim/system.hh"
 
 using namespace std;
 
 #include <iostream>
 
 using namespace std;
-using namespace ArmISA;
 using namespace Linux;
 
 ArmSystem::ArmSystem(Params *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");
     }
 
     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))
      */
     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()));
     }
 
     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");
     }
 
 
 #if FULL_SYSTEM
 #include "arch/vtophys.hh"
+#include "mem/vport.hh"
 #endif
 
 #include "base/intmath.hh"
 
 #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
 
     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);
 
 
 #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"
 
 #if FULL_SYSTEM
 #include "arch/vtophys.hh"
 #include "kern/kernel_stats.hh"
+#include "mem/vport.hh"
 #else
 #include "params/System.hh"
 #endif
     : 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),
      * 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);
 
 
     /**
             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();
 
 
 #if FULL_SYSTEM
 #include "kern/system_events.hh"
-#include "mem/vport.hh"
 #endif
 
 class BaseCPU;
 
 #if FULL_SYSTEM
 class Platform;
+class FunctionalPort;
+class VirtualPort;
 #endif
 class GDBListener;
 class BaseRemoteGDB;
 
     /** 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;