Ist es möglich, Python-Code im Gem5-Syscall-Emulationsmodus auszuführen?

Sep 21 2020

Ich muss Python-Code in Gem5 ausführen . Als Test habe ich ein Python-Programm erstellt, hello.pydas "Hello World from Python" druckt. Ich habe hello.pymit Pyinstaller eine Binärdatei der Datei erstellt . Der Name der Binärdatei lautet hello. Als nächstes habe ich versucht, Gem5 mit dem folgenden Befehl auszuführen ./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello. Ich fatal: syscall fchmod (#91) unimplemented.erhalte jedoch die folgende Meldung und Gem5 druckt nicht die "Hallo Welt aus Python". Botschaft. Wie kann das oben genannte Problem behoben werden? Ist es möglich, Python-Code in Gem5 auszuführen? Der Gem5 druckt Folgendes im 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

Antworten

CiroSantilli Sep 21 2020 at 21:53

Sie müssen alle fehlenden erforderlichen Systemaufrufe einzeln implementieren, sobald sie getroffen werden.

Einige von ihnen sind jedoch nicht grundlegend und funktionieren mit nicht ignoreFuncimplementierten Stubs. Schauen Sie sich einfach die Syscall-Beschreibung an und versuchen Sie zu erraten, ob sie grundlegend ist oder nicht, zhttps://github.com/gem5/gem5/blob/fa70478413e4650d0058cbfe81fd5ce362101994/src/arch/arm/linux/process.cc#L179

Ich vermute, das wird nicht besonders schwer. Es ist einfach unmöglich, sicher zu sein, ohne es zu versuchen. Es hängt alles davon ab, wie viele nicht ignorierbare Systemaufrufe fehlen und wie komplex sie zu implementieren sind.

Für Java ist die Situation analog: Ausführen von Java-Programmen in gem5 (oder einer anderen Sprache, die nicht C ist)

Verbunden:

  • https://cirosantilli.com/linux-kernel-module-cheat/#python-gem5-user-mode-simulation
  • gem5 syscall emulation arm C hallo welt scheitert mit "fatal: syscall gettid (# 224) nicht implementiert"