This may be a silly question, but i\'m learning about gem5 recently and i\'m being able to simulate my C programs using this software, in syscall emulation and in full system si
You execute Java programs exactly the same way you execute C programs:
Here are a couple of possibilities I can think of:
It is, of course, possible to chain and/or mix any number of the above.
Similar post: Is it possible to run java -jar on gem5 simulator with ISA x86?
A full system Ubuntu image will almost certainly work (pre-install Java with QEMU user mode before running gem5).
X86 syscall emulation could in theory just work, the command line would be something like:
build/X86/gem5.opt \
configs/example/se.py \
--cmd /usr/bin/java \
--options HelloWorld \
--param 'system.cpu[0].workload[:].release = "5.2.1"' \
where /usr/bin/java
is the Java interpreter ELF executable just like your C program, and HelloWorld.class
is the compiled Java class passed as an argument to java
.
However, I tried this on Ubuntu 18.04 and gem5 61005bb9ef455b2ac851f8a992f2cec5686e520f and it failed with:
/usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
I'm not sure why that was the case, it would require further investigation.
Analogous for Python: Is it possible to run Python code in Gem5 syscall emulation mode?