Param<string> boot_osflags;
Param<string> readfile;
+ Param<string> symbolfile;
Param<unsigned int> init_param;
Param<uint64_t> system_type;
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
"a"),
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
+ INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
p->boot_osflags = boot_osflags;
p->init_param = init_param;
p->readfile = readfile;
+ p->symbolfile = symbolfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
AlphaPseudo::m5exit(xc->xcBase(), R16);
}}, No_OpClass, IsNonSpeculative);
0x30: initparam({{ Ra = xc->xcBase()->getCpuPtr()->system->init_param; }});
+ 0x31: loadsymbol({{
+ AlphaPseudo::loadsymbol(xc->xcBase());
+ }}, No_OpClass, IsNonSpeculative);
0x40: resetstats({{
AlphaPseudo::resetstats(xc->xcBase(), R16, R17);
}}, IsNonSpeculative);
Param<string> boot_osflags;
Param<string> readfile;
+ Param<string> symbolfile;
Param<unsigned int> init_param;
Param<uint64_t> system_type;
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
"a"),
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
+ INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
p->boot_osflags = boot_osflags;
p->init_param = init_param;
p->readfile = readfile;
+ p->symbolfile = symbolfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
Param<std::string> boot_osflags;
Param<std::string> readfile;
+ Param<std::string> symbolfile;
Param<unsigned int> init_param;
Param<uint64_t> system_type;
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
"a"),
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
+ INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10),
p->boot_osflags = boot_osflags;
p->init_param = init_param;
p->readfile = readfile;
+ p->symbolfile = symbolfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
Param<string> boot_osflags;
Param<string> readfile;
+ Param<string> symbolfile;
Param<unsigned int> init_param;
Param<uint64_t> system_type;
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
"a"),
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
+ INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 12),
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1),
p->boot_osflags = boot_osflags;
p->init_param = init_param;
p->readfile = readfile;
+ p->symbolfile = symbolfile;
p->system_type = system_type;
p->system_rev = system_rev;
p->bin = bin;
binned_fns = VectorParam.String([], "functions broken down and binned")
kernel = Param.String("file that contains the kernel code")
readfile = Param.String("", "file to read startup script from")
+ symbolfile = Param.String("", "file to get the symbols from")
class AlphaSystem(System):
type = 'AlphaSystem'
SimExit(when, "m5_exit instruction encountered");
}
+ void
+ loadsymbol(ExecContext *xc)
+ {
+ const string &filename = xc->getCpuPtr()->system->params()->symbolfile;
+ if (filename.empty()) {
+ return;
+ }
+
+ std::string buffer;
+ ifstream file(filename.c_str());
+
+ if (!file)
+ fatal("file error: Can't open symbol table file %s\n", filename);
+
+ while (!file.eof()) {
+ getline(file, buffer);
+
+ if (buffer.empty())
+ continue;
+
+ int idx = buffer.find(' ');
+ if (idx == string::npos)
+ continue;
+
+ string address = "0x" + buffer.substr(0, idx);
+ eat_white(address);
+ if (address.empty())
+ continue;
+
+ // Skip over letter and space
+ string symbol = buffer.substr(idx + 3);
+ eat_white(symbol);
+ if (symbol.empty())
+ continue;
+
+ Addr addr;
+ if (!to_number(address, addr))
+ continue;
+
+ if (!xc->getSystemPtr()->kernelSymtab->insert(addr, symbol))
+ continue;
+
+
+ DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
+ }
+ file.close();
+ }
+
void
resetstats(ExecContext *xc, Tick delay, Tick period)
{
void ivle(ExecContext *xc);
void m5exit(ExecContext *xc, Tick delay);
void m5exit_old(ExecContext *xc);
+ void loadsymbol(ExecContext *xc);
void resetstats(ExecContext *xc, Tick delay, Tick period);
void dumpstats(ExecContext *xc, Tick delay, Tick period);
void dumpresetstats(ExecContext *xc, Tick delay, Tick period);
std::string kernel_path;
std::string readfile;
+ std::string symbolfile;
};
protected:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "m5op.h"
}
}
+ if (COMPARE("readfile")) {
+ char buf[256*1024];
+ int offset = 0;
+ int len;
+
+ if (argc != 2)
+ usage();
+
+ while ((len = m5_readfile(buf, sizeof(buf), offset)) > 0) {
+ write(STDOUT_FILENO, buf, len);
+ offset += len;
+ }
+
+ return 0;
+ }
+
if (COMPARE("checkpoint")) {
switch (argc) {
case 4:
return 0;
}
+ if (COMPARE("loadsymbol")) {
+ m5_loadsymbol(arg1);
+ return 0;
+ }
+
usage();
}
#define exit_old_func 0x20 // deprectated!
#define exit_func 0x21
#define initparam_func 0x30
+#define loadsymbol_func 0x31
#define resetstats_func 0x40
#define dumpstats_func 0x41
#define dumprststats_func 0x42
#define IVLE(reg) INST(m5_op, reg, 0, ivle_func)
#define M5EXIT(reg) INST(m5_op, reg, 0, exit_func)
#define INITPARAM(reg) INST(m5_op, reg, 0, initparam_func)
+#define LOADSYMBOL(reg) INST(m5_op, reg, 0, loadsymbol_func)
#define RESET_STATS(r1, r2) INST(m5_op, r1, r2, resetstats_func)
#define DUMP_STATS(r1, r2) INST(m5_op, r1, r2, dumpstats_func)
#define DUMPRST_STATS(r1, r2) INST(m5_op, r1, r2, dumprststats_func)
RET
END(m5_initparam)
+ .align 4
+LEAF(m5_loadsymbol)
+ LOADSYMBOL(0)
+ RET
+END(m5_loadsymbol)
+
.align 4
LEAF(m5_reset_stats)
RESET_STATS(16, 17)