From 10a906be528df1e7495a68f415833a27e8279840 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 27 Jun 2005 17:04:43 -0400 Subject: Update for console code reorganization dev/alpha_access.h: Update the ALPHA_ACCESS_VERSION move typedefs to this file since they're only used here. dev/alpha_console.cc: formatting sim/system.cc: xxm -> m5 --HG-- extra : convert_revision : 3aeca50d1385034f5a1e20dd8b0abd03bd6f26f0 --- sim/system.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sim/system.cc') diff --git a/sim/system.cc b/sim/system.cc index a51cc03bf..3ac0fdce1 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -147,7 +147,7 @@ System::System(Params *p) * Set the hardware reset parameter block system type and revision * information to Tsunami. */ - if (consoleSymtab->findAddress("xxm_rpb", addr)) { + if (consoleSymtab->findAddress("m5_rpb", addr)) { Addr paddr = vtophys(physmem, addr); char *hwrpb = (char *)physmem->dma_addr(paddr, sizeof(uint64_t)); -- cgit v1.2.3 From d172447a7ae945139d0c3465b8504cd6b77ae819 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 28 Jun 2005 01:09:13 -0400 Subject: Pass the location of the m5 console backdoor to the console instead of compiling it into the console version dev/alpha_access.h: move serialization stuff to alpha_console.hh define the ALPHA_ACCESS_BASE in m5 instead of in console.c and have m5 pass the value to the console dev/alpha_console.cc: dev/alpha_console.hh: Move serialization stuff into a derived class of AlphaAccess sim/system.cc: pass the value of ALPHA_ACCESS_BASE to the console code via the m5AlphaAccess console variable. --HG-- extra : convert_revision : 0ea4ba239f03d6dad51a6efae0385aa543064117 --- sim/system.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sim/system.cc') diff --git a/sim/system.cc b/sim/system.cc index 3ac0fdce1..c1a4c2a87 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -30,6 +30,7 @@ #include "base/loader/symtab.hh" #include "base/remote_gdb.hh" #include "cpu/exec_context.hh" +#include "dev/alpha_access.h" #include "kern/kernel_stats.hh" #include "mem/functional/memory_control.hh" #include "mem/functional/physical.hh" @@ -143,6 +144,21 @@ System::System(Params *p) strcpy(osflags, params->boot_osflags.c_str()); } + /** + * Set the m5AlphaAccess pointer in the console + */ + if (consoleSymtab->findAddress("m5AlphaAccess", addr)) { + Addr paddr = vtophys(physmem, addr); + uint64_t *m5AlphaAccess = + (uint64_t *)physmem->dma_addr(paddr, sizeof(uint64_t)); + + if (!m5AlphaAccess) + panic("could not translate m5AlphaAccess addr\n"); + + *m5AlphaAccess = htoa(ALPHA_ACCESS_BASE); + } else + panic("could not find m5AlphaAccess\n"); + /** * Set the hardware reset parameter block system type and revision * information to Tsunami. -- cgit v1.2.3 From 036a8ceb8da8aff10b819b4aab32584d41282a64 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 28 Jun 2005 12:42:15 -0400 Subject: Don't hard code the location of m5AlphaAccess. Instead, move the code into a function that can be called by the AlphaConsole class. AlphaConsole will pass in its address. arch/alpha/ev5.hh: Move Phys2K0Seg to ev5.hh and fixup the TSUNAMI uncacheable bits so that they will be converted correctly. dev/alpha_access.h: Do not hard code the location of the AlphaConsole dev/alpha_console.cc: fixup #includes tell the system where the alpha console is sim/system.hh: Provide a function that will tell the system where the AlphaAccess structure (device) lives --HG-- extra : convert_revision : 92d70ca926151a32eebe9925de597459ac58013e --- sim/system.cc | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'sim/system.cc') diff --git a/sim/system.cc b/sim/system.cc index c1a4c2a87..8397b8e01 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -30,7 +30,6 @@ #include "base/loader/symtab.hh" #include "base/remote_gdb.hh" #include "cpu/exec_context.hh" -#include "dev/alpha_access.h" #include "kern/kernel_stats.hh" #include "mem/functional/memory_control.hh" #include "mem/functional/physical.hh" @@ -144,21 +143,6 @@ System::System(Params *p) strcpy(osflags, params->boot_osflags.c_str()); } - /** - * Set the m5AlphaAccess pointer in the console - */ - if (consoleSymtab->findAddress("m5AlphaAccess", addr)) { - Addr paddr = vtophys(physmem, addr); - uint64_t *m5AlphaAccess = - (uint64_t *)physmem->dma_addr(paddr, sizeof(uint64_t)); - - if (!m5AlphaAccess) - panic("could not translate m5AlphaAccess addr\n"); - - *m5AlphaAccess = htoa(ALPHA_ACCESS_BASE); - } else - panic("could not find m5AlphaAccess\n"); - /** * Set the hardware reset parameter block system type and revision * information to Tsunami. @@ -196,6 +180,23 @@ System::~System() #endif } +void +System::setAlphaAccess(Addr access) +{ + Addr addr = 0; + if (consoleSymtab->findAddress("m5AlphaAccess", addr)) { + Addr paddr = vtophys(physmem, addr); + uint64_t *m5AlphaAccess = + (uint64_t *)physmem->dma_addr(paddr, sizeof(uint64_t)); + + if (!m5AlphaAccess) + panic("could not translate m5AlphaAccess addr\n"); + + *m5AlphaAccess = htoa(EV5::Phys2K0Seg(access)); + } else + panic("could not find m5AlphaAccess\n"); +} + bool System::breakpoint() { -- cgit v1.2.3 From 8a0bc840221cf7af4845f4ee44de11bc7271ff10 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 29 Jun 2005 01:20:41 -0400 Subject: Allow CPUs to specify their own CPU ids. Make the AlphaConsole calculate the number of CPUs instead of passing that in as a parameter. cpu/base.cc: pass the desired cpu_id into registerExecContext, offsetting it by the thread number. a cpu_id of -1 means that it should be generated for you. cpu/base.hh: Take the cpu_id as a parameter cpu/o3/alpha_cpu_builder.cc: cpu/simple/cpu.cc: Accept the cpu_id as a parameter while we're here, let's remove the multiplier since it is not used. dev/alpha_console.cc: don't take the number of CPUs as a parameter. Calculate it from the system based on the number of CPUs that have been registered. move init() code to startup() to ensure that all CPUs are registerd. dev/alpha_console.hh: python/m5/objects/AlphaConsole.py: don't take the number of CPUs as a parameter. move init() code to startup() to ensure that all CPUs are registerd. python/m5/objects/BaseCPU.py: take the cpu_id as a parameter. Default it to -1 which means that it will be generated. sim/system.cc: allow the registerExecContext functioin to take a desired cpu_id as a parameter. Check to ensure that the id isn't already used. Accept -1 as a request to have an id assigned. sim/system.hh: keep track of the number of registered exec contexts. provide a function for accessing the number of exec contexts that checks to ensure that they are all registered correctly. --HG-- extra : convert_revision : 8e12f96ff8a49fa16cdbbdb4c05c651376c35788 --- sim/system.cc | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'sim/system.cc') diff --git a/sim/system.cc b/sim/system.cc index 8397b8e01..6f7d53f6b 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -46,7 +46,7 @@ int System::numSystemsRunning = 0; System::System(Params *p) : SimObject(p->name), memctrl(p->memctrl), physmem(p->physmem), - init_param(p->init_param), params(p) + init_param(p->init_param), numcpus(0), params(p) { // add self to global system list systemList.push_back(this); @@ -204,13 +204,26 @@ System::breakpoint() } int -System::registerExecContext(ExecContext *xc) +System::registerExecContext(ExecContext *xc, int id) { - int xcIndex = execContexts.size(); - execContexts.push_back(xc); + if (id == -1) { + for (id = 0; id < execContexts.size(); id++) { + if (!execContexts[id]) + break; + } + } + + if (execContexts.size() <= id) + execContexts.resize(id + 1); + + if (execContexts[id]) + panic("Cannot have two CPUs with the same id (%d)\n", id); + + execContexts[id] = xc; + numcpus++; RemoteGDB *rgdb = new RemoteGDB(this, xc); - GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex); + GDBListener *gdbl = new GDBListener(rgdb, 7000 + id); gdbl->listen(); /** * Uncommenting this line waits for a remote debugger to connect @@ -218,13 +231,13 @@ System::registerExecContext(ExecContext *xc) */ //gdbl->accept(); - if (remoteGDB.size() <= xcIndex) { - remoteGDB.resize(xcIndex+1); + if (remoteGDB.size() <= id) { + remoteGDB.resize(id + 1); } - remoteGDB[xcIndex] = rgdb; + remoteGDB[id] = rgdb; - return xcIndex; + return id; } void @@ -238,15 +251,15 @@ System::startup() } void -System::replaceExecContext(ExecContext *xc, int xcIndex) +System::replaceExecContext(ExecContext *xc, int id) { - if (xcIndex >= execContexts.size()) { - panic("replaceExecContext: bad xcIndex, %d >= %d\n", - xcIndex, execContexts.size()); + if (id >= execContexts.size()) { + panic("replaceExecContext: bad id, %d >= %d\n", + id, execContexts.size()); } - execContexts[xcIndex] = xc; - remoteGDB[xcIndex]->replaceExecContext(xc); + execContexts[id] = xc; + remoteGDB[id]->replaceExecContext(xc); } void -- cgit v1.2.3 From ec1f689d0db9e1839e1b5a8f67f12d19f56c85e3 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 29 Jun 2005 22:20:38 -0400 Subject: Easier remote debugging at boot time. sim/system.cc: Add a global variable that will tell the remote debugger to wait when a given CPU is is registered. --HG-- extra : convert_revision : a093c9331daa675d4b59a321e53a5da6ea292c40 --- sim/system.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sim/system.cc') diff --git a/sim/system.cc b/sim/system.cc index 6f7d53f6b..47ffc4b01 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -203,6 +203,8 @@ System::breakpoint() return remoteGDB[0]->trap(ALPHA_KENTRY_INT); } +int rgdb_wait = -1; + int System::registerExecContext(ExecContext *xc, int id) { @@ -229,7 +231,8 @@ System::registerExecContext(ExecContext *xc, int id) * Uncommenting this line waits for a remote debugger to connect * to the simulator before continuing. */ - //gdbl->accept(); + if (rgdb_wait != -1 && rgdb_wait == id) + gdbl->accept(); if (remoteGDB.size() <= id) { remoteGDB.resize(id + 1); -- cgit v1.2.3