在gem5的full system下运行 alpha编译的测试程序 running gem5 on ubuntu in full system mode in alpha
背景
先需要在full system下运行gem5,通过网上查找资料以及向别人请教,终于成功运行,网上大多是关于alpha指令集的,且都是英文的,为了方便大家学习,现在总结一下,希望对大家有所帮助。
首先需要安装gem5-stable,可以参考我前面的一篇博客:
http://blog.csdn.net/wyj7260/article/details/8267345
首先做一下声明,关于ubuntu的版本:ubuntu的版本没有明确的要求,我在分别在ubuntu的10.04,11.04,以及12.10上安装成功。gem5版本也没有
特别的要求,我用的是gem5-stable_2012_02_02,如果是初次接触的话,最好选用新的版本,因为听实验室师兄说,gem5现在关注的人逐渐增多
,最近一段时间gem5对alpha的支持基本没有新的更新,但是对x86的支持越来越好,而且gem5的新版本代码书写比较规范。
这篇文章介绍full system in alpha。
安装过程:
下载full system需要的两个包:
首先在安装好gem5-stable之后,再到官网下载full system需要的包:
Full System Files : http://www.m5sim.org/dist/current/m5_system_2.0b3.tar.bz2
linux-dist : http://www.m5sim.org/dist/current/linux-dist.tgz
安装:记我的gem5-stable安装目录为$GEM
a) ~/gem5-stable$ mkdir dist
b) 将包m5_system_2.03.tar.bz2 复制到dist目录下
b) ~/gem5-stable$ cd dist/
c) ~/gem5-stable/dist$ tar -xvf m5_system_2.03.tar.bz2
d) ~/gem5-stable/dist$ cd m5_system_2.0b3/
f) ~/gem5-stable/dist/m5_system_2.0b3$ mv./binaries/ ../binaries
g) ~/gem5-stable/dist/m5_system_2.0b3$ mv./disks/ ../disks
h) ~/gem5-stable/dist$ rm -rfm5_system_2.0b3
i)修改$GEM5/config/common/SysPath.py 文件:
把exceptKeyError:
path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system
修改成
except KeyError:
path = [ '/dist/m5/system', ' /home/wyj2/gem5-stable/dist' ]
运行
1、 首先编译gem5.opt
~/gem5-stable $ scons ./build/ALPHA/gem5.opt
可以通过 $GEM5/m5out/system.terminal查看启动linux内核的monitor进程。
2、运行模拟的linux系统
./build/ALPHA/gem5.opt ./configs/example/fs.py
将看到如下界面
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jul 13 2013 15:50:46
gem5 started Jul 13 2013 15:53:18
gem5 executing on jsi-desktop
command line: ./build/ALPHA/gem5.opt ./configs/example/fs.py
Global frequency set at 1000000000000 ticks per second
info: kernel located at: /home/wyj2/gem5-stable/dist/binaries/vmlinux
Listening for system connection on port 3456
0: system.tsunami.io.rtc:Real-time clock set to Thu Jan 100:00:00 2009
warn: CoherentBus system.membus has no snooping ports attached!
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
warn: Prefetch instructions in Alpha do not do anything
warn: Prefetch instructions in Alpha do not do anything
3、开启另外一个ssh界面,使用M5Term来与simulatedsystem进行交互
~/gem5-stable$cd ./util/term
~/gem5-stable$make
~/gem5-stable$sudomake install
~/gem5-stable$m5termlocalhost 3456
4、这样就进入了模拟出来的系统:
#ls后就看到如下:
# ls
benchmarks etc linuxrc modules sys var
bin iscsi lost+found proc tmp
dev lib mnt sbin usr
5、在模拟系统中运行一个测试程序试试:
#cd benchmarks
#ls
将看到如下几个测试程序:
aio-bench netperf-bin surge
micros pthread_mutex_test
#./pthread_mutex_test2 2
运行结果如下:
Using 2 threadsfor 2 iters
Counter value is 4
#
如何将程序mount进模拟的系统
现在以将$GEM/tests/test-progs/hello/bin/alpha/linux/hello,mount进模拟的系统为例,讲述如何将编译好的程序mount进被模拟的系统。
1、将hello文件拷贝到当前路径/gem5-stable$ cp./tests/test-progs/hello/bin/alpha/linux/hello ./hello
2、~/gem5-stable$ sudomount -o,loop,offset=32256 ./dist/disks/linux-latest.img /mnt
关于偏移量32256请参考链接:http://my.oschina.net/toyandong/blog/65002
3、显示一下/mnt,可以看到挂载好的操作系统
~/gem5-stable$ ls/mnt
benchmarks dev iscsi linuxrc mnt proc sys usr
bin etc lib lost+found modules sbin tmp var
4、 在使用linux的image文件之前,应该执行umount操作。
~/gem5-stable$ sudo umount /mnt
5、 重新开启模拟的linux,进入模拟的linux (参考本文 “运行” 中的2和3)
#ls
可以看到我们添加的testGem5目录
benchmarks etc linuxrc modules sys usr
bin iscsi lost+found proc testGem5 var
dev lib mnt sbin tmp
6、#cd testGem5
#./hello
执行结果:
Hello world!
#
参考链接:
http://www.m5sim.org/Running_M5_in_Full-System_Mode
http://novel.ict.ac.cn/qguo/pdf/gem5.pdf
http://gem5.org/dist/tutorials/hipeac2012/gem5_hipeac.pdf
以及参考师兄的ppt
在gem5的full system下运行 alpha编译的测试程序 running gem5 on ubuntu in full system mode in alpha的更多相关文章
- 在gem5的full system下运行 x86编译的测试程序 running gem5 on ubuntu in full system mode in x86
背景 上篇博客写了如何在gem5的full system模式运行alpha的指令编译的程序,这篇博客讲述如何在gem5的full system模式运行x86指令集编译的程序,这两种方式非常类似. 首先 ...
- Gem5全系统模式下运行SPLASH-2 Benchmarks使用alpha ISA
Steps to run the SPLASH-2 Benchmarks on M5 in full system mode using the alpha ISA. This Guide is ai ...
- ASP.NET CORE下运行CMD命令
ASP.NET CORE下运行CMD命令,用以前的ASP.NET 的命令System.Diagnostics.Process.Start("notepad");这样是可以运行出记事 ...
- JAVA手记 JAVA入门(安装+Dos下运行)
JAVA入门特供= =,今天设置环境变量后用dos运行的时候发现出现“找不到或无法加载主类”,索性查了些资料重新看了看JAVA入门的部分. 声明:我的笔记本暂时用的是Win10系统,Windows其他 ...
- Windows 下使用 GNUstep 编译并运行 Objective-C 程序
今晚上开始看<Objective-C 程序设计(第4版)>这本书(OSChina 正在做此书的书评活动,详情请看这里),到现在为止看到第 7 章,于是想动手试试写两简单的程序编译跑跑看. ...
- JAVA设置环境变量和在DOS下运行java程序
在学校实训的这几天,老师带着我们开始深入的复习java.这是第一天的内容哦 对于“JAVA设置环境变量和在DOS下运行java程序”,许多初学者是陌生的,但了解这个却对后期的学习很重要. http:/ ...
- Unity怎样在Editor下运行协程(coroutine)
在处理Unity5新的AssetBundle的时候,我有一个需求,须要在Editor下(比方一个menuitem的处理函数中,游戏没有执行.也没有MonoBehaviour)载入AssetBundle ...
- Demo+在Linux下运行(CentOS7+dotnetcore sdk)
来份ASP.NET Core尝尝 0x01.前言 学习ASP.NET Core也有一段时间了,虽说很多内容知识点还是处于一知半解的状态,但是基本的,还是 略懂一二.如果有错误,还望见谅. 本文还是和之 ...
- OpenCV探索之路(二十一)如何生成能在无opencv环境下运行的exe
我们经常遇到这样的需求:我们在VS写好的程序,需要在一个没有装opencv甚至没有装vs的电脑下运行,跑出效果.比如,你在你的电脑用opencv+vs2015写出一个程序,然后老师叫你把程序发给他,他 ...
随机推荐
- C# WinForm 和 javascript进行交互 使用HTML做界面
01 using System; 02 using System.Collections.Generic; 03 using System.Text; 04 using System.Reflecti ...
- TIA Portal V12不能添加新的CPU
4核AMD 740,10G内存,Win7 X64,打开TIA Portal V12,依旧慢如牛,鼠标指针转啊转,TIA窗口写着 无响应... 真没志气,STM32要是玩转了,坚决不用这老牛. 上图为正 ...
- EasyUI - Tree 树组件
效果: 数据库设计: 使用的数据: 其中的字段,是跟据要生成的树节点的属性定义的. text:代表要显示的字段名称. state:是否是目录节点. iconCls:节点的图标是什么. url:跳转的链 ...
- linux命令:find
先上例子: find ./*_src -type f | xargs grep -ils "date" 在指定的那些文件夹下面,递归寻找包含“date” 字符串的普通文件. fin ...
- Swift - 通过url地址打开web页面
通过UIApplication.sharedApplication().openURL()方法,可以使用浏览器打开相应的网页. 1 2 3 var urlString = "http://h ...
- FFMPEG H264/H265 编码延迟问题
最新使用FFmpeg进行H264的编码时,发现视频编码有延迟,不是实时编码.进过一番研究发现,仅仅要在调用avcodec_open2函数 打开编码器时,设置AVDictionary參数就可以.关键代码 ...
- AFNetwork学习(二)——GET/POST请求
为了学习AFNetwork,自己搭建整理了一下AFNetwork向后台发送请求和后台返回json数据的整个处理过程.利用Struts2搭建了一个后台,提供Action并返回json数据 环境:Xcod ...
- php 跳转控制
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Swift - 启动时的向导页(新手引导)的制作
在很多iOS产品或者一些应用版本的升级中,新手指导都是一个常用的功能,通过说明页的左右滑动,可以很清晰的展示系统的一些功能特性.制作思路如下: 1,如何检测应用是第一次登陆启动 我们可以使用NSUse ...
- 【deep learning学习笔记】注释yusugomori的LR代码 --- LogisticRegression.h
继续看yusugomori的代码,看逻辑回归.在DBN(Deep Blief Network)中,下面几层是RBM,最上层就是LR了.关于回归.二类回归.以及逻辑回归,资料就是前面转的几篇.套路就是设 ...