There are many possible errors and workarounds scattered in may different places, can anyone provide at least one detailed working setup, with exact gem5 and compiler versions, hopefully on Ubuntu?
相关问题
- When building gem5.opt, I get 'ImportError: no
- Writing gem5 configuration scripts with Pycharm
- How can gem5 se mode execute a program with operat
- How to modify a file under src/python and run it w
- Why doesn't the Linux kernel see the cache siz
相关文章
- How to modify a file under src/python and run it w
- Why doesn't the Linux kernel see the cache siz
- UART communication in Gem5 with ARM Bare-metal
- How to count the number of CPU clock cycles betwee
- 如何建立gem5了树?(How to build gem5 out of tree?)
- How to enable ARM semihosting in gem5?
- How to build gem5 out of tree?
- How to do port forwarding from guest to host and v
Minimal working Ubuntu setup
As of gem5 8162e0da0285d346046151b2a45ceeb1baf63b8f Oct 2018, a C hello world for all of x86, arm and aarch64 just works on both Ubuntu 16.04 and 18.04. x86 was working previously, but that commit finalized some required arm changes to make the glibc int code run before
main
work properly.Given that gem5 version and one of those Ubuntu versions, you can run the following C program:
main.c
simply as:
and in all cases produces the correct output:
-static
is required on ARM as mentioned at: How to run a dynamically linked executable syscall emulation mode se.py in gem5?If anyone finds a setup at a newer gem5 revision or Ubuntu version for which such minimal C program does not execute correctly in one of the previously mentioned arches, please send an email describing your system setup in detail to the mailing list and CC me.
Missing syscalls
Then of course, as you try to run more complex userland programs, you will inevitably meet unimplemented syscalls, as there are many of those.
Please don't report those as bugs unless they appear on the glibc setup code for a minimal C example, since we already have a list of the missing syscalls on the source code itself.
Rather, don't be put off, and try a patch!
Many of the syscalls are trivial to implement, see for example 8162e0da0285d346046151b2a45ceeb1baf63b8f.
Only then, if you have tried a patch, but failed, start pinging people on the mailing list and asking for guidance on how to make your patch work.
Multi-threading
TODO this is a known major pain point. I don't know what the status is, but I've heard it is flaky.
Recent fixes that made ARM work
As things inevitably break again, you might be able to take some inspiration from the following fixes that we have done, and possibly patch the problem yourself:
FATAL: kernel too old
: How to solve "FATAL: kernel too old" when running gem5 in syscall emulation SE mode? Fixed by: 260b0fc5381a47c681e7ead8e4f13aad45069665openat
unimplemented. The glibc ARM startup code on Ubuntu 18.04 started using it, which broke the hello world. Fixed by: 8162e0da0285d346046151b2a45ceeb1baf63b8fpanic: Attempted to execute unimplemented instruction 'mrs'
. Fixed by: 6efe7e1abf9d289859eb23b52b3a319f15f2736acrosstool-NG
Using crosstool-NG to enable ulibc instead of glibc can sometimes serve as a workaround for glibc init code, since ulibc is more minimal an exercises less code than glibc. It is not ideal, but might work if you really can't manage to patch gem5. Described at: How to solve "FATAL: kernel too old" when running gem5 in syscall emulation SE mode?