readfile
从 gem5 68af229490fc811aebddf68b3e2e09e63a5fa475 开始,您可以readfile
使用以下命令设置路径:
fs.py --script=myfile
与 不同writefile
,路径是相对于主机上的当前目录,而不是m5out
.
然后当您m5 readfile
在来宾中运行时,它将文件的内容输出到标准输出。
这在fs.py
脚本中执行:
if options.script is not None:
test_sys.readfile = options.script
这似乎继承自class System
,最终将配置序列化为config.ini
仅用于调试目的。
执行文件
execfile
只是一个非常轻量级的包装器readfile
,它不是将输入文件写入标准输出,而是将其写入,然后从 C 中/tmp/execfile
运行系统调用。exec
但是,从 68af229490fc811aebddf68b3e2e09e63a5fa475 开始,m5
不会:
所以你必须对客人做:
touch /tmp/execfile
chmod +x /tmp/execfile
m5 execfile
我宁愿用m5 readfile
一些脚本来做到这一点。
m5 execfile
然而,作为一个程序可能很有用init
,但我发现传递给 init 程序的参数太笨拙和不可靠。