在Gem5完整系统仿真x86上使用Gentoo linux编译和运行C程序

时间:2019-05-28 19:50:00

标签: qemu gentoo gem5

我已经成功为x86运行gem5完整系统仿真。我按如下方式安装了映像:

sudo mount -o loop,offset=32256 linux-x86.img tempdisk

并在其中复制一个hello world程序。然后,我运行了模拟。 Linux成功启动。我使用telnet签入了模拟系统。我能够编译通过模拟系统放入映像磁盘中的hello world源代码,并且该源代码也成功运行。

然后,对另一个C源文件重复相同的操作。该源代码需要以下标头,并且出现此错误:

  error: x86intrin.h: No such file or directory

我尝试安装其他版本的gcc。我尝试了以下操作来添加Google公共DNS以运行apt-get:

echo "nameserver 8.8.8.8" > /etc/resolv.conf  
apt-get update

但是,apt-get命令不起作用。我发现gem5网站上为x86提供的Linux映像不是Ubuntu,而是以下发行版:

  

Gentoo基本系统版本1.12.11.1

因此,我使用了emerge命令来升级和安装其他版本的gcc,但是它也无法正常工作。

    (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 '='?)

最终,我想在gem5完整系统上运行侧通道攻击,例如spectre。这些代码使用需要rdtscp标头的clflushx86intrin.h之类的指令。
还有另一种方法可以在gem5完整系统仿真上运行我的代码吗? 我遵循针对x86解释的here步骤,但这些步骤主要针对Arm和Ubuntu。尝试将它们用于x86会使我遇到上述错误。

0 个答案:

没有答案