是否可以在 Gem5 系统调用仿真模式下运行 Python 代码? [英] Is it possible to run Python code in Gem5 syscall emulation mode?

查看:96
本文介绍了是否可以在 Gem5 系统调用仿真模式下运行 Python 代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Gem5 中运行一些 Python 代码.作为测试,我创建了一个名为 hello.py 的 Python 程序,它打印Hello World from Python".我使用 Pyinstaller 创建了 hello.py 文件的二进制文件.二进制文件名为 hello.接下来,我尝试使用以下命令运行 Gem5 ./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello.但是,我收到以下消息 fatal: syscall fchmod (#91) unimplemented. 并且 Gem5 没有打印Hello World from Python".信息.如何解决上述问题?是否可以在 Gem5 中运行 Python 代码?Gem5 正在终端中打印以下内容.

I need to run some Python code inside Gem5. As a test, I have created a Python program called hello.py it prints "Hello World from Python." I created a binary of the hello.py file by using Pyinstaller. The binary file name is hello. Next, I have tried to run Gem5 by using the following command ./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello. However, I am getting the following message fatal: syscall fchmod (#91) unimplemented. and Gem5 is not printing the "Hello World from Python." message. How to resolve the above issue? Is it possible to run Python code inside Gem5? The Gem5 is printing the following in the terminal.

./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello

warn: CheckedInt already exists in allParams. This may be caused by the Python 2.7 compatibility layer.
warn: Enum already exists in allParams. This may be caused by the Python 2.7 compatibility layer.
warn: ScopedEnum already exists in allParams. This may be caused by the Python 2.7 compatibility layer.
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 version 20.0.0.3
gem5 compiled Aug  5 2020 12:06:57
gem5 started Sep 21 2020 16:31:18
gem5 executing on LAPWF05588, pid 248502
command line: ./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello

Global frequency set at 1000000000000 ticks per second
warn: No dot file generated. Please install pydot to generate the dot file and pdf.
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0.  Starting simulation...
warn: ignoring syscall access(...)
info: Increasing stack size by one page.
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
warn: ignoring syscall mprotect(...)
info: Increasing stack size by one page.
info: Increasing stack size by one page.
info: Increasing stack size by one page.
info: Increasing stack size by one page.
info: Increasing stack size by one page.
info: Increasing stack size by one page.
info: Increasing stack size by one page.
warn: MOVNTDQ: Ignoring non-temporal hint, modeling as cacheable!
fatal: syscall fchmod (#91) unimplemented.
Memory Usage: 688628 KBytes

推荐答案

您必须在遇到所有缺失的必需系统调用时一一实现.

You have to implement all missing required syscalls one by one as they are hit.

然而,其中一些不是基本的,并且可以与 ignoreFunc 未实现的存根一起使用,只需快速查看系统调用描述并尝试猜测它是否是基本的,例如https://github.com/gem5/gem5/blob/fa70478413e4650d0058cbfe81fd5ce362101994/src/arch/arm/linux/process.cc#L179

Some of them however are not fundamental, and will work with ignoreFunc unimplemented stubs, just have a quick look at the syscall description and try to guess if it is fundamental or not, e.g. https://github.com/gem5/gem5/blob/fa70478413e4650d0058cbfe81fd5ce362101994/src/arch/arm/linux/process.cc#L179

我怀疑这不会太难.不尝试就无法确定,这完全取决于缺少多少不可忽略的系统调用以及它们实现的复杂程度.

I suspect this won't be super hard. It's just impossible to be sure without trying, it all depends on how many non-ignorable syscalls are missing and how complex they are to implement.

Java 的情况类似:在 gem5(或任何非 C 语言)中运行 Java 程序

The situation is analogous for Java: Running Java programs in gem5(or any language which is not C)

相关:

这篇关于是否可以在 Gem5 系统调用仿真模式下运行 Python 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆