组装 - 在 bochs 中运行引导加载程序时出现问题

Wew*_*Lad 2 x86 assembly bootloader bochs

我目前正在尝试在 bochs 中编译并运行一个简单的引导加载程序。目前,这是我的 bootloader.asm 文件:

\n\n
[BITS 16]\n[ORG 0x7C00] ;Where the code gets mapped\ntop:\n    jmp top ;Loop forever\ntimes 510-($-$$) db 0 ;Pad with 0\ndw 0xAA55 ;Bootloader signature (backwards)\n    ;; dw declares a word (2 bytes because we\xe2\x80\x99re 16 bits)\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后,从我的 pragmalinux-img 目录中输入以下命令:

\n\n
yasm bootloader.asm\ndd if=bootloader bs=512 \nbochs\n
Run Code Online (Sandbox Code Playgroud)\n\n

运行 bochs 后,我收到以下错误消息。(抱歉文字墙)

\n\n
                        Bochs x86 Emulator 2.6\n            Built from SVN snapshot on September 2nd, 2012\n========================================================================\n00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default        '/usr/lib/bochs/plugins'\n00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'\n00000000000i[     ] lt_dlhandle is 0x2d78540\n00000000000i[PLGIN] loaded plugin libbx_unmapped.so\n00000000000i[     ] lt_dlhandle is 0x2d79270\n00000000000i[PLGIN] loaded plugin libbx_biosdev.so\n00000000000i[     ] lt_dlhandle is 0x2d79bf0\n00000000000i[PLGIN] loaded plugin libbx_speaker.so\n00000000000i[     ] lt_dlhandle is 0x2d7b2d0\n00000000000i[PLGIN] loaded plugin libbx_extfpuirq.so\n00000000000i[     ] lt_dlhandle is 0x2d7bbf0\n00000000000i[PLGIN] loaded plugin libbx_parallel.so\n00000000000i[     ] lt_dlhandle is 0x2d7d7c0\n00000000000i[PLGIN] loaded plugin libbx_serial.so\n00000000000i[     ] lt_dlhandle is 0x2d813a0\n00000000000i[PLGIN] loaded plugin libbx_gameport.so\n00000000000i[     ] lt_dlhandle is 0x2d81e40\n00000000000i[PLGIN] loaded plugin libbx_iodebug.so\n00000000000i[     ] reading configuration from bochsrc\n00000000000e[     ] bochsrc:9: 'vga_update_interval' will be replaced by new 'vga: update_freq' option.\n00000000000e[     ] bochsrc:10: 'i440fxsupport' will be replaced by new 'pci' option.\n00000000000i[     ] lt_dlhandle is (nil)\n00000000000p[     ] >>PANIC<< dlopen failed for module 'sdl': file not found\n========================================================================\nEvent type: PANIC\nDevice: [     ]\nMessage: dlopen failed for module 'sdl': file not found\n\nA PANIC has occurred.  Do you want to:\n  cont       - continue execution\n  alwayscont - continue execution, and don't ask again.\n               This affects only PANIC events from device [     ]\n  die        - stop execution now\n  abort      - dump core \n  debug      - continue and return to bochs debugger\nChoose one of the actions above: [die] die\n00000000000i[CPU0 ] CPU is in real mode (active)\n00000000000i[CPU0 ] CS.mode = 16 bit\n00000000000i[CPU0 ] SS.mode = 16 bit\n00000000000i[CPU0 ] EFER   = 0x00000000\n00000000000i[CPU0 ] | EAX=00000000  EBX=00000000  ECX=00000000  EDX=00000000\n00000000000i[CPU0 ] | ESP=00000000  EBP=00000000  ESI=00000000  EDI=00000000\n00000000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf\n00000000000i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D\n00000000000i[CPU0 ] |  CS:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] |  DS:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] |  SS:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] |  ES:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] |  FS:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] |  GS:0000( 0000| 0|  0) 00000000 00000000 0 0\n00000000000i[CPU0 ] | EIP=00000000 (00000000)\n00000000000i[CPU0 ] | CR0=0x00000000 CR2=0x00000000\n00000000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000\nbx_dbg_read_linear: physical memory read error (phy=0x0000000000000000, lin=0x0000000000000000)\n00000000000i[CTRL ] quit_sim called with exit code 1\n
Run Code Online (Sandbox Code Playgroud)\n\n

我对组装和此类事情很陌生,因此非常感谢您的帮助。谢谢。

\n

Wew*_*Lad 5

由于@Someprogrammerdude 的提示修复了它。刚刚跑:

sudo apt-get install bochs-sdl 
Run Code Online (Sandbox Code Playgroud)

很快就修好了。应该注意的是我也跑了:

sudo apt-get install bochs-x 
Run Code Online (Sandbox Code Playgroud)

在此之前,根据旧论坛帖子的建议。可能与修复有关。