---- 整理自狄泰软件唐佐林老师课程
专业模拟x86架构的虚拟机
开源且高度可移植,由C++编写完成
支持操作系统开发过程中的断点调试
通过简单配置就能运行绝大多数主流的操作系统
cd bochs-2.4.5
./configure -enable-debugger -enable-disasm
make
sudo make install
which bochs
)apt-get install vgabios
)whereis vgabios
)###############################################################
# Configuration file for Bochs
################################################################ how much memory the emulated machine will have
megs: 32# filename of ROM images
romimage: file=/usr/local/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/vgabios/vgabios.bin# what disk images will be used
floppya: 1_44=a.img, status=inserted# choose the boot disk.
boot: floppy# where do we send log messages?
# log: bochsout.txt# disable the mouse
mouse: enabled=0# enable key mapping, using US layout as default.
keyboard_mapping: enabled=1, map=/usr/local/share/bochs/keymaps/x11-pc-us.map
显式方式:
bochs -f bochsrc_file
隐式方式:
bochs
当前目录下的启动文件优先级:
(从上往下依次查找当前目录下是否有如下启动文件)
此时bochs中显示的黑屏,需要我们手动在控制台输入c:
注:将关键寄存器的值初始化为0
org 0x7c00
start:mov ax, csmov ss, axmov ds, axmov es, ax
在主引导程序加载运行时,cs段寄存器已经被初始化为0。eip初始化为7c00。