MBR 说分区表无效 - 但系统可以工作!为什么?
我收到了一个期末项目,要求编写汇编代码来读取 MBR 并将其保存到软盘。我想我设法在 VirtualBox 机器的 DOS 中使用 INT 13h 读取它。机器只有一个硬盘,一个分区,安装的是XP。
当我读取 MBR 并打印它时,它给了我一大堆垃圾,其中包括:无效的分区表。加载操作系统时出错...就像在这个网站中一样: http://mbr.adamsatoms.com
但是我的系统启动正常。我是否正确读取了 MBR?真的是MBR吗?为什么会出现这种情况?这是我的代码的一部分,如果有帮助的话,请阅读:
mov dx,80h ; hard disk first drive
mov cx,1 ; Cylinder & Sector
mov bx,ds
mov es,bx
mov bx,offset result
mov ax,0201h ; function & sector to be read
int 13h
I have been given an end of term project to write an assembly code to read the MBR and save it to floppy. I think I managed to read it with INT 13h in DOS in a VirtualBox machine. The machine has only one hard disk with one partition with XP installed.
When I read the MBR and print it, it gives me a whole lot of junk and amongst the junk it says: Invalid partition table. Error loading operating system... just like in this website: http://mbr.adamsatoms.com
But my system boots fine. Did I read the MBR correctly. Is it really the MBR? Why does this happen? This is part of my code for reading if it helps:
mov dx,80h ; hard disk first drive
mov cx,1 ; Cylinder & Sector
mov bx,ds
mov es,bx
mov bx,offset result
mov ax,0201h ; function & sector to be read
int 13h
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这很正常,“垃圾”是组成MBR的机器代码,如果MBR代码在尝试启动PC时遇到一些问题,就会显示各种错误字符串。 MBR代码的完整分析正是在你所说的页面上。
It's normal, the "garbage" is the machine code that composes the MBR, and the various error strings are there to be displayed if the MBR code encounters some problems while trying to boot the PC. The full analysis of the MBR code is exactly at the page you said.
您正在看到引导加载程序的一部分。这是存储在驱动器的第一个扇区中的一段程序,其作用是读取分区表并开始启动操作系统。如果失败,它会显示您刚刚找到源代码的错误消息...其余的“垃圾”将是引导加载程序的代码(以机器代码形式),您需要对其进行反汇编才能使其有意义。
You're seeing part of the boot loader. This is a piece of program stored in the first sectors of your drive, which' job it is to read the partition table and start booting the OS. If this fails, it shows the error messages for which you just found the source... The rest of the 'junk' will be code of the bootloader (in machine code), you'll need to disassemble it for it to make sense.