Bochs是一款x86模拟器,可以用于模拟运行x86架构的操作系统和软件。下面是Bochs的一些基本使用方式:
启动Bochs:可以在终端中运行以下命令来启动Bochs:
1bochs
这将使用默认的bochsrc配置文件启动Bochs模拟器。
使用自定义配置文件:如果您有一个自定义的bochsrc配置文件,可以通过以下命令来指定它:
1bochs -f /path/to/bochsrc
将/path/to/bochsrc替换为您的自定义配置文件的路径。
使用命令行选项:您可以在启动Bochs时使用一些命令行选项来更改配置。例如,可以使用-q选项以静默模式启动Bochs,或者使用-rc选项指定一个附加的rc脚本文件。
调试模式:Bochs还提供了调试功能,可以用于在模拟器中进行调试操作系统或程序。您可以使用以下命令启动Bochs的调试模式:
1bochs -q -rc /path/to/debugger.bxrc
这里/path/to/debugger.bxrc是包含调试器相关设置的bxrc脚本文件。在调试模式下,您可以使用一系列的调试命令,例如设置断点、单步执行、查看寄存器值等。
退出Bochs:要退出Bochs模拟器,可以在控制台中运行quit或exit命令,或者使用快捷键Ctrl + Alt + Del。
bochs生成配置文件并修改为gui_debug
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354whc@whc-virtual-machine:~/code/gitRep/os/computer/x86_assembly/tests$ bochs======================================================================== Bochs x86 Emulator 2.6.11 Built from SVN snapshot on January 5, 2020 Timestamp: Sun Jan 5 08:36:00 CET 2020========================================================================00000000000i[ ] BXSHARE not set. using compile time default '/usr/local/share/bochs'------------------------------Bochs Configuration: Main Menu------------------------------This is the Bochs Configuration Interface, where you can describe themachine that you want to simulate. Bochs has already searched for aconfiguration file (typically called bochsrc.txt) and loaded it if itcould be found. When you are satisfied with the configuration, goahead and start the simulation.You can also start bochs with the -q option to skip these menus.1. Restore factory default configuration2. Read options from...3. Edit options4. Save options to...5. Restore the Bochs state from...6. Begin simulation7. Quit nowPlease choose one: [2] 4Save configuration to what file? To cancel, type 'none'.[none] bochsrc00000000000i[ ] write current configuration to bochsrcWrote configuration to 'bochsrc'.------------------------------Bochs Configuration: Main Menu------------------------------This is the Bochs Configuration Interface, where you can describe themachine that you want to simulate. Bochs has already searched for aconfiguration file (typically called bochsrc.txt) and loaded it if itcould be found. When you are satisfied with the configuration, goahead and start the simulation.You can also start bochs with the -q option to skip these menus.1. Restore factory default configuration2. Read options from...3. Edit options4. Save options to...5. Restore the Bochs state from...6. Begin simulation7. Quit nowPlease choose one: [2] 700000000000i[SIM ] quit_sim called with exit code 1
bochsrc
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556# configuration file generated by Bochsplugin_ctrl: unmapped=true, biosdev=true, speaker=true, extfpuirq=true, parallel=true, serial=true, iodebug=trueconfig_interface: textconfigdisplay_library: x, options="gui_debug"memory: host=32, guest=32romimage: file="/usr/local/share/bochs/BIOS-bochs-latest", address=0x00000000, options=nonevgaromimage: file="/usr/local/share/bochs/VGABIOS-lgpl-latest"boot: floppyfloppy_bootsig_check: disabled=0# no floppya# no floppybata0: enabled=true, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14ata0-master: type=noneata0-slave: type=noneata1: enabled=true, ioaddr1=0x170, ioaddr2=0x370, irq=15ata1-master: type=noneata1-slave: type=noneata2: enabled=falseata3: enabled=falseoptromimage1: file=noneoptromimage2: file=noneoptromimage3: file=noneoptromimage4: file=noneoptramimage1: file=noneoptramimage2: file=noneoptramimage3: file=noneoptramimage4: file=nonepci: enabled=1, chipset=i440fxvga: extension=vbe, update_freq=5, realtime=1cpu: count=1, ips=4000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "cpuid: mmx=true, apic=xapic, simd=sse2, sse4a=false, misaligned_sse=false, sep=truecpuid: movbe=false, adx=false, aes=false, sha=false, xsave=false, xsaveopt=false, smep=falsecpuid: smap=false, mwait=trueprint_timestamps: enabled=0debugger_log: -magic_break: enabled=0port_e9_hack: enabled=0private_colormap: enabled=0clock: sync=none, time0=local, rtc_sync=0# no cmosimagelog: -logprefix: %t%e%ddebug: action=ignoreinfo: action=reporterror: action=reportpanic: action=askkeyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=nonemouse: type=ps2, enabled=false, toggle=ctrl+mbuttonspeaker: enabled=true, mode=systemparport1: enabled=true, file=noneparport2: enabled=falsecom1: enabled=true, mode=nullcom2: enabled=falsecom3: enabled=falsecom4: enabled=false