#include "base/misc.hh"
#include "base/pollevent.hh"
#include "base/statistics.hh"
+#include "base/str.hh"
#include "base/time.hh"
#include "cpu/base_cpu.hh"
#include "cpu/full_cpu/smt.hh"
// -u to override.
bool quitOnUnreferenced = true;
+ bool python_initialized = false;
+
// Parse command-line options.
// Since most of the complex options are handled through the
// config database, we don't mess with getopts, and just parse
case 'D':
case 'U':
- case 'I':
// cpp options: record & pass to cpp. Note that these
// cannot have spaces, i.e., '-Dname=val' is OK, but
// '-D name=val' is not. I don't consider this a
cppArgs.push_back(arg_str);
break;
+ case 'I': {
+ // We push -I as an argument to cpp
+ cppArgs.push_back(arg_str);
+
+ string arg = arg_str + 2;
+ eat_white(arg);
+
+ // Send this as the python path
+ addPythonPath(arg);
+ } break;
+
+ case 'P':
+ if (!python_initialized) {
+ initPythonConfig();
+ python_initialized = true;
+ }
+ writePythonString(arg_str + 2);
+ writePythonString("\n");
+
+ case 'E':
+ if (putenv(arg_str + 2) == -1)
+ panic("putenv: %s\n", strerror(errno));
+ break;
+
case '-':
// command-line configuration parameter:
// '--<section>:<parameter>=<value>'
exit(1);
}
} else if (ext == ".py" || ext == ".mpy") {
- if (!loadPythonConfig(filename, &simConfigDB)) {
- cprintf("Error processing file %s\n", filename);
- exit(1);
+ if (!python_initialized) {
+ initPythonConfig();
+ python_initialized = true;
}
+ loadPythonConfig(filename);
}
else {
cprintf("Config file name '%s' must end in '.py' or '.ini'.\n",
}
}
+ if (python_initialized && finishPythonConfig(simConfigDB)) {
+ cprintf("Error processing python code\n");
+ exit(1);
+ }
+
// The configuration database is now complete; start processing it.
// Parse and check all non-config-hierarchy parameters.