I have run gem5 full system simulation for x86 successfully. I mounted the image as follows:
sudo mount -o loop,offset=32256 linux-x86.img tempdisk
and copied a hello world program in there. I then ran the simulation. Linux booted successfully. I used telnet to check into the simulated system. I was able to compile the hello world source code that I had put in the image disk through the simulated system and it run successfully, too.
Then I repeated the same for another C source file I had. That source code needs the following header and I get this error:
error: x86intrin.h: No such file or directory
I tried to install other versions of gcc. I tried the following to add Google public DNS to run apt-get:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
apt-get update
However, the apt-get
command doesn't work. I found out that the Linux image that was provided in gem5 website for x86 was not an Ubuntu but the following distribution:
Gentoo Base System release 1.12.11.1
Therefore I used emerge
command to upgrade and install other versions of gcc but it didn't work also.
(none) / # emerge gcc-4.8
emerge gcc-4.8
!!! /etc/make.profile is not a symlink and will probably prevent most merges.
!!! It should point into a profile within /usr/portage/profiles/
!!! (You can safely ignore this message when syncing. It's harmless.)
Calculating dependencies -
!!! 'gcc-4.8' is not a valid package atom.
!!! Please check ebuild(5) for full details.
!!! (Did you specify a version but forget to prefix with '='?)
Ultimately, I want to run side channel attacks such as spectre
on gem5 full system. Those codes use instructions such as rdtscp
and clflush
that require x86intrin.h
header.
Is there another way to run my code on gem5 full system simulation?
I followed the steps explained here for x86 but those were mainly for Arm and Ubuntu. Trying them for x86 took me to the above errors.