Est-il possible d'exécuter du code Python en mode d'émulation d'appel système Gem5?

Sep 21 2020

J'ai besoin d'exécuter du code Python dans Gem5 . En guise de test, j'ai créé un programme Python appelé hello.py"Hello World from Python". J'ai créé un binaire du hello.pyfichier en utilisant Pyinstaller . Le nom du fichier binaire est hello. Ensuite, j'ai essayé d'exécuter Gem5 en utilisant la commande suivante ./build/X86/gem5.opt --debug-flags=DRAM --debug-file=gem5-helloworld.out ./configs/example/se.py -c ./tests/test-progs/myFile/hello. Cependant, je reçois le message suivant fatal: syscall fchmod (#91) unimplemented.et Gem5 n'imprime pas le "Hello World from Python". message. Comment résoudre le problème ci-dessus? Est-il possible d'exécuter du code Python dans Gem5? La Gem5 imprime ce qui suit dans le 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

Réponses

CiroSantilli Sep 21 2020 at 21:53

Vous devez implémenter tous les appels système requis manquants un par un lorsqu'ils sont atteints.

Certains d'entre eux ne sont cependant pas fondamentaux et fonctionneront avec des ignoreFuncstubs non implémentés, jetez simplement un coup d'œil à la description de l'appel système et essayez de deviner si elle est fondamentale ou non, par exemplehttps://github.com/gem5/gem5/blob/fa70478413e4650d0058cbfe81fd5ce362101994/src/arch/arm/linux/process.cc#L179

Je soupçonne que ce ne sera pas très difficile. Il est tout simplement impossible d'être sûr sans essayer, tout dépend du nombre d'appels système non ignorables manquants et de la complexité de leur implémentation.

La situation est analogue pour Java: exécuter des programmes Java dans gem5 (ou tout autre langage qui n'est pas C)

En relation:

  • https://cirosantilli.com/linux-kernel-module-cheat/#python-gem5-user-mode-simulation
  • gem5 syscall emulation arm C hello world échoue avec "fatal: syscall gettid (# 224) unimplemented"