2

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
Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
Beautiful Mind
  • 5,828
  • 4
  • 23
  • 42

1 Answers1

0

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

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.

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

Related:

Ciro Santilli
  • 3,693
  • 1
  • 18
  • 44
  • Thank you for your reply. How to implement missing syscalls? Could you please provide me an example? – Beautiful Mind Sep 22 '20 at 00:00
  • @BeautifulMind have a look at the source code line code I've linked to, that has the definition of all existing syscalls. Just copy what the others are doing, it should be easy to understand. Also setup Eclipse: https://stackoverflow.com/questions/61656709/how-to-setup-eclipse-ide-for-gem5-development/61656710#61656710 – Ciro Santilli Sep 22 '20 at 06:16