I recently used GEM5 for simulating MIPS. I'd say as it is right now, GEM5 has a number of issues which would prevent it from running an arbitrary MIPS executable, but for my own (very specific) project goals, GEM5 worked very well. I recently wrote about it in this list, you may want to look at the archive.
I am surprised that the problems you experienced, revolved around the ISA level. In my experience, the ISA itself worked fine. It was support for features expected by the glibc that were the real problem for me. The first that had surfaced, was missing definition of tgt_iovec, and after implementing that, it turned out that glibc was getting to that writev() syscall to complain about the kernel version; ok, after fixing that, I got stuck on set_thread_area() syscall.
Fortunately for our project, we don't depend on glibc, and everything that I've tried using bare binutils, seems to work well. If more people are interested to fix Linux SE to work for glibc, we could do it together.
Boris
-----"gem5-users" <[email protected]> wrote: -----
To: gem5 users mailing list <[email protected]>
From: Murat Koksal
Sent by: "gem5-users"
Date: 06/02/2016 11:34AM
Subject: Re: [gem5-users] Problem running MIPS binaries
From: Murat Koksal
Sent by: "gem5-users"
Date: 06/02/2016 11:34AM
Subject: Re: [gem5-users] Problem running MIPS binaries
Hi Andreas,
Thanks for your response. I have two follow up questions.
- Is the MIPS implementation of gem5 not maintained?
- Do you know what compiler was used for generating the MIPS binaries provided with gem5?
- Codebench
- Debian running on QEMU (MIPS Malta architecture emulation)
- ELDK 5.6
- mipsel-linux-gcc (pre-compiled Ubuntu package)
- The hello world executable created by this one worked on gem5, however it used a syscall that was not implemented by the simulator.
- Crosstool-ng
- ELDK 4.1
- After reading this post I installed this particular version of ELDK which generated a hello world executable that ran successfully on gem5. However, when I compiled a program that was a little more complex (999.specrand), the resulting executable caused gem5 to crash with an "abort" message.
What I realized is that none of the tools above generated a binary that has the same format as the MIPS binaries provided with gem5, i.e. "MIPS-I version 1 (SYSV)". I had "MIPS-II version 1 (SYSV)", "MIPS32 version 1 (SYSV)", "MIPS-I version 1", but never a binary that had the exact same format as the executables provided with gem5. I'm guessing this is the problem. For some reason, none of the compilers I tested generated MIPS-I code when I used "-march=mips1" option (except the one which by default generated "MIPS-I version 1" binaries).
On Wed, Jun 1, 2016 at 6:36 PM, Andreas Hansson <[email protected]> wrote:
Hi Murat,
gem5’s level of support for various ISAs varies greatly, and I merely want to make sure you are aware of the trade-off. MIPS is likely to be a rather painful first experience, at least compared to ARM and X86. If you’re happy to dig in a fix things along the way that’s great. Just be prepared.
Again, it is entirely up to you, but I’d suggest to stick with ARM or X86: good support, modern tool chains, modern kernels etc.
Andreas
From: gem5-users <[email protected]> on behalf of Murat Koksal <[email protected]>
Reply-To: gem5 users mailing list <[email protected]>
Date: Tuesday, 31 May 2016 at 17:46
To: gem5-users <[email protected]>
Subject: [gem5-users] Problem running MIPS binaries
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.Hello,
I am having a problem running MIPS binaries I generated on MIPS implementation of gem5. The problem may not be necessarily caused by gem5 since I am also making use of qemu or gcc. Etiher way, I would appreciate some help. Here is what I did:
I compiled gem5.opt for MIPS, modified some configuration files (including se.py, CacheConfig.py, CpuConfig.py) and ran the provided hello world binary successfully. Then I installed the Debian wheezy image provided here on qemu to have a MIPS machine for compiling my own programs. I compiled and ran the hello world program on qemu successfully. However, when I copied the binary to the host machine and ran it on gem5, the simulator aborted with this message:
gem5.opt: build/MIPS/cpu/o3/cpu.cc:877: void FullO3CPU<Impl>::removeThread(ThreadID) [with Impl = O3CPUImpl; ThreadID = short int]: Assertion `iew.ldstQueue.getCount(tid) == 0' failed.
Running file command on the hello world binary provided with gem5 gave the following output:ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, for GNU/Linux 2.4.3, not stripped
For the binary I created on qemu, I got the following output:ELF 32-bit LSB executable, MIPS, MIPS-II version 1, statically linked, for GNU/Linux 2.6.26, BuildID[sha1]=a8d4edac71e5018a8ffb3a1a4788737e52e54f5d, not stripped
Based on above outputs, I am guessing that the one I compiled causes gem5 to crash because it uses MIPS-II instruction set instead of MIPS-I. What I don't understand is how I ended up getting an executable for MIPS-II, because I compiled the program using the command gcc -static -march=mips1 hello.c. I got the same result when I used -march=r2000 option for gcc (according to Wikipedia R2000 implements MIPS-I ISA). I am not sure if it has anything to do with the hardware I picked for emulation on qemu (Malta board). Here is the qemu command I used, just in case:
qemu-system-mipsel -nographic -M malta -kernel vmlinux-3.2.0-4-4kc-malta -hda debian_wheezy_mipsel_standard.qcow2 -append "root=/dev/sda1 console=ttyS0" -m 256
My ultimate goal is to compile Spec 2006 benchmarks for MIPS and run them on gem5. Any help is appreciated.
Thanks.
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
