ubuntu 12.04 LTS 安装可调试bochs 2.6

来源:互联网 发布:电魂网络怎么样 编辑:程序博客网 时间:2024/05/16 04:44
最近一直在看于渊的<<ORANGE'S 一个操作系统的实现>>对于环境的搭配十分困扰。经过不停得测试实验最后终于成功,现将心得分享,也为以后自己再次搭配留下资料。

___________________________________________________
如果有任何问题,请重启后再次尝试,不要轻易放弃。可以设置
snapshot还原点达到备份和快速启动的效果
1.首先安装ubuntu12.04(官网下32位),vmware安装后,下载bochs2.6(最新版),注意linux下的文档应该是bochs-2.6.tar.gz.
2.接下来搭配GUI $sudo apt-get install xorg-dev
3.然后是$sudo apt-get install libgtk2.0-dev
4.cpp g++ gcc 编译环境也是必不可少的$sudo apt-get install gcc cpp g++
5.解压缩$bochs 2.6.tar.gz tar vxzf bochs-2.6.tar.gz
6. 进入bochs 2.6文件夹后 $./configure --enable-debugger --enable-disasm(安装dubugger调试和反汇编)
7.$sudo make (不用make不是root会报权限错误)
8.接下来$sudo make install
如果没什么错就安装完成了,接下来哦就是配置启动文件了,由于《一个操作系统的实现》是旧版本,所以我们需要修改配置的一些设置
romimage: file=usr/share/bochs/BIOS-bochs-latest 改为 romimage: file=/usr
/local/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/vgabios/vgabios.bin改为vgaromimage: file=/usr/local/share/bochs/VGABIOS-lgpl-latest
同理在最后哪一行的鼠标设置中也添加/local这个路径
————————————————————————————
接下来就是启动了,$bochs -f bochsrc
Please choose one[6]:$6
直接c便可看到效果
如果要调试请按此下步骤

*********************************************************************************
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] using log file bochsout.txt
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f0
<bochs:1> b 0x7c00
<bochs:2> c
(0) Breakpoint 1, 0x00007c00 in ?? ()
Next at t=12943100
(0) [0x0000000000007c00] 0000:7c00 (unk. ctxt): mov ax, cs ; 8cc8

<bochs:3> info cpu
eax: 0x0000aa55 43605
ecx: 0x00090000 589824
edx: 0x00000000 0
ebx: 0x00000000 0
esp: 0x0000ffd6 65494
ebp: 0x00000000 0
esi: 0x000e34e0 931040
edi: 0x0000ffac 65452
eip: 0x00007c00
eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
status word: 0x0000: b c3 TOS0 c2 c1 c0 es sf pe ue oe ze de ie
control word: 0x0040: inf RC_NEAREST PC_32 pm um om zm dm im
tag word: 0x5555
operand: 0x0000
fip: 0x00000000
fcs: 0x0000
fdp: 0x00000000
fds: 0x0000
=>FP0 ST0(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP1 ST1(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP2 ST2(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP3 ST3(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP4 ST4(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP5 ST5(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP6 ST6(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
FP7 ST7(0): raw 0x0000:0000000000000000 (0.0000000000) (ZERO)
MXCSR: 0x00001f80: ule fuz RC:0 PM UM OM ZM DM IM daz pe ue oe ze de ie
XMM[00]: 00000000:00000000:00000000:00000000
XMM[01]: 00000000:00000000:00000000:00000000
XMM[02]: 00000000:00000000:00000000:00000000
XMM[03]: 00000000:00000000:00000000:00000000
XMM[04]: 00000000:00000000:00000000:00000000
XMM[05]: 00000000:00000000:00000000:00000000
XMM[06]: 00000000:00000000:00000000:00000000
XMM[07]: 00000000:00000000:00000000:00000000

<bochs:4> x /64xb 0x7c00
[bochs]:
0x00007c00 <bogus+ 0>: 0x8c 0xc8 0x8e 0xd8 0x8e 0xc0 0xe8 0x02
0x00007c08 <bogus+ 8>: 0x00 0xeb 0xfe 0xb8 0x1e 0x7c 0x89 0xc5
0x00007c10 <bogus+ 16>: 0xb9 0x10 0x00 0xb8 0x01 0x13 0xbb 0x0c
0x00007c18 <bogus+ 24>: 0x00 0xb2 0x00 0xcd 0x10 0xc3 0x48 0x65
0x00007c20 <bogus+ 32>: 0x6c 0x6c 0x6f 0x2c 0x20 0x4f 0x53 0x20
0x00007c28 <bogus+ 40>: 0x77 0x6f 0x72 0x6c 0x64 0x21 0x00 0x00
0x00007c30 <bogus+ 48>: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00007c38 <bogus+ 56>: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

<bochs:5> n
Next at t=12943101
(0) [0x0000000000007c02] 0000:7c02 (unk. ctxt): mov ds, ax ; 8ed8


<bochs:6> trace-reg on
Register-Tracing enabled for CPU0
<bochs:7> n
Next at t=12943102
eax: 0x00000000 0
ecx: 0x00090000 589824
edx: 0x00000000 0
ebx: 0x00000000 0
esp: 0x0000ffd6 65494
ebp: 0x00000000 0
esi: 0x000e34e0 931040
edi: 0x0000ffac 65452
eip: 0x00007c04
eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
(0) [0x0000000000007c04] 0000:7c04 (unk. ctxt): mov es, ax ; 8ec0

<bochs:8> c

可以看到Hello OS World!

转载自:http://blog.csdn.net/arthasmingjing/article/details/8740627

原创粉丝点击